0001
0002
0003
0004
0005 #ifndef NFSD_EXPORT_H
0006 #define NFSD_EXPORT_H
0007
0008 #include <linux/sunrpc/cache.h>
0009 #include <linux/percpu_counter.h>
0010 #include <uapi/linux/nfsd/export.h>
0011 #include <linux/nfs4.h>
0012
0013 struct knfsd_fh;
0014 struct svc_fh;
0015 struct svc_rqst;
0016
0017
0018
0019
0020
0021 #define MAX_FS_LOCATIONS 128
0022
0023 struct nfsd4_fs_location {
0024 char *hosts;
0025 char *path;
0026 };
0027
0028 struct nfsd4_fs_locations {
0029 uint32_t locations_count;
0030 struct nfsd4_fs_location *locations;
0031
0032
0033 int migrated;
0034 };
0035
0036
0037
0038
0039
0040
0041
0042 #define MAX_SECINFO_LIST 8
0043 #define EX_UUID_LEN 16
0044
0045 struct exp_flavor_info {
0046 u32 pseudoflavor;
0047 u32 flags;
0048 };
0049
0050
0051 enum {
0052 EXP_STATS_FH_STALE,
0053 EXP_STATS_IO_READ,
0054 EXP_STATS_IO_WRITE,
0055 EXP_STATS_COUNTERS_NUM
0056 };
0057
0058 struct export_stats {
0059 time64_t start_time;
0060 struct percpu_counter counter[EXP_STATS_COUNTERS_NUM];
0061 };
0062
0063 struct svc_export {
0064 struct cache_head h;
0065 struct auth_domain * ex_client;
0066 int ex_flags;
0067 struct path ex_path;
0068 kuid_t ex_anon_uid;
0069 kgid_t ex_anon_gid;
0070 int ex_fsid;
0071 unsigned char * ex_uuid;
0072 struct nfsd4_fs_locations ex_fslocs;
0073 uint32_t ex_nflavors;
0074 struct exp_flavor_info ex_flavors[MAX_SECINFO_LIST];
0075 u32 ex_layout_types;
0076 struct nfsd4_deviceid_map *ex_devid_map;
0077 struct cache_detail *cd;
0078 struct rcu_head ex_rcu;
0079 struct export_stats ex_stats;
0080 };
0081
0082
0083
0084
0085
0086 struct svc_expkey {
0087 struct cache_head h;
0088
0089 struct auth_domain * ek_client;
0090 int ek_fsidtype;
0091 u32 ek_fsid[6];
0092
0093 struct path ek_path;
0094 struct rcu_head ek_rcu;
0095 };
0096
0097 #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
0098 #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
0099 #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
0100
0101 int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
0102 __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
0103
0104
0105
0106
0107 int nfsd_export_init(struct net *);
0108 void nfsd_export_shutdown(struct net *);
0109 void nfsd_export_flush(struct net *);
0110 struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
0111 struct path *);
0112 struct svc_export * rqst_exp_parent(struct svc_rqst *,
0113 struct path *);
0114 struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
0115 int exp_rootfh(struct net *, struct auth_domain *,
0116 char *path, struct knfsd_fh *, int maxsize);
0117 __be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
0118 __be32 nfserrno(int errno);
0119
0120 static inline void exp_put(struct svc_export *exp)
0121 {
0122 cache_put(&exp->h, exp->cd);
0123 }
0124
0125 static inline struct svc_export *exp_get(struct svc_export *exp)
0126 {
0127 cache_get(&exp->h);
0128 return exp;
0129 }
0130 struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
0131
0132 #endif