misc.c 1.1 KB

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