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