nfs.h 1.1 KB

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