Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Process version 3 NFS requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/ext2_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/magic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "cache.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "xdr3.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "vfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define NFSDDBG_FACILITY		NFSDDBG_PROC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) static int	nfs3_ftypes[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	0,			/* NF3NON */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	S_IFREG,		/* NF3REG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	S_IFDIR,		/* NF3DIR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	S_IFBLK,		/* NF3BLK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	S_IFCHR,		/* NF3CHR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	S_IFLNK,		/* NF3LNK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	S_IFSOCK,		/* NF3SOCK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	S_IFIFO,		/* NF3FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * NULL call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) nfsd3_proc_null(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * Get a file's attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) nfsd3_proc_getattr(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct nfsd_fhandle *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	struct nfsd3_attrstat *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	dprintk("nfsd: GETATTR(3)  %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		SVCFH_fmt(&argp->fh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	resp->status = fh_verify(rqstp, &resp->fh, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 				 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	if (resp->status != nfs_ok)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	resp->status = fh_getattr(&resp->fh, &resp->stat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * Set a file's attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) nfsd3_proc_setattr(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	struct nfsd3_sattrargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	struct nfsd3_attrstat *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	dprintk("nfsd: SETATTR(3)  %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 				SVCFH_fmt(&argp->fh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	resp->status = nfsd_setattr(rqstp, &resp->fh, &argp->attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 				    argp->check_guard, argp->guardtime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * Look up a path name component
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) nfsd3_proc_lookup(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	struct nfsd3_diropargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	struct nfsd3_diropres  *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	dprintk("nfsd: LOOKUP(3)   %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 				argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 				argp->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	fh_copy(&resp->dirfh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	fh_init(&resp->fh, NFS3_FHSIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	resp->status = nfsd_lookup(rqstp, &resp->dirfh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 				   argp->name, argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 				   &resp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * Check file access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) nfsd3_proc_access(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	struct nfsd3_accessargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	struct nfsd3_accessres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	dprintk("nfsd: ACCESS(3)   %s 0x%x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 				argp->access);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	resp->access = argp->access;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * Read a symlink.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) nfsd3_proc_readlink(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	struct nfsd3_readlinkargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	struct nfsd3_readlinkres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	/* Read the symlink. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	resp->len = NFS3_MAXPATHLEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	resp->status = nfsd_readlink(rqstp, &resp->fh, argp->buffer, &resp->len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * Read a portion of a file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) nfsd3_proc_read(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	struct nfsd3_readargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	struct nfsd3_readres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	u32	max_blocksize = svc_max_payload(rqstp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	unsigned long cnt = min(argp->count, max_blocksize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 				(unsigned long) argp->count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 				(unsigned long long) argp->offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	/* Obtain buffer pointer for payload.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	 * + 1 (xdr opaque byte count) = 26
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	resp->count = cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 				 rqstp->rq_vec, argp->vlen, &resp->count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 				 &resp->eof);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  * Write data to a file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) nfsd3_proc_write(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	struct nfsd3_writeargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct nfsd3_writeres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	unsigned long cnt = argp->len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	unsigned int nvecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	dprintk("nfsd: WRITE(3)    %s %d bytes at %Lu%s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 				argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				(unsigned long long) argp->offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 				argp->stable? " stable" : "");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	resp->status = nfserr_fbig;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	if (argp->offset > (u64)OFFSET_MAX ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	    argp->offset + argp->len > (u64)OFFSET_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	resp->committed = argp->stable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	nvecs = svc_fill_write_vector(rqstp, rqstp->rq_arg.pages,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 				      &argp->first, cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	if (!nvecs) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		resp->status = nfserr_io;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	resp->status = nfsd_write(rqstp, &resp->fh, argp->offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 				  rqstp->rq_vec, nvecs, &cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 				  resp->committed, resp->verf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	resp->count = cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * With NFSv3, CREATE processing is a lot easier than with NFSv2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * At least in theory; we'll see how it fares in practice when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * first reports about SunOS compatibility problems start to pour in...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) nfsd3_proc_create(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	struct nfsd3_createargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	struct nfsd3_diropres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	svc_fh		*dirfhp, *newfhp = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	struct iattr	*attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	dprintk("nfsd: CREATE(3)   %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 				argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 				argp->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	dirfhp = fh_copy(&resp->dirfh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	attr   = &argp->attrs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	/* Unfudge the mode bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	attr->ia_mode &= ~S_IFMT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	if (!(attr->ia_valid & ATTR_MODE)) { 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		attr->ia_valid |= ATTR_MODE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		attr->ia_mode = S_IFREG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 		attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	/* Now create the file and set attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	resp->status = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 				      attr, newfhp, argp->createmode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 				      (u32 *)argp->verf, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)  * Make directory. This operation is not idempotent.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) nfsd3_proc_mkdir(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	struct nfsd3_createargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	struct nfsd3_diropres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	dprintk("nfsd: MKDIR(3)    %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 				argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 				argp->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	argp->attrs.ia_valid &= ~ATTR_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	fh_copy(&resp->dirfh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	fh_init(&resp->fh, NFS3_FHSIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 				   &argp->attrs, S_IFDIR, 0, &resp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	fh_unlock(&resp->dirfh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) nfsd3_proc_symlink(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	struct nfsd3_diropres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	if (argp->tlen == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		resp->status = nfserr_inval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	if (argp->tlen > NFS3_MAXPATHLEN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 		resp->status = nfserr_nametoolong;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 						page_address(rqstp->rq_arg.pages[0]),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 						argp->tlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	if (IS_ERR(argp->tname)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		resp->status = nfserrno(PTR_ERR(argp->tname));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	dprintk("nfsd: SYMLINK(3)  %s %.*s -> %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 				SVCFH_fmt(&argp->ffh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 				argp->flen, argp->fname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 				argp->tlen, argp->tname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	fh_copy(&resp->dirfh, &argp->ffh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	fh_init(&resp->fh, NFS3_FHSIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 				    argp->flen, argp->tname, &resp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	kfree(argp->tname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  * Make socket/fifo/device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) nfsd3_proc_mknod(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	struct nfsd3_mknodargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	struct nfsd3_diropres  *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	int type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	dev_t	rdev = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	dprintk("nfsd: MKNOD(3)    %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 				argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 				argp->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	fh_copy(&resp->dirfh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	fh_init(&resp->fh, NFS3_FHSIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 		rdev = MKDEV(argp->major, argp->minor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 		if (MAJOR(rdev) != argp->major ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 		    MINOR(rdev) != argp->minor) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 			resp->status = nfserr_inval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	} else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		resp->status = nfserr_badtype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	type = nfs3_ftypes[argp->ftype];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 				   &argp->attrs, type, rdev, &resp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	fh_unlock(&resp->dirfh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  * Remove file/fifo/socket etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) nfsd3_proc_remove(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	struct nfsd3_diropargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	struct nfsd3_attrstat *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	dprintk("nfsd: REMOVE(3)   %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 				argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 				argp->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	/* Unlink. -S_IFDIR means file must not be a directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 				   argp->name, argp->len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	fh_unlock(&resp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  * Remove a directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) nfsd3_proc_rmdir(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	struct nfsd3_diropargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	struct nfsd3_attrstat *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	dprintk("nfsd: RMDIR(3)    %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 				argp->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 				argp->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 				   argp->name, argp->len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	fh_unlock(&resp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) nfsd3_proc_rename(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	struct nfsd3_renameargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	struct nfsd3_renameres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	dprintk("nfsd: RENAME(3)   %s %.*s ->\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 				SVCFH_fmt(&argp->ffh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 				argp->flen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 				argp->fname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	dprintk("nfsd: -> %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 				SVCFH_fmt(&argp->tfh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 				argp->tlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 				argp->tname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	fh_copy(&resp->ffh, &argp->ffh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	fh_copy(&resp->tfh, &argp->tfh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 				   &resp->tfh, argp->tname, argp->tlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) nfsd3_proc_link(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	struct nfsd3_linkargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	struct nfsd3_linkres  *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	dprintk("nfsd: LINK(3)     %s ->\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 				SVCFH_fmt(&argp->ffh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	dprintk("nfsd:   -> %s %.*s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 				SVCFH_fmt(&argp->tfh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 				argp->tlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 				argp->tname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	fh_copy(&resp->fh,  &argp->ffh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	fh_copy(&resp->tfh, &argp->tfh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 				 &resp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)  * Read a portion of a directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) nfsd3_proc_readdir(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	struct nfsd3_readdirargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	struct nfsd3_readdirres  *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 	int		count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	struct page	**p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	caddr_t		page_addr = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	dprintk("nfsd: READDIR(3)  %s %d bytes at %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 				argp->count, (u32) argp->cookie);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	/* Make sure we've room for the NULL ptr & eof flag, and shrink to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	 * client read size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	count = (argp->count >> 2) - 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	/* Read directory and encode entries on the fly */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 	resp->buflen = count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	resp->common.err = nfs_ok;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 	resp->buffer = argp->buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	resp->rqstp = rqstp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	resp->status = nfsd_readdir(rqstp, &resp->fh, (loff_t *)&argp->cookie,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 				    &resp->common, nfs3svc_encode_entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 	memcpy(resp->verf, argp->verf, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 		page_addr = page_address(*p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 		if (((caddr_t)resp->buffer >= page_addr) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 		    ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 			count += (caddr_t)resp->buffer - page_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 		count += PAGE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	resp->count = count >> 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 	if (resp->offset) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 		loff_t offset = argp->cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 		if (unlikely(resp->offset1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 			/* we ended up with offset on a page boundary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 			*resp->offset = htonl(offset >> 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 			*resp->offset1 = htonl(offset & 0xffffffff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 			resp->offset1 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 			xdr_encode_hyper(resp->offset, offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 		resp->offset = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)  * Read a portion of a directory, including file handles and attrs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)  * For now, we choose to ignore the dircount parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	struct nfsd3_readdirargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 	struct nfsd3_readdirres  *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	int	count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 	loff_t	offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	struct page **p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 	caddr_t	page_addr = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 	dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 				argp->count, (u32) argp->cookie);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	/* Convert byte count to number of words (i.e. >> 2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	 * and reserve room for the NULL ptr & eof flag (-2 words) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	resp->count = (argp->count >> 2) - 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	/* Read directory and encode entries on the fly */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	resp->common.err = nfs_ok;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 	resp->buffer = argp->buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 	resp->buflen = resp->count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	resp->rqstp = rqstp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	offset = argp->cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 	resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	if (resp->status != nfs_ok)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 		resp->status = nfserr_notsupp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 	resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 				    &resp->common, nfs3svc_encode_entry_plus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 	memcpy(resp->verf, argp->verf, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 	for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 		page_addr = page_address(*p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 		if (((caddr_t)resp->buffer >= page_addr) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 		    ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 			count += (caddr_t)resp->buffer - page_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 		count += PAGE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 	resp->count = count >> 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 	if (resp->offset) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 		if (unlikely(resp->offset1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 			/* we ended up with offset on a page boundary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 			*resp->offset = htonl(offset >> 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 			*resp->offset1 = htonl(offset & 0xffffffff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 			resp->offset1 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 			xdr_encode_hyper(resp->offset, offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 		resp->offset = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)  * Get file system stats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) nfsd3_proc_fsstat(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	struct nfsd_fhandle *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 	struct nfsd3_fsstatres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	dprintk("nfsd: FSSTAT(3)   %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 				SVCFH_fmt(&argp->fh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 	resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	fh_put(&argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)  * Get file system info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	struct nfsd_fhandle *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 	struct nfsd3_fsinfores *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 	u32	max_blocksize = svc_max_payload(rqstp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	dprintk("nfsd: FSINFO(3)   %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 				SVCFH_fmt(&argp->fh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 	resp->f_rtmax  = max_blocksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	resp->f_rtpref = max_blocksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 	resp->f_rtmult = PAGE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 	resp->f_wtmax  = max_blocksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	resp->f_wtpref = max_blocksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	resp->f_wtmult = PAGE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	resp->f_dtpref = max_blocksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	resp->f_maxfilesize = ~(u32) 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	resp->f_properties = NFS3_FSF_DEFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	resp->status = fh_verify(rqstp, &argp->fh, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 				 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 	/* Check special features of the file system. May request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 	 * different read/write sizes for file systems known to have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 	 * problems with large blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 	if (resp->status == nfs_ok) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 		struct super_block *sb = argp->fh.fh_dentry->d_sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 		/* Note that we don't care for remote fs's here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 		if (sb->s_magic == MSDOS_SUPER_MAGIC) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 			resp->f_properties = NFS3_FSF_BILLYBOY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 		resp->f_maxfilesize = sb->s_maxbytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 	fh_put(&argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)  * Get pathconf info for the specified file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) nfsd3_proc_pathconf(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 	struct nfsd_fhandle *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 	struct nfsd3_pathconfres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 	dprintk("nfsd: PATHCONF(3) %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 				SVCFH_fmt(&argp->fh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 	/* Set default pathconf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 	resp->p_link_max = 255;		/* at least */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 	resp->p_name_max = 255;		/* at least */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 	resp->p_no_trunc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 	resp->p_chown_restricted = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 	resp->p_case_insensitive = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 	resp->p_case_preserving = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 	resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 	if (resp->status == nfs_ok) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 		struct super_block *sb = argp->fh.fh_dentry->d_sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 		/* Note that we don't care for remote fs's here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 		switch (sb->s_magic) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 		case EXT2_SUPER_MAGIC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 			resp->p_link_max = EXT2_LINK_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 			resp->p_name_max = EXT2_NAME_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 		case MSDOS_SUPER_MAGIC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 			resp->p_case_insensitive = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 			resp->p_case_preserving  = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	fh_put(&argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)  * Commit a file (range) to stable storage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) static __be32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) nfsd3_proc_commit(struct svc_rqst *rqstp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 	struct nfsd3_commitargs *argp = rqstp->rq_argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	struct nfsd3_commitres *resp = rqstp->rq_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 	dprintk("nfsd: COMMIT(3)   %s %u@%Lu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 				SVCFH_fmt(&argp->fh),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 				argp->count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 				(unsigned long long) argp->offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 	if (argp->offset > NFS_OFFSET_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 		resp->status = nfserr_inval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 	fh_copy(&resp->fh, &argp->fh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 	resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) 				   argp->count, resp->verf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) 	return rpc_success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688)  * NFSv3 Server procedures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)  * Only the results of non-idempotent operations are cached.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) #define nfs3svc_decode_fhandleargs	nfs3svc_decode_fhandle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) #define nfs3svc_encode_attrstatres	nfs3svc_encode_attrstat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) #define nfs3svc_encode_wccstatres	nfs3svc_encode_wccstat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) #define nfsd3_mkdirargs			nfsd3_createargs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) #define nfsd3_readdirplusargs		nfsd3_readdirargs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) #define nfsd3_fhandleargs		nfsd_fhandle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) #define nfsd3_fhandleres		nfsd3_attrstat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) #define nfsd3_attrstatres		nfsd3_attrstat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) #define nfsd3_wccstatres		nfsd3_attrstat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) #define nfsd3_createres			nfsd3_diropres
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) #define nfsd3_voidres			nfsd3_voidargs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) struct nfsd3_voidargs { int dummy; };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) #define ST 1		/* status*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) #define FH 17		/* filehandle with length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) #define AT 21		/* attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) #define pAT (1+AT)	/* post attributes - conditional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) #define WC (7+pAT)	/* WCC attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) static const struct svc_procedure nfsd_procedures3[22] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) 	[NFS3PROC_NULL] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 		.pc_func = nfsd3_proc_null,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 		.pc_decode = nfs3svc_decode_voidarg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 		.pc_encode = nfs3svc_encode_voidres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) 		.pc_argsize = sizeof(struct nfsd3_voidargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 		.pc_ressize = sizeof(struct nfsd3_voidres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) 		.pc_xdrressize = ST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) 	[NFS3PROC_GETATTR] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) 		.pc_func = nfsd3_proc_getattr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) 		.pc_decode = nfs3svc_decode_fhandleargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 		.pc_encode = nfs3svc_encode_attrstatres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 		.pc_argsize = sizeof(struct nfsd3_fhandleargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) 		.pc_ressize = sizeof(struct nfsd3_attrstatres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) 		.pc_xdrressize = ST+AT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) 	[NFS3PROC_SETATTR] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) 		.pc_func = nfsd3_proc_setattr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) 		.pc_decode = nfs3svc_decode_sattrargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) 		.pc_encode = nfs3svc_encode_wccstatres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 		.pc_argsize = sizeof(struct nfsd3_sattrargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) 		.pc_ressize = sizeof(struct nfsd3_wccstatres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) 		.pc_xdrressize = ST+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) 	[NFS3PROC_LOOKUP] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) 		.pc_func = nfsd3_proc_lookup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) 		.pc_decode = nfs3svc_decode_diropargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) 		.pc_encode = nfs3svc_encode_diropres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) 		.pc_release = nfs3svc_release_fhandle2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) 		.pc_argsize = sizeof(struct nfsd3_diropargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) 		.pc_ressize = sizeof(struct nfsd3_diropres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) 		.pc_xdrressize = ST+FH+pAT+pAT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) 	[NFS3PROC_ACCESS] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) 		.pc_func = nfsd3_proc_access,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) 		.pc_decode = nfs3svc_decode_accessargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) 		.pc_encode = nfs3svc_encode_accessres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) 		.pc_argsize = sizeof(struct nfsd3_accessargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) 		.pc_ressize = sizeof(struct nfsd3_accessres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) 		.pc_xdrressize = ST+pAT+1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) 	[NFS3PROC_READLINK] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) 		.pc_func = nfsd3_proc_readlink,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) 		.pc_decode = nfs3svc_decode_readlinkargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) 		.pc_encode = nfs3svc_encode_readlinkres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) 		.pc_argsize = sizeof(struct nfsd3_readlinkargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) 		.pc_ressize = sizeof(struct nfsd3_readlinkres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) 		.pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) 	[NFS3PROC_READ] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) 		.pc_func = nfsd3_proc_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) 		.pc_decode = nfs3svc_decode_readargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) 		.pc_encode = nfs3svc_encode_readres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) 		.pc_argsize = sizeof(struct nfsd3_readargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) 		.pc_ressize = sizeof(struct nfsd3_readres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) 		.pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) 	[NFS3PROC_WRITE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) 		.pc_func = nfsd3_proc_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) 		.pc_decode = nfs3svc_decode_writeargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) 		.pc_encode = nfs3svc_encode_writeres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) 		.pc_argsize = sizeof(struct nfsd3_writeargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) 		.pc_ressize = sizeof(struct nfsd3_writeres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) 		.pc_xdrressize = ST+WC+4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) 	[NFS3PROC_CREATE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) 		.pc_func = nfsd3_proc_create,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) 		.pc_decode = nfs3svc_decode_createargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) 		.pc_encode = nfs3svc_encode_createres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) 		.pc_release = nfs3svc_release_fhandle2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) 		.pc_argsize = sizeof(struct nfsd3_createargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) 		.pc_ressize = sizeof(struct nfsd3_createres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) 		.pc_xdrressize = ST+(1+FH+pAT)+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) 	[NFS3PROC_MKDIR] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) 		.pc_func = nfsd3_proc_mkdir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) 		.pc_decode = nfs3svc_decode_mkdirargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) 		.pc_encode = nfs3svc_encode_createres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) 		.pc_release = nfs3svc_release_fhandle2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) 		.pc_argsize = sizeof(struct nfsd3_mkdirargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) 		.pc_ressize = sizeof(struct nfsd3_createres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) 		.pc_xdrressize = ST+(1+FH+pAT)+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) 	[NFS3PROC_SYMLINK] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) 		.pc_func = nfsd3_proc_symlink,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) 		.pc_decode = nfs3svc_decode_symlinkargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) 		.pc_encode = nfs3svc_encode_createres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) 		.pc_release = nfs3svc_release_fhandle2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) 		.pc_argsize = sizeof(struct nfsd3_symlinkargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) 		.pc_ressize = sizeof(struct nfsd3_createres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) 		.pc_xdrressize = ST+(1+FH+pAT)+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) 	[NFS3PROC_MKNOD] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) 		.pc_func = nfsd3_proc_mknod,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) 		.pc_decode = nfs3svc_decode_mknodargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) 		.pc_encode = nfs3svc_encode_createres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) 		.pc_release = nfs3svc_release_fhandle2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) 		.pc_argsize = sizeof(struct nfsd3_mknodargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) 		.pc_ressize = sizeof(struct nfsd3_createres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) 		.pc_xdrressize = ST+(1+FH+pAT)+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) 	[NFS3PROC_REMOVE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) 		.pc_func = nfsd3_proc_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) 		.pc_decode = nfs3svc_decode_diropargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) 		.pc_encode = nfs3svc_encode_wccstatres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) 		.pc_argsize = sizeof(struct nfsd3_diropargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) 		.pc_ressize = sizeof(struct nfsd3_wccstatres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) 		.pc_xdrressize = ST+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) 	[NFS3PROC_RMDIR] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) 		.pc_func = nfsd3_proc_rmdir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) 		.pc_decode = nfs3svc_decode_diropargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) 		.pc_encode = nfs3svc_encode_wccstatres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) 		.pc_argsize = sizeof(struct nfsd3_diropargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) 		.pc_ressize = sizeof(struct nfsd3_wccstatres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) 		.pc_xdrressize = ST+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) 	[NFS3PROC_RENAME] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) 		.pc_func = nfsd3_proc_rename,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) 		.pc_decode = nfs3svc_decode_renameargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) 		.pc_encode = nfs3svc_encode_renameres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) 		.pc_release = nfs3svc_release_fhandle2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) 		.pc_argsize = sizeof(struct nfsd3_renameargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) 		.pc_ressize = sizeof(struct nfsd3_renameres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) 		.pc_xdrressize = ST+WC+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) 	[NFS3PROC_LINK] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) 		.pc_func = nfsd3_proc_link,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) 		.pc_decode = nfs3svc_decode_linkargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) 		.pc_encode = nfs3svc_encode_linkres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) 		.pc_release = nfs3svc_release_fhandle2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) 		.pc_argsize = sizeof(struct nfsd3_linkargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) 		.pc_ressize = sizeof(struct nfsd3_linkres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) 		.pc_cachetype = RC_REPLBUFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) 		.pc_xdrressize = ST+pAT+WC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) 	[NFS3PROC_READDIR] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) 		.pc_func = nfsd3_proc_readdir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) 		.pc_decode = nfs3svc_decode_readdirargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) 		.pc_encode = nfs3svc_encode_readdirres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) 		.pc_argsize = sizeof(struct nfsd3_readdirargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) 		.pc_ressize = sizeof(struct nfsd3_readdirres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) 	[NFS3PROC_READDIRPLUS] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) 		.pc_func = nfsd3_proc_readdirplus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) 		.pc_decode = nfs3svc_decode_readdirplusargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) 		.pc_encode = nfs3svc_encode_readdirres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) 		.pc_argsize = sizeof(struct nfsd3_readdirplusargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) 		.pc_ressize = sizeof(struct nfsd3_readdirres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) 	[NFS3PROC_FSSTAT] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) 		.pc_func = nfsd3_proc_fsstat,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) 		.pc_decode = nfs3svc_decode_fhandleargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) 		.pc_encode = nfs3svc_encode_fsstatres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) 		.pc_argsize = sizeof(struct nfsd3_fhandleargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) 		.pc_ressize = sizeof(struct nfsd3_fsstatres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) 		.pc_xdrressize = ST+pAT+2*6+1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) 	[NFS3PROC_FSINFO] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) 		.pc_func = nfsd3_proc_fsinfo,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) 		.pc_decode = nfs3svc_decode_fhandleargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) 		.pc_encode = nfs3svc_encode_fsinfores,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) 		.pc_argsize = sizeof(struct nfsd3_fhandleargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) 		.pc_ressize = sizeof(struct nfsd3_fsinfores),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) 		.pc_xdrressize = ST+pAT+12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) 	[NFS3PROC_PATHCONF] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) 		.pc_func = nfsd3_proc_pathconf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) 		.pc_decode = nfs3svc_decode_fhandleargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) 		.pc_encode = nfs3svc_encode_pathconfres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) 		.pc_argsize = sizeof(struct nfsd3_fhandleargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) 		.pc_ressize = sizeof(struct nfsd3_pathconfres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) 		.pc_xdrressize = ST+pAT+6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) 	[NFS3PROC_COMMIT] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) 		.pc_func = nfsd3_proc_commit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917) 		.pc_decode = nfs3svc_decode_commitargs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) 		.pc_encode = nfs3svc_encode_commitres,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) 		.pc_release = nfs3svc_release_fhandle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) 		.pc_argsize = sizeof(struct nfsd3_commitargs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) 		.pc_ressize = sizeof(struct nfsd3_commitres),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) 		.pc_cachetype = RC_NOCACHE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) 		.pc_xdrressize = ST+WC+2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) const struct svc_version nfsd_version3 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) 	.vs_vers	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) 	.vs_nproc	= 22,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) 	.vs_proc	= nfsd_procedures3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) 	.vs_dispatch	= nfsd_dispatch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) 	.vs_count	= nfsd_count3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) 	.vs_xdrsize	= NFS3_SVC_XDRSIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) };