misc.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 <rxrpc/packet.h>
  15. #include "internal.h"
  16. #include "afs_fs.h"
  17. /*
  18. * convert an AFS abort code to a Linux error number
  19. */
  20. int afs_abort_to_error(u32 abort_code)
  21. {
  22. switch (abort_code) {
  23. case 13: return -EACCES;
  24. case 27: return -EFBIG;
  25. case 30: return -EROFS;
  26. case VSALVAGE: return -EIO;
  27. case VNOVNODE: return -ENOENT;
  28. case VNOVOL: return -ENOMEDIUM;
  29. case VVOLEXISTS: return -EEXIST;
  30. case VNOSERVICE: return -EIO;
  31. case VOFFLINE: return -ENOENT;
  32. case VONLINE: return -EEXIST;
  33. case VDISKFULL: return -ENOSPC;
  34. case VOVERQUOTA: return -EDQUOT;
  35. case VBUSY: return -EBUSY;
  36. case VMOVED: return -ENXIO;
  37. case 0x2f6df0a: return -EWOULDBLOCK;
  38. case 0x2f6df0c: return -EACCES;
  39. case 0x2f6df0f: return -EBUSY;
  40. case 0x2f6df10: return -EEXIST;
  41. case 0x2f6df11: return -EXDEV;
  42. case 0x2f6df13: return -ENOTDIR;
  43. case 0x2f6df14: return -EISDIR;
  44. case 0x2f6df15: return -EINVAL;
  45. case 0x2f6df1a: return -EFBIG;
  46. case 0x2f6df1b: return -ENOSPC;
  47. case 0x2f6df1d: return -EROFS;
  48. case 0x2f6df1e: return -EMLINK;
  49. case 0x2f6df20: return -EDOM;
  50. case 0x2f6df21: return -ERANGE;
  51. case 0x2f6df22: return -EDEADLK;
  52. case 0x2f6df23: return -ENAMETOOLONG;
  53. case 0x2f6df24: return -ENOLCK;
  54. case 0x2f6df26: return -ENOTEMPTY;
  55. case 0x2f6df78: return -EDQUOT;
  56. case RXKADINCONSISTENCY: return -EPROTO;
  57. case RXKADPACKETSHORT: return -EPROTO;
  58. case RXKADLEVELFAIL: return -EKEYREJECTED;
  59. case RXKADTICKETLEN: return -EKEYREJECTED;
  60. case RXKADOUTOFSEQUENCE: return -EPROTO;
  61. case RXKADNOAUTH: return -EKEYREJECTED;
  62. case RXKADBADKEY: return -EKEYREJECTED;
  63. case RXKADBADTICKET: return -EKEYREJECTED;
  64. case RXKADUNKNOWNKEY: return -EKEYREJECTED;
  65. case RXKADEXPIRED: return -EKEYEXPIRED;
  66. case RXKADSEALEDINCON: return -EKEYREJECTED;
  67. case RXKADDATALEN: return -EKEYREJECTED;
  68. case RXKADILLEGALLEVEL: return -EKEYREJECTED;
  69. default: return -EREMOTEIO;
  70. }
  71. }