xref: /openbmc/linux/fs/nfsd/nfs2acl.c (revision 131a21c2177c267ab259fcd06947c6f593a7de8e)
1a257cdd0SAndreas Gruenbacher /*
2f30c2269SUwe Zeisberger  * linux/fs/nfsd/nfs2acl.c
3a257cdd0SAndreas Gruenbacher  *
4a257cdd0SAndreas Gruenbacher  * Process version 2 NFSACL requests.
5a257cdd0SAndreas Gruenbacher  *
6a257cdd0SAndreas Gruenbacher  * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de>
7a257cdd0SAndreas Gruenbacher  */
8a257cdd0SAndreas Gruenbacher 
9a257cdd0SAndreas Gruenbacher #include <linux/sunrpc/svc.h>
10a257cdd0SAndreas Gruenbacher #include <linux/nfs.h>
11a257cdd0SAndreas Gruenbacher #include <linux/nfsd/nfsd.h>
12a257cdd0SAndreas Gruenbacher #include <linux/nfsd/cache.h>
13a257cdd0SAndreas Gruenbacher #include <linux/nfsd/xdr.h>
14a257cdd0SAndreas Gruenbacher #include <linux/nfsd/xdr3.h>
15a257cdd0SAndreas Gruenbacher #include <linux/posix_acl.h>
16a257cdd0SAndreas Gruenbacher #include <linux/nfsacl.h>
17a257cdd0SAndreas Gruenbacher 
18a257cdd0SAndreas Gruenbacher #define NFSDDBG_FACILITY		NFSDDBG_PROC
19a257cdd0SAndreas Gruenbacher #define RETURN_STATUS(st)	{ resp->status = (st); return (st); }
20a257cdd0SAndreas Gruenbacher 
21a257cdd0SAndreas Gruenbacher /*
22a257cdd0SAndreas Gruenbacher  * NULL call.
23a257cdd0SAndreas Gruenbacher  */
247111c66eSAl Viro static __be32
25a257cdd0SAndreas Gruenbacher nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
26a257cdd0SAndreas Gruenbacher {
27a257cdd0SAndreas Gruenbacher 	return nfs_ok;
28a257cdd0SAndreas Gruenbacher }
29a257cdd0SAndreas Gruenbacher 
30a257cdd0SAndreas Gruenbacher /*
31a257cdd0SAndreas Gruenbacher  * Get the Access and/or Default ACL of a file.
32a257cdd0SAndreas Gruenbacher  */
337111c66eSAl Viro static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
34a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
35a257cdd0SAndreas Gruenbacher {
36a257cdd0SAndreas Gruenbacher 	svc_fh *fh;
37a257cdd0SAndreas Gruenbacher 	struct posix_acl *acl;
38a257cdd0SAndreas Gruenbacher 	int nfserr = 0;
39a257cdd0SAndreas Gruenbacher 
40a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: GETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));
41a257cdd0SAndreas Gruenbacher 
42a257cdd0SAndreas Gruenbacher 	fh = fh_copy(&resp->fh, &argp->fh);
43a257cdd0SAndreas Gruenbacher 	if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
44a257cdd0SAndreas Gruenbacher 		RETURN_STATUS(nfserr_inval);
45a257cdd0SAndreas Gruenbacher 
46a257cdd0SAndreas Gruenbacher 	if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
47a257cdd0SAndreas Gruenbacher 		RETURN_STATUS(nfserr_inval);
48a257cdd0SAndreas Gruenbacher 	resp->mask = argp->mask;
49a257cdd0SAndreas Gruenbacher 
50a257cdd0SAndreas Gruenbacher 	if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
51a257cdd0SAndreas Gruenbacher 		acl = nfsd_get_posix_acl(fh, ACL_TYPE_ACCESS);
52a257cdd0SAndreas Gruenbacher 		if (IS_ERR(acl)) {
53a257cdd0SAndreas Gruenbacher 			int err = PTR_ERR(acl);
54a257cdd0SAndreas Gruenbacher 
55a257cdd0SAndreas Gruenbacher 			if (err == -ENODATA || err == -EOPNOTSUPP)
56a257cdd0SAndreas Gruenbacher 				acl = NULL;
57a257cdd0SAndreas Gruenbacher 			else {
58a257cdd0SAndreas Gruenbacher 				nfserr = nfserrno(err);
59a257cdd0SAndreas Gruenbacher 				goto fail;
60a257cdd0SAndreas Gruenbacher 			}
61a257cdd0SAndreas Gruenbacher 		}
62a257cdd0SAndreas Gruenbacher 		if (acl == NULL) {
63a257cdd0SAndreas Gruenbacher 			/* Solaris returns the inode's minimum ACL. */
64a257cdd0SAndreas Gruenbacher 
65a257cdd0SAndreas Gruenbacher 			struct inode *inode = fh->fh_dentry->d_inode;
66a257cdd0SAndreas Gruenbacher 			acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
67a257cdd0SAndreas Gruenbacher 		}
68a257cdd0SAndreas Gruenbacher 		resp->acl_access = acl;
69a257cdd0SAndreas Gruenbacher 	}
70a257cdd0SAndreas Gruenbacher 	if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) {
71a257cdd0SAndreas Gruenbacher 		/* Check how Solaris handles requests for the Default ACL
72a257cdd0SAndreas Gruenbacher 		   of a non-directory! */
73a257cdd0SAndreas Gruenbacher 
74a257cdd0SAndreas Gruenbacher 		acl = nfsd_get_posix_acl(fh, ACL_TYPE_DEFAULT);
75a257cdd0SAndreas Gruenbacher 		if (IS_ERR(acl)) {
76a257cdd0SAndreas Gruenbacher 			int err = PTR_ERR(acl);
77a257cdd0SAndreas Gruenbacher 
78a257cdd0SAndreas Gruenbacher 			if (err == -ENODATA || err == -EOPNOTSUPP)
79a257cdd0SAndreas Gruenbacher 				acl = NULL;
80a257cdd0SAndreas Gruenbacher 			else {
81a257cdd0SAndreas Gruenbacher 				nfserr = nfserrno(err);
82a257cdd0SAndreas Gruenbacher 				goto fail;
83a257cdd0SAndreas Gruenbacher 			}
84a257cdd0SAndreas Gruenbacher 		}
85a257cdd0SAndreas Gruenbacher 		resp->acl_default = acl;
86a257cdd0SAndreas Gruenbacher 	}
87a257cdd0SAndreas Gruenbacher 
88a257cdd0SAndreas Gruenbacher 	/* resp->acl_{access,default} are released in nfssvc_release_getacl. */
89a257cdd0SAndreas Gruenbacher 	RETURN_STATUS(0);
90a257cdd0SAndreas Gruenbacher 
91a257cdd0SAndreas Gruenbacher fail:
92a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_access);
93a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_default);
94a257cdd0SAndreas Gruenbacher 	RETURN_STATUS(nfserr);
95a257cdd0SAndreas Gruenbacher }
96a257cdd0SAndreas Gruenbacher 
97a257cdd0SAndreas Gruenbacher /*
98a257cdd0SAndreas Gruenbacher  * Set the Access and/or Default ACL of a file.
99a257cdd0SAndreas Gruenbacher  */
1007111c66eSAl Viro static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp,
101a257cdd0SAndreas Gruenbacher 		struct nfsd3_setaclargs *argp,
102a257cdd0SAndreas Gruenbacher 		struct nfsd_attrstat *resp)
103a257cdd0SAndreas Gruenbacher {
104a257cdd0SAndreas Gruenbacher 	svc_fh *fh;
105a257cdd0SAndreas Gruenbacher 	int nfserr = 0;
106a257cdd0SAndreas Gruenbacher 
107a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: SETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));
108a257cdd0SAndreas Gruenbacher 
109a257cdd0SAndreas Gruenbacher 	fh = fh_copy(&resp->fh, &argp->fh);
110b7964c3dSAndreas Gruenbacher 	nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR);
111a257cdd0SAndreas Gruenbacher 
112a257cdd0SAndreas Gruenbacher 	if (!nfserr) {
113a257cdd0SAndreas Gruenbacher 		nfserr = nfserrno( nfsd_set_posix_acl(
114a257cdd0SAndreas Gruenbacher 			fh, ACL_TYPE_ACCESS, argp->acl_access) );
115a257cdd0SAndreas Gruenbacher 	}
116a257cdd0SAndreas Gruenbacher 	if (!nfserr) {
117a257cdd0SAndreas Gruenbacher 		nfserr = nfserrno( nfsd_set_posix_acl(
118a257cdd0SAndreas Gruenbacher 			fh, ACL_TYPE_DEFAULT, argp->acl_default) );
119a257cdd0SAndreas Gruenbacher 	}
120a257cdd0SAndreas Gruenbacher 
121a257cdd0SAndreas Gruenbacher 	/* argp->acl_{access,default} may have been allocated in
122a257cdd0SAndreas Gruenbacher 	   nfssvc_decode_setaclargs. */
123a257cdd0SAndreas Gruenbacher 	posix_acl_release(argp->acl_access);
124a257cdd0SAndreas Gruenbacher 	posix_acl_release(argp->acl_default);
125a257cdd0SAndreas Gruenbacher 	return nfserr;
126a257cdd0SAndreas Gruenbacher }
127a257cdd0SAndreas Gruenbacher 
128a257cdd0SAndreas Gruenbacher /*
129a257cdd0SAndreas Gruenbacher  * Check file attributes
130a257cdd0SAndreas Gruenbacher  */
1317111c66eSAl Viro static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp,
132a257cdd0SAndreas Gruenbacher 		struct nfsd_fhandle *argp, struct nfsd_attrstat *resp)
133a257cdd0SAndreas Gruenbacher {
134a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: GETATTR  %s\n", SVCFH_fmt(&argp->fh));
135a257cdd0SAndreas Gruenbacher 
136a257cdd0SAndreas Gruenbacher 	fh_copy(&resp->fh, &argp->fh);
137a257cdd0SAndreas Gruenbacher 	return fh_verify(rqstp, &resp->fh, 0, MAY_NOP);
138a257cdd0SAndreas Gruenbacher }
139a257cdd0SAndreas Gruenbacher 
140a257cdd0SAndreas Gruenbacher /*
141a257cdd0SAndreas Gruenbacher  * Check file access
142a257cdd0SAndreas Gruenbacher  */
1437111c66eSAl Viro static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
144a257cdd0SAndreas Gruenbacher 		struct nfsd3_accessres *resp)
145a257cdd0SAndreas Gruenbacher {
146a257cdd0SAndreas Gruenbacher 	int nfserr;
147a257cdd0SAndreas Gruenbacher 
148a257cdd0SAndreas Gruenbacher 	dprintk("nfsd: ACCESS(2acl)   %s 0x%x\n",
149a257cdd0SAndreas Gruenbacher 			SVCFH_fmt(&argp->fh),
150a257cdd0SAndreas Gruenbacher 			argp->access);
151a257cdd0SAndreas Gruenbacher 
152a257cdd0SAndreas Gruenbacher 	fh_copy(&resp->fh, &argp->fh);
153a257cdd0SAndreas Gruenbacher 	resp->access = argp->access;
154a257cdd0SAndreas Gruenbacher 	nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
155a257cdd0SAndreas Gruenbacher 	return nfserr;
156a257cdd0SAndreas Gruenbacher }
157a257cdd0SAndreas Gruenbacher 
158a257cdd0SAndreas Gruenbacher /*
159a257cdd0SAndreas Gruenbacher  * XDR decode functions
160a257cdd0SAndreas Gruenbacher  */
161*131a21c2SAl Viro static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
162a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclargs *argp)
163a257cdd0SAndreas Gruenbacher {
164a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
165a257cdd0SAndreas Gruenbacher 		return 0;
166a257cdd0SAndreas Gruenbacher 	argp->mask = ntohl(*p); p++;
167a257cdd0SAndreas Gruenbacher 
168a257cdd0SAndreas Gruenbacher 	return xdr_argsize_check(rqstp, p);
169a257cdd0SAndreas Gruenbacher }
170a257cdd0SAndreas Gruenbacher 
171a257cdd0SAndreas Gruenbacher 
172*131a21c2SAl Viro static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
173a257cdd0SAndreas Gruenbacher 		struct nfsd3_setaclargs *argp)
174a257cdd0SAndreas Gruenbacher {
175a257cdd0SAndreas Gruenbacher 	struct kvec *head = rqstp->rq_arg.head;
176a257cdd0SAndreas Gruenbacher 	unsigned int base;
177a257cdd0SAndreas Gruenbacher 	int n;
178a257cdd0SAndreas Gruenbacher 
179a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
180a257cdd0SAndreas Gruenbacher 		return 0;
181a257cdd0SAndreas Gruenbacher 	argp->mask = ntohl(*p++);
182a257cdd0SAndreas Gruenbacher 	if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||
183a257cdd0SAndreas Gruenbacher 	    !xdr_argsize_check(rqstp, p))
184a257cdd0SAndreas Gruenbacher 		return 0;
185a257cdd0SAndreas Gruenbacher 
186a257cdd0SAndreas Gruenbacher 	base = (char *)p - (char *)head->iov_base;
187a257cdd0SAndreas Gruenbacher 	n = nfsacl_decode(&rqstp->rq_arg, base, NULL,
188a257cdd0SAndreas Gruenbacher 			  (argp->mask & NFS_ACL) ?
189a257cdd0SAndreas Gruenbacher 			  &argp->acl_access : NULL);
190a257cdd0SAndreas Gruenbacher 	if (n > 0)
191a257cdd0SAndreas Gruenbacher 		n = nfsacl_decode(&rqstp->rq_arg, base + n, NULL,
192a257cdd0SAndreas Gruenbacher 				  (argp->mask & NFS_DFACL) ?
193a257cdd0SAndreas Gruenbacher 				  &argp->acl_default : NULL);
194a257cdd0SAndreas Gruenbacher 	return (n > 0);
195a257cdd0SAndreas Gruenbacher }
196a257cdd0SAndreas Gruenbacher 
197*131a21c2SAl Viro static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
198a257cdd0SAndreas Gruenbacher 		struct nfsd_fhandle *argp)
199a257cdd0SAndreas Gruenbacher {
200a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
201a257cdd0SAndreas Gruenbacher 		return 0;
202a257cdd0SAndreas Gruenbacher 	return xdr_argsize_check(rqstp, p);
203a257cdd0SAndreas Gruenbacher }
204a257cdd0SAndreas Gruenbacher 
205*131a21c2SAl Viro static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
206a257cdd0SAndreas Gruenbacher 		struct nfsd3_accessargs *argp)
207a257cdd0SAndreas Gruenbacher {
208a257cdd0SAndreas Gruenbacher 	if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
209a257cdd0SAndreas Gruenbacher 		return 0;
210a257cdd0SAndreas Gruenbacher 	argp->access = ntohl(*p++);
211a257cdd0SAndreas Gruenbacher 
212a257cdd0SAndreas Gruenbacher 	return xdr_argsize_check(rqstp, p);
213a257cdd0SAndreas Gruenbacher }
214a257cdd0SAndreas Gruenbacher 
215a257cdd0SAndreas Gruenbacher /*
216a257cdd0SAndreas Gruenbacher  * XDR encode functions
217a257cdd0SAndreas Gruenbacher  */
218a257cdd0SAndreas Gruenbacher 
219a257cdd0SAndreas Gruenbacher /* GETACL */
220*131a21c2SAl Viro static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
221a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclres *resp)
222a257cdd0SAndreas Gruenbacher {
223a257cdd0SAndreas Gruenbacher 	struct dentry *dentry = resp->fh.fh_dentry;
224a257cdd0SAndreas Gruenbacher 	struct inode *inode = dentry->d_inode;
225a257cdd0SAndreas Gruenbacher 	int w = nfsacl_size(
226a257cdd0SAndreas Gruenbacher 		(resp->mask & NFS_ACL)   ? resp->acl_access  : NULL,
227a257cdd0SAndreas Gruenbacher 		(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
228a257cdd0SAndreas Gruenbacher 	struct kvec *head = rqstp->rq_res.head;
229a257cdd0SAndreas Gruenbacher 	unsigned int base;
230a257cdd0SAndreas Gruenbacher 	int n;
231a257cdd0SAndreas Gruenbacher 
232a257cdd0SAndreas Gruenbacher 	if (dentry == NULL || dentry->d_inode == NULL)
233a257cdd0SAndreas Gruenbacher 		return 0;
234a257cdd0SAndreas Gruenbacher 	inode = dentry->d_inode;
235a257cdd0SAndreas Gruenbacher 
236a257cdd0SAndreas Gruenbacher 	p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
237a257cdd0SAndreas Gruenbacher 	*p++ = htonl(resp->mask);
238a257cdd0SAndreas Gruenbacher 	if (!xdr_ressize_check(rqstp, p))
239a257cdd0SAndreas Gruenbacher 		return 0;
240a257cdd0SAndreas Gruenbacher 	base = (char *)p - (char *)head->iov_base;
241a257cdd0SAndreas Gruenbacher 
242a257cdd0SAndreas Gruenbacher 	rqstp->rq_res.page_len = w;
243a257cdd0SAndreas Gruenbacher 	while (w > 0) {
24444524359SNeilBrown 		if (!rqstp->rq_respages[rqstp->rq_resused++])
245a257cdd0SAndreas Gruenbacher 			return 0;
246a257cdd0SAndreas Gruenbacher 		w -= PAGE_SIZE;
247a257cdd0SAndreas Gruenbacher 	}
248a257cdd0SAndreas Gruenbacher 
249a257cdd0SAndreas Gruenbacher 	n = nfsacl_encode(&rqstp->rq_res, base, inode,
250a257cdd0SAndreas Gruenbacher 			  resp->acl_access,
251a257cdd0SAndreas Gruenbacher 			  resp->mask & NFS_ACL, 0);
252a257cdd0SAndreas Gruenbacher 	if (n > 0)
253a257cdd0SAndreas Gruenbacher 		n = nfsacl_encode(&rqstp->rq_res, base + n, inode,
254a257cdd0SAndreas Gruenbacher 				  resp->acl_default,
255a257cdd0SAndreas Gruenbacher 				  resp->mask & NFS_DFACL,
256a257cdd0SAndreas Gruenbacher 				  NFS_ACL_DEFAULT);
257a257cdd0SAndreas Gruenbacher 	if (n <= 0)
258a257cdd0SAndreas Gruenbacher 		return 0;
259a257cdd0SAndreas Gruenbacher 	return 1;
260a257cdd0SAndreas Gruenbacher }
261a257cdd0SAndreas Gruenbacher 
262*131a21c2SAl Viro static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p,
263a257cdd0SAndreas Gruenbacher 		struct nfsd_attrstat *resp)
264a257cdd0SAndreas Gruenbacher {
265a257cdd0SAndreas Gruenbacher 	p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
266a257cdd0SAndreas Gruenbacher 	return xdr_ressize_check(rqstp, p);
267a257cdd0SAndreas Gruenbacher }
268a257cdd0SAndreas Gruenbacher 
269a257cdd0SAndreas Gruenbacher /* ACCESS */
270*131a21c2SAl Viro static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
271a257cdd0SAndreas Gruenbacher 		struct nfsd3_accessres *resp)
272a257cdd0SAndreas Gruenbacher {
273a257cdd0SAndreas Gruenbacher 	p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
274a257cdd0SAndreas Gruenbacher 	*p++ = htonl(resp->access);
275a257cdd0SAndreas Gruenbacher 	return xdr_ressize_check(rqstp, p);
276a257cdd0SAndreas Gruenbacher }
277a257cdd0SAndreas Gruenbacher 
278a257cdd0SAndreas Gruenbacher /*
279a257cdd0SAndreas Gruenbacher  * XDR release functions
280a257cdd0SAndreas Gruenbacher  */
281*131a21c2SAl Viro static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
282a257cdd0SAndreas Gruenbacher 		struct nfsd3_getaclres *resp)
283a257cdd0SAndreas Gruenbacher {
284a257cdd0SAndreas Gruenbacher 	fh_put(&resp->fh);
285a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_access);
286a257cdd0SAndreas Gruenbacher 	posix_acl_release(resp->acl_default);
287a257cdd0SAndreas Gruenbacher 	return 1;
288a257cdd0SAndreas Gruenbacher }
289a257cdd0SAndreas Gruenbacher 
290*131a21c2SAl Viro static int nfsaclsvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
291a257cdd0SAndreas Gruenbacher 		struct nfsd_fhandle *resp)
292a257cdd0SAndreas Gruenbacher {
293a257cdd0SAndreas Gruenbacher 	fh_put(&resp->fh);
294a257cdd0SAndreas Gruenbacher 	return 1;
295a257cdd0SAndreas Gruenbacher }
296a257cdd0SAndreas Gruenbacher 
297a257cdd0SAndreas Gruenbacher #define nfsaclsvc_decode_voidargs	NULL
298a257cdd0SAndreas Gruenbacher #define nfsaclsvc_encode_voidres	NULL
299a257cdd0SAndreas Gruenbacher #define nfsaclsvc_release_void		NULL
300a257cdd0SAndreas Gruenbacher #define nfsd3_fhandleargs	nfsd_fhandle
301a257cdd0SAndreas Gruenbacher #define nfsd3_attrstatres	nfsd_attrstat
302a257cdd0SAndreas Gruenbacher #define nfsd3_voidres		nfsd3_voidargs
303a257cdd0SAndreas Gruenbacher struct nfsd3_voidargs { int dummy; };
304a257cdd0SAndreas Gruenbacher 
305a257cdd0SAndreas Gruenbacher #define PROC(name, argt, rest, relt, cache, respsize)	\
306a257cdd0SAndreas Gruenbacher  { (svc_procfunc) nfsacld_proc_##name,		\
307a257cdd0SAndreas Gruenbacher    (kxdrproc_t) nfsaclsvc_decode_##argt##args,	\
308a257cdd0SAndreas Gruenbacher    (kxdrproc_t) nfsaclsvc_encode_##rest##res,	\
309a257cdd0SAndreas Gruenbacher    (kxdrproc_t) nfsaclsvc_release_##relt,		\
310a257cdd0SAndreas Gruenbacher    sizeof(struct nfsd3_##argt##args),		\
311a257cdd0SAndreas Gruenbacher    sizeof(struct nfsd3_##rest##res),		\
312a257cdd0SAndreas Gruenbacher    0,						\
313a257cdd0SAndreas Gruenbacher    cache,					\
314a257cdd0SAndreas Gruenbacher    respsize,					\
315a257cdd0SAndreas Gruenbacher  }
316a257cdd0SAndreas Gruenbacher 
317a257cdd0SAndreas Gruenbacher #define ST 1		/* status*/
318a257cdd0SAndreas Gruenbacher #define AT 21		/* attributes */
319a257cdd0SAndreas Gruenbacher #define pAT (1+AT)	/* post attributes - conditional */
320a257cdd0SAndreas Gruenbacher #define ACL (1+NFS_ACL_MAX_ENTRIES*3)  /* Access Control List */
321a257cdd0SAndreas Gruenbacher 
322a257cdd0SAndreas Gruenbacher static struct svc_procedure		nfsd_acl_procedures2[] = {
323a257cdd0SAndreas Gruenbacher   PROC(null,	void,		void,		void,	  RC_NOCACHE, ST),
324a257cdd0SAndreas Gruenbacher   PROC(getacl,	getacl,		getacl,		getacl,	  RC_NOCACHE, ST+1+2*(1+ACL)),
325a257cdd0SAndreas Gruenbacher   PROC(setacl,	setacl,		attrstat,	fhandle,  RC_NOCACHE, ST+AT),
326a257cdd0SAndreas Gruenbacher   PROC(getattr, fhandle,	attrstat,	fhandle,  RC_NOCACHE, ST+AT),
327a257cdd0SAndreas Gruenbacher   PROC(access,	access,		access,		fhandle,  RC_NOCACHE, ST+AT+1),
328a257cdd0SAndreas Gruenbacher };
329a257cdd0SAndreas Gruenbacher 
330a257cdd0SAndreas Gruenbacher struct svc_version	nfsd_acl_version2 = {
331a257cdd0SAndreas Gruenbacher 		.vs_vers	= 2,
332a257cdd0SAndreas Gruenbacher 		.vs_nproc	= 5,
333a257cdd0SAndreas Gruenbacher 		.vs_proc	= nfsd_acl_procedures2,
334a257cdd0SAndreas Gruenbacher 		.vs_dispatch	= nfsd_dispatch,
335a257cdd0SAndreas Gruenbacher 		.vs_xdrsize	= NFS3_SVC_XDRSIZE,
336bc5fea42SOlaf Kirch 		.vs_hidden	= 1,
337a257cdd0SAndreas Gruenbacher };
338