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