xref: /openbmc/linux/fs/nfsd/nfs2acl.c (revision 9c0b0ff79935c7e18b2f2f0d66de7086f57c077b)
1a257cdd0SAndreas Gruenbacher /*
2a257cdd0SAndreas Gruenbacher  * Process version 2 NFSACL requests.
3a257cdd0SAndreas Gruenbacher  *
4a257cdd0SAndreas Gruenbacher  * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de>
5a257cdd0SAndreas Gruenbacher  */
6a257cdd0SAndreas Gruenbacher 
79a74af21SBoaz Harrosh #include "nfsd.h"
89a74af21SBoaz Harrosh /* FIXME: nfsacl.h is a broken header */
9a257cdd0SAndreas Gruenbacher #include <linux/nfsacl.h>
105a0e3ad6STejun Heo #include <linux/gfp.h>
119a74af21SBoaz Harrosh #include "cache.h"
129a74af21SBoaz Harrosh #include "xdr3.h"
130a3adadeSJ. Bruce Fields #include "vfs.h"
14a257cdd0SAndreas Gruenbacher 
15a257cdd0SAndreas Gruenbacher #define NFSDDBG_FACILITY		NFSDDBG_PROC
16a257cdd0SAndreas Gruenbacher #define RETURN_STATUS(st)	{ resp->status = (st); return (st); }
17a257cdd0SAndreas Gruenbacher 
18a257cdd0SAndreas Gruenbacher /*
19a257cdd0SAndreas Gruenbacher  * NULL call.
20a257cdd0SAndreas Gruenbacher  */
217111c66eSAl Viro static __be32
22a257cdd0SAndreas Gruenbacher nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
23a257cdd0SAndreas Gruenbacher {
24a257cdd0SAndreas Gruenbacher 	return nfs_ok;
25a257cdd0SAndreas Gruenbacher }
26a257cdd0SAndreas Gruenbacher 
27a257cdd0SAndreas Gruenbacher /*
28a257cdd0SAndreas Gruenbacher  * Get the Access and/or Default ACL of a file.
29a257cdd0SAndreas Gruenbacher  */
307111c66eSAl Viro static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
31a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
32a257cdd0SAndreas Gruenbacher {
33a257cdd0SAndreas Gruenbacher 	svc_fh *fh;
34a257cdd0SAndreas Gruenbacher 	struct posix_acl *acl;
35c4d987baSAl Viro 	__be32 nfserr = 0;
36a257cdd0SAndreas Gruenbacher 
37a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: GETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));
38a257cdd0SAndreas Gruenbacher 
39a257cdd0SAndreas Gruenbacher 	fh = fh_copy(&resp->fh, &argp->fh);
408837abcaSMiklos Szeredi 	nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
418837abcaSMiklos Szeredi 	if (nfserr)
42ac8587dcSJ. Bruce Fields 		RETURN_STATUS(nfserr);
43a257cdd0SAndreas Gruenbacher 
44a257cdd0SAndreas Gruenbacher 	if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
45a257cdd0SAndreas Gruenbacher 		RETURN_STATUS(nfserr_inval);
46a257cdd0SAndreas Gruenbacher 	resp->mask = argp->mask;
47a257cdd0SAndreas Gruenbacher 
48a257cdd0SAndreas Gruenbacher 	if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
49a257cdd0SAndreas Gruenbacher 		acl = nfsd_get_posix_acl(fh, ACL_TYPE_ACCESS);
50a257cdd0SAndreas Gruenbacher 		if (IS_ERR(acl)) {
51a257cdd0SAndreas Gruenbacher 			int err = PTR_ERR(acl);
52a257cdd0SAndreas Gruenbacher 
53a257cdd0SAndreas Gruenbacher 			if (err == -ENODATA || err == -EOPNOTSUPP)
54a257cdd0SAndreas Gruenbacher 				acl = NULL;
55a257cdd0SAndreas Gruenbacher 			else {
56a257cdd0SAndreas Gruenbacher 				nfserr = nfserrno(err);
57a257cdd0SAndreas Gruenbacher 				goto fail;
58a257cdd0SAndreas Gruenbacher 			}
59a257cdd0SAndreas Gruenbacher 		}
60a257cdd0SAndreas Gruenbacher 		if (acl == NULL) {
61a257cdd0SAndreas Gruenbacher 			/* Solaris returns the inode's minimum ACL. */
62a257cdd0SAndreas Gruenbacher 
63a257cdd0SAndreas Gruenbacher 			struct inode *inode = fh->fh_dentry->d_inode;
64a257cdd0SAndreas Gruenbacher 			acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
65a257cdd0SAndreas Gruenbacher 		}
66a257cdd0SAndreas Gruenbacher 		resp->acl_access = acl;
67a257cdd0SAndreas Gruenbacher 	}
68a257cdd0SAndreas Gruenbacher 	if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) {
69a257cdd0SAndreas Gruenbacher 		/* Check how Solaris handles requests for the Default ACL
70a257cdd0SAndreas Gruenbacher 		   of a non-directory! */
71a257cdd0SAndreas Gruenbacher 
72a257cdd0SAndreas Gruenbacher 		acl = nfsd_get_posix_acl(fh, ACL_TYPE_DEFAULT);
73a257cdd0SAndreas Gruenbacher 		if (IS_ERR(acl)) {
74a257cdd0SAndreas Gruenbacher 			int err = PTR_ERR(acl);
75a257cdd0SAndreas Gruenbacher 
76a257cdd0SAndreas Gruenbacher 			if (err == -ENODATA || err == -EOPNOTSUPP)
77a257cdd0SAndreas Gruenbacher 				acl = NULL;
78a257cdd0SAndreas Gruenbacher 			else {
79a257cdd0SAndreas Gruenbacher 				nfserr = nfserrno(err);
80a257cdd0SAndreas Gruenbacher 				goto fail;
81a257cdd0SAndreas Gruenbacher 			}
82a257cdd0SAndreas Gruenbacher 		}
83a257cdd0SAndreas Gruenbacher 		resp->acl_default = acl;
84a257cdd0SAndreas Gruenbacher 	}
85a257cdd0SAndreas Gruenbacher 
86a257cdd0SAndreas Gruenbacher 	/* resp->acl_{access,default} are released in nfssvc_release_getacl. */
87a257cdd0SAndreas Gruenbacher 	RETURN_STATUS(0);
88a257cdd0SAndreas Gruenbacher 
89a257cdd0SAndreas Gruenbacher fail:
90a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_access);
91a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_default);
92a257cdd0SAndreas Gruenbacher 	RETURN_STATUS(nfserr);
93a257cdd0SAndreas Gruenbacher }
94a257cdd0SAndreas Gruenbacher 
95a257cdd0SAndreas Gruenbacher /*
96a257cdd0SAndreas Gruenbacher  * Set the Access and/or Default ACL of a file.
97a257cdd0SAndreas Gruenbacher  */
987111c66eSAl Viro static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp,
99a257cdd0SAndreas Gruenbacher 		struct nfsd3_setaclargs *argp,
100a257cdd0SAndreas Gruenbacher 		struct nfsd_attrstat *resp)
101a257cdd0SAndreas Gruenbacher {
102a257cdd0SAndreas Gruenbacher 	svc_fh *fh;
103c4d987baSAl Viro 	__be32 nfserr = 0;
104a257cdd0SAndreas Gruenbacher 
105a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: SETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));
106a257cdd0SAndreas Gruenbacher 
107a257cdd0SAndreas Gruenbacher 	fh = fh_copy(&resp->fh, &argp->fh);
1088837abcaSMiklos Szeredi 	nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);
109a257cdd0SAndreas Gruenbacher 
110a257cdd0SAndreas Gruenbacher 	if (!nfserr) {
111a257cdd0SAndreas Gruenbacher 		nfserr = nfserrno( nfsd_set_posix_acl(
112a257cdd0SAndreas Gruenbacher 			fh, ACL_TYPE_ACCESS, argp->acl_access) );
113a257cdd0SAndreas Gruenbacher 	}
114a257cdd0SAndreas Gruenbacher 	if (!nfserr) {
115a257cdd0SAndreas Gruenbacher 		nfserr = nfserrno( nfsd_set_posix_acl(
116a257cdd0SAndreas Gruenbacher 			fh, ACL_TYPE_DEFAULT, argp->acl_default) );
117a257cdd0SAndreas Gruenbacher 	}
118a257cdd0SAndreas Gruenbacher 
119a257cdd0SAndreas Gruenbacher 	/* argp->acl_{access,default} may have been allocated in
120a257cdd0SAndreas Gruenbacher 	   nfssvc_decode_setaclargs. */
121a257cdd0SAndreas Gruenbacher 	posix_acl_release(argp->acl_access);
122a257cdd0SAndreas Gruenbacher 	posix_acl_release(argp->acl_default);
123a257cdd0SAndreas Gruenbacher 	return nfserr;
124a257cdd0SAndreas Gruenbacher }
125a257cdd0SAndreas Gruenbacher 
126a257cdd0SAndreas Gruenbacher /*
127a257cdd0SAndreas Gruenbacher  * Check file attributes
128a257cdd0SAndreas Gruenbacher  */
1297111c66eSAl Viro static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp,
130a257cdd0SAndreas Gruenbacher 		struct nfsd_fhandle *argp, struct nfsd_attrstat *resp)
131a257cdd0SAndreas Gruenbacher {
132a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: GETATTR  %s\n", SVCFH_fmt(&argp->fh));
133a257cdd0SAndreas Gruenbacher 
134a257cdd0SAndreas Gruenbacher 	fh_copy(&resp->fh, &argp->fh);
1358837abcaSMiklos Szeredi 	return fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
136a257cdd0SAndreas Gruenbacher }
137a257cdd0SAndreas Gruenbacher 
138a257cdd0SAndreas Gruenbacher /*
139a257cdd0SAndreas Gruenbacher  * Check file access
140a257cdd0SAndreas Gruenbacher  */
1417111c66eSAl Viro static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
142a257cdd0SAndreas Gruenbacher 		struct nfsd3_accessres *resp)
143a257cdd0SAndreas Gruenbacher {
144c4d987baSAl Viro 	__be32 nfserr;
145a257cdd0SAndreas Gruenbacher 
146a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: ACCESS(2acl)   %s 0x%x\n",
147a257cdd0SAndreas Gruenbacher 			SVCFH_fmt(&argp->fh),
148a257cdd0SAndreas Gruenbacher 			argp->access);
149a257cdd0SAndreas Gruenbacher 
150a257cdd0SAndreas Gruenbacher 	fh_copy(&resp->fh, &argp->fh);
151a257cdd0SAndreas Gruenbacher 	resp->access = argp->access;
152a257cdd0SAndreas Gruenbacher 	nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
153a257cdd0SAndreas Gruenbacher 	return nfserr;
154a257cdd0SAndreas Gruenbacher }
155a257cdd0SAndreas Gruenbacher 
156a257cdd0SAndreas Gruenbacher /*
157a257cdd0SAndreas Gruenbacher  * XDR decode functions
158a257cdd0SAndreas Gruenbacher  */
159131a21c2SAl Viro static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
160a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclargs *argp)
161a257cdd0SAndreas Gruenbacher {
162a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
163a257cdd0SAndreas Gruenbacher 		return 0;
164a257cdd0SAndreas Gruenbacher 	argp->mask = ntohl(*p); p++;
165a257cdd0SAndreas Gruenbacher 
166a257cdd0SAndreas Gruenbacher 	return xdr_argsize_check(rqstp, p);
167a257cdd0SAndreas Gruenbacher }
168a257cdd0SAndreas Gruenbacher 
169a257cdd0SAndreas Gruenbacher 
170131a21c2SAl Viro static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
171a257cdd0SAndreas Gruenbacher 		struct nfsd3_setaclargs *argp)
172a257cdd0SAndreas Gruenbacher {
173a257cdd0SAndreas Gruenbacher 	struct kvec *head = rqstp->rq_arg.head;
174a257cdd0SAndreas Gruenbacher 	unsigned int base;
175a257cdd0SAndreas Gruenbacher 	int n;
176a257cdd0SAndreas Gruenbacher 
177a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
178a257cdd0SAndreas Gruenbacher 		return 0;
179a257cdd0SAndreas Gruenbacher 	argp->mask = ntohl(*p++);
180a257cdd0SAndreas Gruenbacher 	if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||
181a257cdd0SAndreas Gruenbacher 	    !xdr_argsize_check(rqstp, p))
182a257cdd0SAndreas Gruenbacher 		return 0;
183a257cdd0SAndreas Gruenbacher 
184a257cdd0SAndreas Gruenbacher 	base = (char *)p - (char *)head->iov_base;
185a257cdd0SAndreas Gruenbacher 	n = nfsacl_decode(&rqstp->rq_arg, base, NULL,
186a257cdd0SAndreas Gruenbacher 			  (argp->mask & NFS_ACL) ?
187a257cdd0SAndreas Gruenbacher 			  &argp->acl_access : NULL);
188a257cdd0SAndreas Gruenbacher 	if (n > 0)
189a257cdd0SAndreas Gruenbacher 		n = nfsacl_decode(&rqstp->rq_arg, base + n, NULL,
190a257cdd0SAndreas Gruenbacher 				  (argp->mask & NFS_DFACL) ?
191a257cdd0SAndreas Gruenbacher 				  &argp->acl_default : NULL);
192a257cdd0SAndreas Gruenbacher 	return (n > 0);
193a257cdd0SAndreas Gruenbacher }
194a257cdd0SAndreas Gruenbacher 
195131a21c2SAl Viro static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
196a257cdd0SAndreas Gruenbacher 		struct nfsd_fhandle *argp)
197a257cdd0SAndreas Gruenbacher {
198a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
199a257cdd0SAndreas Gruenbacher 		return 0;
200a257cdd0SAndreas Gruenbacher 	return xdr_argsize_check(rqstp, p);
201a257cdd0SAndreas Gruenbacher }
202a257cdd0SAndreas Gruenbacher 
203131a21c2SAl Viro static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
204a257cdd0SAndreas Gruenbacher 		struct nfsd3_accessargs *argp)
205a257cdd0SAndreas Gruenbacher {
206a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
207a257cdd0SAndreas Gruenbacher 		return 0;
208a257cdd0SAndreas Gruenbacher 	argp->access = ntohl(*p++);
209a257cdd0SAndreas Gruenbacher 
210a257cdd0SAndreas Gruenbacher 	return xdr_argsize_check(rqstp, p);
211a257cdd0SAndreas Gruenbacher }
212a257cdd0SAndreas Gruenbacher 
213a257cdd0SAndreas Gruenbacher /*
214a257cdd0SAndreas Gruenbacher  * XDR encode functions
215a257cdd0SAndreas Gruenbacher  */
216a257cdd0SAndreas Gruenbacher 
2171b7e0403SPeter Staubach /*
2181b7e0403SPeter Staubach  * There must be an encoding function for void results so svc_process
2191b7e0403SPeter Staubach  * will work properly.
2201b7e0403SPeter Staubach  */
221*9c0b0ff7SJ. Bruce Fields static int nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
2221b7e0403SPeter Staubach {
2231b7e0403SPeter Staubach 	return xdr_ressize_check(rqstp, p);
2241b7e0403SPeter Staubach }
2251b7e0403SPeter Staubach 
226a257cdd0SAndreas Gruenbacher /* GETACL */
227131a21c2SAl Viro static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
228a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclres *resp)
229a257cdd0SAndreas Gruenbacher {
230a257cdd0SAndreas Gruenbacher 	struct dentry *dentry = resp->fh.fh_dentry;
231aefa89d1SPrasad P 	struct inode *inode;
232a257cdd0SAndreas Gruenbacher 	struct kvec *head = rqstp->rq_res.head;
233a257cdd0SAndreas Gruenbacher 	unsigned int base;
234a257cdd0SAndreas Gruenbacher 	int n;
235cb65a5baSJesper Juhl 	int w;
236a257cdd0SAndreas Gruenbacher 
237aefa89d1SPrasad P 	/*
238aefa89d1SPrasad P 	 * Since this is version 2, the check for nfserr in
239aefa89d1SPrasad P 	 * nfsd_dispatch actually ensures the following cannot happen.
240aefa89d1SPrasad P 	 * However, it seems fragile to depend on that.
241aefa89d1SPrasad P 	 */
242a257cdd0SAndreas Gruenbacher 	if (dentry == NULL || dentry->d_inode == NULL)
243a257cdd0SAndreas Gruenbacher 		return 0;
244a257cdd0SAndreas Gruenbacher 	inode = dentry->d_inode;
245a257cdd0SAndreas Gruenbacher 
246a257cdd0SAndreas Gruenbacher 	p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
247a257cdd0SAndreas Gruenbacher 	*p++ = htonl(resp->mask);
248a257cdd0SAndreas Gruenbacher 	if (!xdr_ressize_check(rqstp, p))
249a257cdd0SAndreas Gruenbacher 		return 0;
250a257cdd0SAndreas Gruenbacher 	base = (char *)p - (char *)head->iov_base;
251a257cdd0SAndreas Gruenbacher 
252cb65a5baSJesper Juhl 	rqstp->rq_res.page_len = w = nfsacl_size(
253cb65a5baSJesper Juhl 		(resp->mask & NFS_ACL)   ? resp->acl_access  : NULL,
254cb65a5baSJesper Juhl 		(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
255a257cdd0SAndreas Gruenbacher 	while (w > 0) {
25644524359SNeilBrown 		if (!rqstp->rq_respages[rqstp->rq_resused++])
257a257cdd0SAndreas Gruenbacher 			return 0;
258a257cdd0SAndreas Gruenbacher 		w -= PAGE_SIZE;
259a257cdd0SAndreas Gruenbacher 	}
260a257cdd0SAndreas Gruenbacher 
261a257cdd0SAndreas Gruenbacher 	n = nfsacl_encode(&rqstp->rq_res, base, inode,
262a257cdd0SAndreas Gruenbacher 			  resp->acl_access,
263a257cdd0SAndreas Gruenbacher 			  resp->mask & NFS_ACL, 0);
264a257cdd0SAndreas Gruenbacher 	if (n > 0)
265a257cdd0SAndreas Gruenbacher 		n = nfsacl_encode(&rqstp->rq_res, base + n, inode,
266a257cdd0SAndreas Gruenbacher 				  resp->acl_default,
267a257cdd0SAndreas Gruenbacher 				  resp->mask & NFS_DFACL,
268a257cdd0SAndreas Gruenbacher 				  NFS_ACL_DEFAULT);
269a257cdd0SAndreas Gruenbacher 	if (n <= 0)
270a257cdd0SAndreas Gruenbacher 		return 0;
271a257cdd0SAndreas Gruenbacher 	return 1;
272a257cdd0SAndreas Gruenbacher }
273a257cdd0SAndreas Gruenbacher 
274131a21c2SAl Viro static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p,
275a257cdd0SAndreas Gruenbacher 		struct nfsd_attrstat *resp)
276a257cdd0SAndreas Gruenbacher {
277a257cdd0SAndreas Gruenbacher 	p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
278a257cdd0SAndreas Gruenbacher 	return xdr_ressize_check(rqstp, p);
279a257cdd0SAndreas Gruenbacher }
280a257cdd0SAndreas Gruenbacher 
281a257cdd0SAndreas Gruenbacher /* ACCESS */
282131a21c2SAl Viro static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
283a257cdd0SAndreas Gruenbacher 		struct nfsd3_accessres *resp)
284a257cdd0SAndreas Gruenbacher {
285a257cdd0SAndreas Gruenbacher 	p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
286a257cdd0SAndreas Gruenbacher 	*p++ = htonl(resp->access);
287a257cdd0SAndreas Gruenbacher 	return xdr_ressize_check(rqstp, p);
288a257cdd0SAndreas Gruenbacher }
289a257cdd0SAndreas Gruenbacher 
290a257cdd0SAndreas Gruenbacher /*
291a257cdd0SAndreas Gruenbacher  * XDR release functions
292a257cdd0SAndreas Gruenbacher  */
293131a21c2SAl Viro static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
294a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclres *resp)
295a257cdd0SAndreas Gruenbacher {
296a257cdd0SAndreas Gruenbacher 	fh_put(&resp->fh);
297a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_access);
298a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_default);
299a257cdd0SAndreas Gruenbacher 	return 1;
300a257cdd0SAndreas Gruenbacher }
301a257cdd0SAndreas Gruenbacher 
302c9ce2283SGreg Banks static int nfsaclsvc_release_attrstat(struct svc_rqst *rqstp, __be32 *p,
303c9ce2283SGreg Banks 		struct nfsd_attrstat *resp)
304c9ce2283SGreg Banks {
305c9ce2283SGreg Banks 	fh_put(&resp->fh);
306c9ce2283SGreg Banks 	return 1;
307c9ce2283SGreg Banks }
308c9ce2283SGreg Banks 
309c9ce2283SGreg Banks static int nfsaclsvc_release_access(struct svc_rqst *rqstp, __be32 *p,
310c9ce2283SGreg Banks                struct nfsd3_accessres *resp)
311a257cdd0SAndreas Gruenbacher {
312a257cdd0SAndreas Gruenbacher        fh_put(&resp->fh);
313a257cdd0SAndreas Gruenbacher        return 1;
314a257cdd0SAndreas Gruenbacher }
315a257cdd0SAndreas Gruenbacher 
316a257cdd0SAndreas Gruenbacher #define nfsaclsvc_decode_voidargs	NULL
317a257cdd0SAndreas Gruenbacher #define nfsaclsvc_release_void		NULL
318a257cdd0SAndreas Gruenbacher #define nfsd3_fhandleargs	nfsd_fhandle
319a257cdd0SAndreas Gruenbacher #define nfsd3_attrstatres	nfsd_attrstat
320a257cdd0SAndreas Gruenbacher #define nfsd3_voidres		nfsd3_voidargs
321a257cdd0SAndreas Gruenbacher struct nfsd3_voidargs { int dummy; };
322a257cdd0SAndreas Gruenbacher 
323a257cdd0SAndreas Gruenbacher #define PROC(name, argt, rest, relt, cache, respsize)	\
324a257cdd0SAndreas Gruenbacher  { (svc_procfunc) nfsacld_proc_##name,		\
325a257cdd0SAndreas Gruenbacher    (kxdrproc_t) nfsaclsvc_decode_##argt##args,	\
326a257cdd0SAndreas Gruenbacher    (kxdrproc_t) nfsaclsvc_encode_##rest##res,	\
327a257cdd0SAndreas Gruenbacher    (kxdrproc_t) nfsaclsvc_release_##relt,		\
328a257cdd0SAndreas Gruenbacher    sizeof(struct nfsd3_##argt##args),		\
329a257cdd0SAndreas Gruenbacher    sizeof(struct nfsd3_##rest##res),		\
330a257cdd0SAndreas Gruenbacher    0,						\
331a257cdd0SAndreas Gruenbacher    cache,					\
332a257cdd0SAndreas Gruenbacher    respsize,					\
333a257cdd0SAndreas Gruenbacher  }
334a257cdd0SAndreas Gruenbacher 
335a257cdd0SAndreas Gruenbacher #define ST 1		/* status*/
336a257cdd0SAndreas Gruenbacher #define AT 21		/* attributes */
337a257cdd0SAndreas Gruenbacher #define pAT (1+AT)	/* post attributes - conditional */
338a257cdd0SAndreas Gruenbacher #define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */
339a257cdd0SAndreas Gruenbacher 
340a257cdd0SAndreas Gruenbacher static struct svc_procedure		nfsd_acl_procedures2[] = {
341a257cdd0SAndreas Gruenbacher   PROC(null,	void,		void,		void,	  RC_NOCACHE, ST),
342a257cdd0SAndreas Gruenbacher   PROC(getacl,	getacl,		getacl,		getacl,	  RC_NOCACHE, ST+1+2*(1+ACL)),
343c9ce2283SGreg Banks   PROC(setacl,	setacl,		attrstat,	attrstat, RC_NOCACHE, ST+AT),
344c9ce2283SGreg Banks   PROC(getattr, fhandle,	attrstat,	attrstat, RC_NOCACHE, ST+AT),
345c9ce2283SGreg Banks   PROC(access,	access,		access,		access,   RC_NOCACHE, ST+AT+1),
346a257cdd0SAndreas Gruenbacher };
347a257cdd0SAndreas Gruenbacher 
348a257cdd0SAndreas Gruenbacher struct svc_version	nfsd_acl_version2 = {
349a257cdd0SAndreas Gruenbacher 		.vs_vers	= 2,
350a257cdd0SAndreas Gruenbacher 		.vs_nproc	= 5,
351a257cdd0SAndreas Gruenbacher 		.vs_proc	= nfsd_acl_procedures2,
352a257cdd0SAndreas Gruenbacher 		.vs_dispatch	= nfsd_dispatch,
353a257cdd0SAndreas Gruenbacher 		.vs_xdrsize	= NFS3_SVC_XDRSIZE,
3541b7e0403SPeter Staubach 		.vs_hidden	= 0,
355a257cdd0SAndreas Gruenbacher };
356