misc.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* miscellaneous bits
  2. *
  3. * Copyright (C) 2002, 2007 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 "internal.h"
  15. #include "afs_fs.h"
  16. /*
  17. * convert an AFS abort code to a Linux error number
  18. */
  19. int afs_abort_to_error(u32 abort_code)
  20. {
  21. switch (abort_code) {
  22. case 13: return -EACCES;
  23. case VSALVAGE: return -EIO;
  24. case VNOVNODE: return -ENOENT;
  25. case VNOVOL: return -ENOMEDIUM;
  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. }