nfsfh.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * include/linux/nfsd/nfsfh.h
  3. *
  4. * This file describes the layout of the file handles as passed
  5. * over the wire.
  6. *
  7. * Earlier versions of knfsd used to sign file handles using keyed MD5
  8. * or SHA. I've removed this code, because it doesn't give you more
  9. * security than blocking external access to port 2049 on your firewall.
  10. *
  11. * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
  12. */
  13. #ifndef _LINUX_NFSD_FH_H
  14. #define _LINUX_NFSD_FH_H
  15. # include <linux/sunrpc/svc.h>
  16. #include <uapi/linux/nfsd/nfsfh.h>
  17. static inline __u32 ino_t_to_u32(ino_t ino)
  18. {
  19. return (__u32) ino;
  20. }
  21. static inline ino_t u32_to_ino_t(__u32 uino)
  22. {
  23. return (ino_t) uino;
  24. }
  25. /*
  26. * This is the internal representation of an NFS handle used in knfsd.
  27. * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
  28. */
  29. typedef struct svc_fh {
  30. struct knfsd_fh fh_handle; /* FH data */
  31. struct dentry * fh_dentry; /* validated dentry */
  32. struct svc_export * fh_export; /* export pointer */
  33. int fh_maxsize; /* max size for fh_handle */
  34. unsigned char fh_locked; /* inode locked by us */
  35. unsigned char fh_want_write; /* remount protection taken */
  36. #ifdef CONFIG_NFSD_V3
  37. unsigned char fh_post_saved; /* post-op attrs saved */
  38. unsigned char fh_pre_saved; /* pre-op attrs saved */
  39. /* Pre-op attributes saved during fh_lock */
  40. __u64 fh_pre_size; /* size before operation */
  41. struct timespec fh_pre_mtime; /* mtime before oper */
  42. struct timespec fh_pre_ctime; /* ctime before oper */
  43. /*
  44. * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode)
  45. * to find out if it is valid.
  46. */
  47. u64 fh_pre_change;
  48. /* Post-op attributes saved in fh_unlock */
  49. struct kstat fh_post_attr; /* full attrs after operation */
  50. u64 fh_post_change; /* nfsv4 change; see above */
  51. #endif /* CONFIG_NFSD_V3 */
  52. } svc_fh;
  53. #endif /* _LINUX_NFSD_FH_H */