export.h 2.9 KB

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