diff options
Diffstat (limited to 'include/linux/nfsd/export.h')
-rw-r--r-- | include/linux/nfsd/export.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index 9f62d6182d32..78feb7beff75 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h | |||
@@ -42,6 +42,9 @@ | |||
42 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ | 42 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ |
43 | #define NFSEXP_ALLFLAGS 0xFE3F | 43 | #define NFSEXP_ALLFLAGS 0xFE3F |
44 | 44 | ||
45 | /* The flags that may vary depending on security flavor: */ | ||
46 | #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | ||
47 | | NFSEXP_ALLSQUASH) | ||
45 | 48 | ||
46 | #ifdef __KERNEL__ | 49 | #ifdef __KERNEL__ |
47 | 50 | ||
@@ -64,6 +67,19 @@ struct nfsd4_fs_locations { | |||
64 | int migrated; | 67 | int migrated; |
65 | }; | 68 | }; |
66 | 69 | ||
70 | /* | ||
71 | * We keep an array of pseudoflavors with the export, in order from most | ||
72 | * to least preferred. For the forseeable future, we don't expect more | ||
73 | * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3, | ||
74 | * spkm3i, and spkm3p (and using all 8 at once should be rare). | ||
75 | */ | ||
76 | #define MAX_SECINFO_LIST 8 | ||
77 | |||
78 | struct exp_flavor_info { | ||
79 | u32 pseudoflavor; | ||
80 | u32 flags; | ||
81 | }; | ||
82 | |||
67 | struct svc_export { | 83 | struct svc_export { |
68 | struct cache_head h; | 84 | struct cache_head h; |
69 | struct auth_domain * ex_client; | 85 | struct auth_domain * ex_client; |
@@ -76,6 +92,8 @@ struct svc_export { | |||
76 | int ex_fsid; | 92 | int ex_fsid; |
77 | unsigned char * ex_uuid; /* 16 byte fsid */ | 93 | unsigned char * ex_uuid; /* 16 byte fsid */ |
78 | struct nfsd4_fs_locations ex_fslocs; | 94 | struct nfsd4_fs_locations ex_fslocs; |
95 | int ex_nflavors; | ||
96 | struct exp_flavor_info ex_flavors[MAX_SECINFO_LIST]; | ||
79 | }; | 97 | }; |
80 | 98 | ||
81 | /* an "export key" (expkey) maps a filehandlefragement to an | 99 | /* an "export key" (expkey) maps a filehandlefragement to an |
@@ -95,10 +113,22 @@ struct svc_expkey { | |||
95 | 113 | ||
96 | #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) | 114 | #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) |
97 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) | 115 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) |
98 | #define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY) | ||
99 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) | 116 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) |
100 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) | 117 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) |
101 | 118 | ||
119 | static inline int EX_RDONLY(struct svc_export *exp, struct svc_rqst *rqstp) | ||
120 | { | ||
121 | struct exp_flavor_info *f; | ||
122 | struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors; | ||
123 | |||
124 | for (f = exp->ex_flavors; f < end; f++) { | ||
125 | if (f->pseudoflavor == rqstp->rq_flavor) | ||
126 | return f->flags & NFSEXP_READONLY; | ||
127 | } | ||
128 | return exp->ex_flags & NFSEXP_READONLY; | ||
129 | } | ||
130 | |||
131 | __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp); | ||
102 | 132 | ||
103 | /* | 133 | /* |
104 | * Function declarations | 134 | * Function declarations |
@@ -112,13 +142,19 @@ struct svc_export * exp_get_by_name(struct auth_domain *clp, | |||
112 | struct vfsmount *mnt, | 142 | struct vfsmount *mnt, |
113 | struct dentry *dentry, | 143 | struct dentry *dentry, |
114 | struct cache_req *reqp); | 144 | struct cache_req *reqp); |
145 | struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, | ||
146 | struct vfsmount *, | ||
147 | struct dentry *); | ||
115 | struct svc_export * exp_parent(struct auth_domain *clp, | 148 | struct svc_export * exp_parent(struct auth_domain *clp, |
116 | struct vfsmount *mnt, | 149 | struct vfsmount *mnt, |
117 | struct dentry *dentry, | 150 | struct dentry *dentry, |
118 | struct cache_req *reqp); | 151 | struct cache_req *reqp); |
152 | struct svc_export * rqst_exp_parent(struct svc_rqst *, | ||
153 | struct vfsmount *mnt, | ||
154 | struct dentry *dentry); | ||
119 | int exp_rootfh(struct auth_domain *, | 155 | int exp_rootfh(struct auth_domain *, |
120 | char *path, struct knfsd_fh *, int maxsize); | 156 | char *path, struct knfsd_fh *, int maxsize); |
121 | __be32 exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); | 157 | __be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *); |
122 | __be32 nfserrno(int errno); | 158 | __be32 nfserrno(int errno); |
123 | 159 | ||
124 | extern struct cache_detail svc_export_cache; | 160 | extern struct cache_detail svc_export_cache; |
@@ -135,6 +171,7 @@ static inline void exp_get(struct svc_export *exp) | |||
135 | extern struct svc_export * | 171 | extern struct svc_export * |
136 | exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv, | 172 | exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv, |
137 | struct cache_req *reqp); | 173 | struct cache_req *reqp); |
174 | struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *); | ||
138 | 175 | ||
139 | #endif /* __KERNEL__ */ | 176 | #endif /* __KERNEL__ */ |
140 | 177 | ||