nfs.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * NFS protocol definitions
  3. *
  4. * This file contains constants mostly for Version 2 of the protocol,
  5. * but also has a couple of NFSv3 bits in (notably the error codes).
  6. */
  7. #ifndef _LINUX_NFS_H
  8. #define _LINUX_NFS_H
  9. #include <linux/sunrpc/msg_prot.h>
  10. #include <linux/string.h>
  11. #include <uapi/linux/nfs.h>
  12. /*
  13. * This is the kernel NFS client file handle representation
  14. */
  15. #define NFS_MAXFHSIZE 128
  16. struct nfs_fh {
  17. unsigned short size;
  18. unsigned char data[NFS_MAXFHSIZE];
  19. };
  20. /*
  21. * Returns a zero iff the size and data fields match.
  22. * Checks only "size" bytes in the data field.
  23. */
  24. static inline int nfs_compare_fh(const struct nfs_fh *a, const struct nfs_fh *b)
  25. {
  26. return a->size != b->size || memcmp(a->data, b->data, a->size) != 0;
  27. }
  28. static inline void nfs_copy_fh(struct nfs_fh *target, const struct nfs_fh *source)
  29. {
  30. target->size = source->size;
  31. memcpy(target->data, source->data, source->size);
  32. }
  33. /*
  34. * This is really a general kernel constant, but since nothing like
  35. * this is defined in the kernel headers, I have to do it here.
  36. */
  37. #define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1))
  38. enum nfs3_stable_how {
  39. NFS_UNSTABLE = 0,
  40. NFS_DATA_SYNC = 1,
  41. NFS_FILE_SYNC = 2,
  42. /* used by direct.c to mark verf as invalid */
  43. NFS_INVALID_STABLE_HOW = -1
  44. };
  45. #endif /* _LINUX_NFS_H */