export.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * include/linux/nfsd/export.h
  3. *
  4. * Public declarations for NFS exports. The definitions for the
  5. * syscall interface are in nfsctl.h
  6. *
  7. * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
  8. */
  9. #ifndef NFSD_EXPORT_H
  10. #define NFSD_EXPORT_H
  11. # include <linux/nfsd/nfsfh.h>
  12. #include <uapi/linux/nfsd/export.h>
  13. /*
  14. * FS Locations
  15. */
  16. #define MAX_FS_LOCATIONS 128
  17. struct nfsd4_fs_location {
  18. char *hosts; /* colon separated list of hosts */
  19. char *path; /* slash separated list of path components */
  20. };
  21. struct nfsd4_fs_locations {
  22. uint32_t locations_count;
  23. struct nfsd4_fs_location *locations;
  24. /* If we're not actually serving this data ourselves (only providing a
  25. * list of replicas that do serve it) then we set "migrated": */
  26. int migrated;
  27. };
  28. /*
  29. * We keep an array of pseudoflavors with the export, in order from most
  30. * to least preferred. For the foreseeable future, we don't expect more
  31. * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
  32. * spkm3i, and spkm3p (and using all 8 at once should be rare).
  33. */
  34. #define MAX_SECINFO_LIST 8
  35. struct exp_flavor_info {
  36. u32 pseudoflavor;
  37. u32 flags;
  38. };
  39. struct svc_export {
  40. struct cache_head h;
  41. struct auth_domain * ex_client;
  42. int ex_flags;
  43. struct path ex_path;
  44. uid_t ex_anon_uid;
  45. gid_t ex_anon_gid;
  46. int ex_fsid;
  47. unsigned char * ex_uuid; /* 16 byte fsid */
  48. struct nfsd4_fs_locations ex_fslocs;
  49. int ex_nflavors;
  50. struct exp_flavor_info ex_flavors[MAX_SECINFO_LIST];
  51. struct cache_detail *cd;
  52. };
  53. /* an "export key" (expkey) maps a filehandlefragement to an
  54. * svc_export for a given client. There can be several per export,
  55. * for the different fsid types.
  56. */
  57. struct svc_expkey {
  58. struct cache_head h;
  59. struct auth_domain * ek_client;
  60. int ek_fsidtype;
  61. u32 ek_fsid[6];
  62. struct path ek_path;
  63. };
  64. #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
  65. #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
  66. #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
  67. int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
  68. __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
  69. /*
  70. * Function declarations
  71. */
  72. int nfsd_export_init(struct net *);
  73. void nfsd_export_shutdown(struct net *);
  74. void nfsd_export_flush(struct net *);
  75. struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
  76. struct path *);
  77. struct svc_export * rqst_exp_parent(struct svc_rqst *,
  78. struct path *);
  79. struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
  80. int exp_rootfh(struct net *, struct auth_domain *,
  81. char *path, struct knfsd_fh *, int maxsize);
  82. __be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
  83. __be32 nfserrno(int errno);
  84. static inline void exp_put(struct svc_export *exp)
  85. {
  86. cache_put(&exp->h, exp->cd);
  87. }
  88. static inline void exp_get(struct svc_export *exp)
  89. {
  90. cache_get(&exp->h);
  91. }
  92. struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
  93. #endif /* NFSD_EXPORT_H */