1*1da177e4SLinus Torvalds /* misc.c: miscellaneous bits 2*1da177e4SLinus Torvalds * 3*1da177e4SLinus Torvalds * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 4*1da177e4SLinus Torvalds * Written by David Howells (dhowells@redhat.com) 5*1da177e4SLinus Torvalds * 6*1da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or 7*1da177e4SLinus Torvalds * modify it under the terms of the GNU General Public License 8*1da177e4SLinus Torvalds * as published by the Free Software Foundation; either version 9*1da177e4SLinus Torvalds * 2 of the License, or (at your option) any later version. 10*1da177e4SLinus Torvalds */ 11*1da177e4SLinus Torvalds 12*1da177e4SLinus Torvalds #include <linux/kernel.h> 13*1da177e4SLinus Torvalds #include <linux/module.h> 14*1da177e4SLinus Torvalds #include <linux/errno.h> 15*1da177e4SLinus Torvalds #include "errors.h" 16*1da177e4SLinus Torvalds #include "internal.h" 17*1da177e4SLinus Torvalds 18*1da177e4SLinus Torvalds /*****************************************************************************/ 19*1da177e4SLinus Torvalds /* 20*1da177e4SLinus Torvalds * convert an AFS abort code to a Linux error number 21*1da177e4SLinus Torvalds */ 22*1da177e4SLinus Torvalds int afs_abort_to_error(int abortcode) 23*1da177e4SLinus Torvalds { 24*1da177e4SLinus Torvalds switch (abortcode) { 25*1da177e4SLinus Torvalds case VSALVAGE: return -EIO; 26*1da177e4SLinus Torvalds case VNOVNODE: return -ENOENT; 27*1da177e4SLinus Torvalds case VNOVOL: return -ENXIO; 28*1da177e4SLinus Torvalds case VVOLEXISTS: return -EEXIST; 29*1da177e4SLinus Torvalds case VNOSERVICE: return -EIO; 30*1da177e4SLinus Torvalds case VOFFLINE: return -ENOENT; 31*1da177e4SLinus Torvalds case VONLINE: return -EEXIST; 32*1da177e4SLinus Torvalds case VDISKFULL: return -ENOSPC; 33*1da177e4SLinus Torvalds case VOVERQUOTA: return -EDQUOT; 34*1da177e4SLinus Torvalds case VBUSY: return -EBUSY; 35*1da177e4SLinus Torvalds case VMOVED: return -ENXIO; 36*1da177e4SLinus Torvalds default: return -EIO; 37*1da177e4SLinus Torvalds } 38*1da177e4SLinus Torvalds 39*1da177e4SLinus Torvalds } /* end afs_abort_to_error() */ 40