diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nfsacl.h | 58 | ||||
-rw-r--r-- | include/linux/nfsd/nfsd.h | 16 | ||||
-rw-r--r-- | include/linux/nfsd/xdr.h | 4 | ||||
-rw-r--r-- | include/linux/nfsd/xdr3.h | 26 | ||||
-rw-r--r-- | include/linux/sunrpc/svc.h | 11 |
5 files changed, 115 insertions, 0 deletions
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h new file mode 100644 index 000000000000..54487a99beb8 --- /dev/null +++ b/include/linux/nfsacl.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * File: linux/nfsacl.h | ||
3 | * | ||
4 | * (C) 2003 Andreas Gruenbacher <agruen@suse.de> | ||
5 | */ | ||
6 | #ifndef __LINUX_NFSACL_H | ||
7 | #define __LINUX_NFSACL_H | ||
8 | |||
9 | #define NFS_ACL_PROGRAM 100227 | ||
10 | |||
11 | #define ACLPROC2_GETACL 1 | ||
12 | #define ACLPROC2_SETACL 2 | ||
13 | #define ACLPROC2_GETATTR 3 | ||
14 | #define ACLPROC2_ACCESS 4 | ||
15 | |||
16 | #define ACLPROC3_GETACL 1 | ||
17 | #define ACLPROC3_SETACL 2 | ||
18 | |||
19 | |||
20 | /* Flags for the getacl/setacl mode */ | ||
21 | #define NFS_ACL 0x0001 | ||
22 | #define NFS_ACLCNT 0x0002 | ||
23 | #define NFS_DFACL 0x0004 | ||
24 | #define NFS_DFACLCNT 0x0008 | ||
25 | |||
26 | /* Flag for Default ACL entries */ | ||
27 | #define NFS_ACL_DEFAULT 0x1000 | ||
28 | |||
29 | #ifdef __KERNEL__ | ||
30 | |||
31 | #include <linux/posix_acl.h> | ||
32 | |||
33 | /* Maximum number of ACL entries over NFS */ | ||
34 | #define NFS_ACL_MAX_ENTRIES 1024 | ||
35 | |||
36 | #define NFSACL_MAXWORDS (2*(2+3*NFS_ACL_MAX_ENTRIES)) | ||
37 | #define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \ | ||
38 | >> PAGE_SHIFT) | ||
39 | |||
40 | static inline unsigned int | ||
41 | nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default) | ||
42 | { | ||
43 | unsigned int w = 16; | ||
44 | w += max(acl_access ? (int)acl_access->a_count : 3, 4) * 12; | ||
45 | if (acl_default) | ||
46 | w += max((int)acl_default->a_count, 4) * 12; | ||
47 | return w; | ||
48 | } | ||
49 | |||
50 | extern unsigned int | ||
51 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | ||
52 | struct posix_acl *acl, int encode_entries, int typeflag); | ||
53 | extern unsigned int | ||
54 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | ||
55 | struct posix_acl **pacl); | ||
56 | |||
57 | #endif /* __KERNEL__ */ | ||
58 | #endif /* __LINUX_NFSACL_H */ | ||
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 8f85d9a59607..4bf931d5ff56 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/unistd.h> | 15 | #include <linux/unistd.h> |
16 | #include <linux/dirent.h> | 16 | #include <linux/dirent.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/posix_acl.h> | ||
18 | #include <linux/mount.h> | 19 | #include <linux/mount.h> |
19 | 20 | ||
20 | #include <linux/nfsd/debug.h> | 21 | #include <linux/nfsd/debug.h> |
@@ -124,6 +125,21 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *, | |||
124 | int nfsd_notify_change(struct inode *, struct iattr *); | 125 | int nfsd_notify_change(struct inode *, struct iattr *); |
125 | int nfsd_permission(struct svc_export *, struct dentry *, int); | 126 | int nfsd_permission(struct svc_export *, struct dentry *, int); |
126 | 127 | ||
128 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
129 | #ifdef CONFIG_NFSD_V2_ACL | ||
130 | extern struct svc_version nfsd_acl_version2; | ||
131 | #else | ||
132 | #define nfsd_acl_version2 NULL | ||
133 | #endif | ||
134 | #ifdef CONFIG_NFSD_V3_ACL | ||
135 | extern struct svc_version nfsd_acl_version3; | ||
136 | #else | ||
137 | #define nfsd_acl_version3 NULL | ||
138 | #endif | ||
139 | struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); | ||
140 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | ||
141 | #endif | ||
142 | |||
127 | 143 | ||
128 | /* | 144 | /* |
129 | * NFSv4 State | 145 | * NFSv4 State |
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h index ecccef777dae..130d4f588a37 100644 --- a/include/linux/nfsd/xdr.h +++ b/include/linux/nfsd/xdr.h | |||
@@ -169,4 +169,8 @@ int nfssvc_encode_entry(struct readdir_cd *, const char *name, | |||
169 | 169 | ||
170 | int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); | 170 | int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); |
171 | 171 | ||
172 | /* Helper functions for NFSv2 ACL code */ | ||
173 | u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp); | ||
174 | u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp); | ||
175 | |||
172 | #endif /* LINUX_NFSD_H */ | 176 | #endif /* LINUX_NFSD_H */ |
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h index 0ae9e0ef5f68..21e18ce7ca63 100644 --- a/include/linux/nfsd/xdr3.h +++ b/include/linux/nfsd/xdr3.h | |||
@@ -110,6 +110,19 @@ struct nfsd3_commitargs { | |||
110 | __u32 count; | 110 | __u32 count; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | struct nfsd3_getaclargs { | ||
114 | struct svc_fh fh; | ||
115 | int mask; | ||
116 | }; | ||
117 | |||
118 | struct posix_acl; | ||
119 | struct nfsd3_setaclargs { | ||
120 | struct svc_fh fh; | ||
121 | int mask; | ||
122 | struct posix_acl *acl_access; | ||
123 | struct posix_acl *acl_default; | ||
124 | }; | ||
125 | |||
113 | struct nfsd3_attrstat { | 126 | struct nfsd3_attrstat { |
114 | __u32 status; | 127 | __u32 status; |
115 | struct svc_fh fh; | 128 | struct svc_fh fh; |
@@ -209,6 +222,14 @@ struct nfsd3_commitres { | |||
209 | struct svc_fh fh; | 222 | struct svc_fh fh; |
210 | }; | 223 | }; |
211 | 224 | ||
225 | struct nfsd3_getaclres { | ||
226 | __u32 status; | ||
227 | struct svc_fh fh; | ||
228 | int mask; | ||
229 | struct posix_acl *acl_access; | ||
230 | struct posix_acl *acl_default; | ||
231 | }; | ||
232 | |||
212 | /* dummy type for release */ | 233 | /* dummy type for release */ |
213 | struct nfsd3_fhandle_pair { | 234 | struct nfsd3_fhandle_pair { |
214 | __u32 dummy; | 235 | __u32 dummy; |
@@ -241,6 +262,7 @@ union nfsd3_xdrstore { | |||
241 | struct nfsd3_fsinfores fsinfores; | 262 | struct nfsd3_fsinfores fsinfores; |
242 | struct nfsd3_pathconfres pathconfres; | 263 | struct nfsd3_pathconfres pathconfres; |
243 | struct nfsd3_commitres commitres; | 264 | struct nfsd3_commitres commitres; |
265 | struct nfsd3_getaclres getaclres; | ||
244 | }; | 266 | }; |
245 | 267 | ||
246 | #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) | 268 | #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) |
@@ -316,6 +338,10 @@ int nfs3svc_encode_entry(struct readdir_cd *, const char *name, | |||
316 | int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, | 338 | int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, |
317 | int namlen, loff_t offset, ino_t ino, | 339 | int namlen, loff_t offset, ino_t ino, |
318 | unsigned int); | 340 | unsigned int); |
341 | /* Helper functions for NFSv3 ACL code */ | ||
342 | u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, | ||
343 | struct svc_fh *fhp); | ||
344 | u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp); | ||
319 | 345 | ||
320 | 346 | ||
321 | #endif /* _LINUX_NFSD_XDR3_H */ | 347 | #endif /* _LINUX_NFSD_XDR3_H */ |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index facb94488bb1..5af8800e0ce3 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -185,6 +185,17 @@ xdr_ressize_check(struct svc_rqst *rqstp, u32 *p) | |||
185 | return vec->iov_len <= PAGE_SIZE; | 185 | return vec->iov_len <= PAGE_SIZE; |
186 | } | 186 | } |
187 | 187 | ||
188 | static inline struct page * | ||
189 | svc_take_res_page(struct svc_rqst *rqstp) | ||
190 | { | ||
191 | if (rqstp->rq_arghi <= rqstp->rq_argused) | ||
192 | return NULL; | ||
193 | rqstp->rq_arghi--; | ||
194 | rqstp->rq_respages[rqstp->rq_resused] = | ||
195 | rqstp->rq_argpages[rqstp->rq_arghi]; | ||
196 | return rqstp->rq_respages[rqstp->rq_resused++]; | ||
197 | } | ||
198 | |||
188 | static inline int svc_take_page(struct svc_rqst *rqstp) | 199 | static inline int svc_take_page(struct svc_rqst *rqstp) |
189 | { | 200 | { |
190 | if (rqstp->rq_arghi <= rqstp->rq_argused) | 201 | if (rqstp->rq_arghi <= rqstp->rq_argused) |