1 // SPDX-License-Identifier: GPL-2.0
3 * Process version 3 NFS requests.
9 #include <linux/ext2_fs.h>
10 #include <linux/magic.h>
16 #define NFSDDBG_FACILITY NFSDDBG_PROC
18 static int nfs3_ftypes[] = {
25 S_IFSOCK, /* NF3SOCK */
26 S_IFIFO, /* NF3FIFO */
33 nfsd3_proc_null(struct svc_rqst *rqstp)
39 * Get a file's attributes
42 nfsd3_proc_getattr(struct svc_rqst *rqstp)
44 struct nfsd_fhandle *argp = rqstp->rq_argp;
45 struct nfsd3_attrstat *resp = rqstp->rq_resp;
47 dprintk("nfsd: GETATTR(3) %s\n",
48 SVCFH_fmt(&argp->fh));
50 fh_copy(&resp->fh, &argp->fh);
51 resp->status = fh_verify(rqstp, &resp->fh, 0,
52 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
53 if (resp->status != nfs_ok)
56 resp->status = fh_getattr(&resp->fh, &resp->stat);
62 * Set a file's attributes
65 nfsd3_proc_setattr(struct svc_rqst *rqstp)
67 struct nfsd3_sattrargs *argp = rqstp->rq_argp;
68 struct nfsd3_attrstat *resp = rqstp->rq_resp;
70 dprintk("nfsd: SETATTR(3) %s\n",
71 SVCFH_fmt(&argp->fh));
73 fh_copy(&resp->fh, &argp->fh);
74 resp->status = nfsd_setattr(rqstp, &resp->fh, &argp->attrs,
75 argp->check_guard, argp->guardtime);
80 * Look up a path name component
83 nfsd3_proc_lookup(struct svc_rqst *rqstp)
85 struct nfsd3_diropargs *argp = rqstp->rq_argp;
86 struct nfsd3_diropres *resp = rqstp->rq_resp;
88 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
93 fh_copy(&resp->dirfh, &argp->fh);
94 fh_init(&resp->fh, NFS3_FHSIZE);
96 resp->status = nfsd_lookup(rqstp, &resp->dirfh,
97 argp->name, argp->len,
106 nfsd3_proc_access(struct svc_rqst *rqstp)
108 struct nfsd3_accessargs *argp = rqstp->rq_argp;
109 struct nfsd3_accessres *resp = rqstp->rq_resp;
111 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
112 SVCFH_fmt(&argp->fh),
115 fh_copy(&resp->fh, &argp->fh);
116 resp->access = argp->access;
117 resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
125 nfsd3_proc_readlink(struct svc_rqst *rqstp)
127 struct nfsd_fhandle *argp = rqstp->rq_argp;
128 struct nfsd3_readlinkres *resp = rqstp->rq_resp;
130 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
132 /* Read the symlink. */
133 fh_copy(&resp->fh, &argp->fh);
134 resp->len = NFS3_MAXPATHLEN;
135 resp->pages = rqstp->rq_next_page++;
136 resp->status = nfsd_readlink(rqstp, &resp->fh,
137 page_address(*resp->pages), &resp->len);
142 * Read a portion of a file.
145 nfsd3_proc_read(struct svc_rqst *rqstp)
147 struct nfsd3_readargs *argp = rqstp->rq_argp;
148 struct nfsd3_readres *resp = rqstp->rq_resp;
149 u32 max_blocksize = svc_max_payload(rqstp);
153 argp->count = min_t(u32, argp->count, max_blocksize);
155 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
156 SVCFH_fmt(&argp->fh),
157 (unsigned long) argp->count,
158 (unsigned long long) argp->offset);
162 resp->pages = rqstp->rq_next_page;
164 struct page *page = *(rqstp->rq_next_page++);
166 rqstp->rq_vec[v].iov_base = page_address(page);
167 rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE);
168 len -= rqstp->rq_vec[v].iov_len;
172 /* Obtain buffer pointer for payload.
173 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
174 * + 1 (xdr opaque byte count) = 26
176 resp->count = argp->count;
177 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
179 fh_copy(&resp->fh, &argp->fh);
180 resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
181 rqstp->rq_vec, v, &resp->count, &resp->eof);
186 * Write data to a file
189 nfsd3_proc_write(struct svc_rqst *rqstp)
191 struct nfsd3_writeargs *argp = rqstp->rq_argp;
192 struct nfsd3_writeres *resp = rqstp->rq_resp;
193 unsigned long cnt = argp->len;
196 dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
197 SVCFH_fmt(&argp->fh),
199 (unsigned long long) argp->offset,
200 argp->stable? " stable" : "");
202 fh_copy(&resp->fh, &argp->fh);
203 resp->committed = argp->stable;
204 nvecs = svc_fill_write_vector(rqstp, &argp->payload);
206 resp->status = nfserr_io;
209 resp->status = nfsd_write(rqstp, &resp->fh, argp->offset,
210 rqstp->rq_vec, nvecs, &cnt,
211 resp->committed, resp->verf);
218 * With NFSv3, CREATE processing is a lot easier than with NFSv2.
219 * At least in theory; we'll see how it fares in practice when the
220 * first reports about SunOS compatibility problems start to pour in...
223 nfsd3_proc_create(struct svc_rqst *rqstp)
225 struct nfsd3_createargs *argp = rqstp->rq_argp;
226 struct nfsd3_diropres *resp = rqstp->rq_resp;
227 svc_fh *dirfhp, *newfhp = NULL;
230 dprintk("nfsd: CREATE(3) %s %.*s\n",
231 SVCFH_fmt(&argp->fh),
235 dirfhp = fh_copy(&resp->dirfh, &argp->fh);
236 newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
239 /* Unfudge the mode bits */
240 attr->ia_mode &= ~S_IFMT;
241 if (!(attr->ia_valid & ATTR_MODE)) {
242 attr->ia_valid |= ATTR_MODE;
243 attr->ia_mode = S_IFREG;
245 attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG;
248 /* Now create the file and set attributes */
249 resp->status = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len,
250 attr, newfhp, argp->createmode,
251 (u32 *)argp->verf, NULL, NULL);
256 * Make directory. This operation is not idempotent.
259 nfsd3_proc_mkdir(struct svc_rqst *rqstp)
261 struct nfsd3_createargs *argp = rqstp->rq_argp;
262 struct nfsd3_diropres *resp = rqstp->rq_resp;
264 dprintk("nfsd: MKDIR(3) %s %.*s\n",
265 SVCFH_fmt(&argp->fh),
269 argp->attrs.ia_valid &= ~ATTR_SIZE;
270 fh_copy(&resp->dirfh, &argp->fh);
271 fh_init(&resp->fh, NFS3_FHSIZE);
272 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
273 &argp->attrs, S_IFDIR, 0, &resp->fh);
274 fh_unlock(&resp->dirfh);
279 nfsd3_proc_symlink(struct svc_rqst *rqstp)
281 struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
282 struct nfsd3_diropres *resp = rqstp->rq_resp;
284 if (argp->tlen == 0) {
285 resp->status = nfserr_inval;
288 if (argp->tlen > NFS3_MAXPATHLEN) {
289 resp->status = nfserr_nametoolong;
293 argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
294 page_address(rqstp->rq_arg.pages[0]),
296 if (IS_ERR(argp->tname)) {
297 resp->status = nfserrno(PTR_ERR(argp->tname));
301 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
302 SVCFH_fmt(&argp->ffh),
303 argp->flen, argp->fname,
304 argp->tlen, argp->tname);
306 fh_copy(&resp->dirfh, &argp->ffh);
307 fh_init(&resp->fh, NFS3_FHSIZE);
308 resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
309 argp->flen, argp->tname, &resp->fh);
316 * Make socket/fifo/device.
319 nfsd3_proc_mknod(struct svc_rqst *rqstp)
321 struct nfsd3_mknodargs *argp = rqstp->rq_argp;
322 struct nfsd3_diropres *resp = rqstp->rq_resp;
326 dprintk("nfsd: MKNOD(3) %s %.*s\n",
327 SVCFH_fmt(&argp->fh),
331 fh_copy(&resp->dirfh, &argp->fh);
332 fh_init(&resp->fh, NFS3_FHSIZE);
334 if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
335 rdev = MKDEV(argp->major, argp->minor);
336 if (MAJOR(rdev) != argp->major ||
337 MINOR(rdev) != argp->minor) {
338 resp->status = nfserr_inval;
341 } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
342 resp->status = nfserr_badtype;
346 type = nfs3_ftypes[argp->ftype];
347 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
348 &argp->attrs, type, rdev, &resp->fh);
349 fh_unlock(&resp->dirfh);
355 * Remove file/fifo/socket etc.
358 nfsd3_proc_remove(struct svc_rqst *rqstp)
360 struct nfsd3_diropargs *argp = rqstp->rq_argp;
361 struct nfsd3_attrstat *resp = rqstp->rq_resp;
363 dprintk("nfsd: REMOVE(3) %s %.*s\n",
364 SVCFH_fmt(&argp->fh),
368 /* Unlink. -S_IFDIR means file must not be a directory */
369 fh_copy(&resp->fh, &argp->fh);
370 resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
371 argp->name, argp->len);
372 fh_unlock(&resp->fh);
380 nfsd3_proc_rmdir(struct svc_rqst *rqstp)
382 struct nfsd3_diropargs *argp = rqstp->rq_argp;
383 struct nfsd3_attrstat *resp = rqstp->rq_resp;
385 dprintk("nfsd: RMDIR(3) %s %.*s\n",
386 SVCFH_fmt(&argp->fh),
390 fh_copy(&resp->fh, &argp->fh);
391 resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
392 argp->name, argp->len);
393 fh_unlock(&resp->fh);
398 nfsd3_proc_rename(struct svc_rqst *rqstp)
400 struct nfsd3_renameargs *argp = rqstp->rq_argp;
401 struct nfsd3_renameres *resp = rqstp->rq_resp;
403 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
404 SVCFH_fmt(&argp->ffh),
407 dprintk("nfsd: -> %s %.*s\n",
408 SVCFH_fmt(&argp->tfh),
412 fh_copy(&resp->ffh, &argp->ffh);
413 fh_copy(&resp->tfh, &argp->tfh);
414 resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
415 &resp->tfh, argp->tname, argp->tlen);
420 nfsd3_proc_link(struct svc_rqst *rqstp)
422 struct nfsd3_linkargs *argp = rqstp->rq_argp;
423 struct nfsd3_linkres *resp = rqstp->rq_resp;
425 dprintk("nfsd: LINK(3) %s ->\n",
426 SVCFH_fmt(&argp->ffh));
427 dprintk("nfsd: -> %s %.*s\n",
428 SVCFH_fmt(&argp->tfh),
432 fh_copy(&resp->fh, &argp->ffh);
433 fh_copy(&resp->tfh, &argp->tfh);
434 resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
439 static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
440 struct nfsd3_readdirres *resp,
443 struct xdr_buf *buf = &resp->dirlist;
444 struct xdr_stream *xdr = &resp->xdr;
446 count = min_t(u32, count, svc_max_payload(rqstp));
448 memset(buf, 0, sizeof(*buf));
450 /* Reserve room for the NULL ptr & eof flag (-2 words) */
451 buf->buflen = count - XDR_UNIT * 2;
452 buf->pages = rqstp->rq_next_page;
454 rqstp->rq_next_page++;
458 /* This is xdr_init_encode(), but it assumes that
459 * the head kvec has already been consumed. */
460 xdr_set_scratch_buffer(xdr, NULL, 0);
462 xdr->page_ptr = buf->pages;
464 xdr->p = page_address(*buf->pages);
465 xdr->end = xdr->p + (PAGE_SIZE >> 2);
470 * Read a portion of a directory.
473 nfsd3_proc_readdir(struct svc_rqst *rqstp)
475 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
476 struct nfsd3_readdirres *resp = rqstp->rq_resp;
479 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
480 SVCFH_fmt(&argp->fh),
481 argp->count, (u32) argp->cookie);
483 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
485 fh_copy(&resp->fh, &argp->fh);
486 resp->common.err = nfs_ok;
487 resp->cookie_offset = 0;
489 offset = argp->cookie;
490 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
491 &resp->common, nfs3svc_encode_entry3);
492 memcpy(resp->verf, argp->verf, 8);
493 nfs3svc_encode_cookie3(resp, offset);
495 /* Recycle only pages that were part of the reply */
496 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
502 * Read a portion of a directory, including file handles and attrs.
503 * For now, we choose to ignore the dircount parameter.
506 nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
508 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
509 struct nfsd3_readdirres *resp = rqstp->rq_resp;
512 dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
513 SVCFH_fmt(&argp->fh),
514 argp->count, (u32) argp->cookie);
516 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
518 fh_copy(&resp->fh, &argp->fh);
519 resp->common.err = nfs_ok;
520 resp->cookie_offset = 0;
522 offset = argp->cookie;
524 resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
525 if (resp->status != nfs_ok)
528 if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) {
529 resp->status = nfserr_notsupp;
533 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
534 &resp->common, nfs3svc_encode_entryplus3);
535 memcpy(resp->verf, argp->verf, 8);
536 nfs3svc_encode_cookie3(resp, offset);
538 /* Recycle only pages that were part of the reply */
539 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
546 * Get file system stats
549 nfsd3_proc_fsstat(struct svc_rqst *rqstp)
551 struct nfsd_fhandle *argp = rqstp->rq_argp;
552 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
554 dprintk("nfsd: FSSTAT(3) %s\n",
555 SVCFH_fmt(&argp->fh));
557 resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
563 * Get file system info
566 nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
568 struct nfsd_fhandle *argp = rqstp->rq_argp;
569 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
570 u32 max_blocksize = svc_max_payload(rqstp);
572 dprintk("nfsd: FSINFO(3) %s\n",
573 SVCFH_fmt(&argp->fh));
575 resp->f_rtmax = max_blocksize;
576 resp->f_rtpref = max_blocksize;
577 resp->f_rtmult = PAGE_SIZE;
578 resp->f_wtmax = max_blocksize;
579 resp->f_wtpref = max_blocksize;
580 resp->f_wtmult = PAGE_SIZE;
581 resp->f_dtpref = max_blocksize;
582 resp->f_maxfilesize = ~(u32) 0;
583 resp->f_properties = NFS3_FSF_DEFAULT;
585 resp->status = fh_verify(rqstp, &argp->fh, 0,
586 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
588 /* Check special features of the file system. May request
589 * different read/write sizes for file systems known to have
590 * problems with large blocks */
591 if (resp->status == nfs_ok) {
592 struct super_block *sb = argp->fh.fh_dentry->d_sb;
594 /* Note that we don't care for remote fs's here */
595 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
596 resp->f_properties = NFS3_FSF_BILLYBOY;
598 resp->f_maxfilesize = sb->s_maxbytes;
606 * Get pathconf info for the specified file
609 nfsd3_proc_pathconf(struct svc_rqst *rqstp)
611 struct nfsd_fhandle *argp = rqstp->rq_argp;
612 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
614 dprintk("nfsd: PATHCONF(3) %s\n",
615 SVCFH_fmt(&argp->fh));
617 /* Set default pathconf */
618 resp->p_link_max = 255; /* at least */
619 resp->p_name_max = 255; /* at least */
620 resp->p_no_trunc = 0;
621 resp->p_chown_restricted = 1;
622 resp->p_case_insensitive = 0;
623 resp->p_case_preserving = 1;
625 resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
627 if (resp->status == nfs_ok) {
628 struct super_block *sb = argp->fh.fh_dentry->d_sb;
630 /* Note that we don't care for remote fs's here */
631 switch (sb->s_magic) {
632 case EXT2_SUPER_MAGIC:
633 resp->p_link_max = EXT2_LINK_MAX;
634 resp->p_name_max = EXT2_NAME_LEN;
636 case MSDOS_SUPER_MAGIC:
637 resp->p_case_insensitive = 1;
638 resp->p_case_preserving = 0;
648 * Commit a file (range) to stable storage.
651 nfsd3_proc_commit(struct svc_rqst *rqstp)
653 struct nfsd3_commitargs *argp = rqstp->rq_argp;
654 struct nfsd3_commitres *resp = rqstp->rq_resp;
656 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
657 SVCFH_fmt(&argp->fh),
659 (unsigned long long) argp->offset);
661 if (argp->offset > NFS_OFFSET_MAX) {
662 resp->status = nfserr_inval;
666 fh_copy(&resp->fh, &argp->fh);
667 resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset,
668 argp->count, resp->verf);
675 * NFSv3 Server procedures.
676 * Only the results of non-idempotent operations are cached.
678 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
679 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
680 #define nfsd3_mkdirargs nfsd3_createargs
681 #define nfsd3_readdirplusargs nfsd3_readdirargs
682 #define nfsd3_fhandleargs nfsd_fhandle
683 #define nfsd3_attrstatres nfsd3_attrstat
684 #define nfsd3_wccstatres nfsd3_attrstat
685 #define nfsd3_createres nfsd3_diropres
687 #define ST 1 /* status*/
688 #define FH 17 /* filehandle with length */
689 #define AT 21 /* attributes */
690 #define pAT (1+AT) /* post attributes - conditional */
691 #define WC (7+pAT) /* WCC attributes */
693 static const struct svc_procedure nfsd_procedures3[22] = {
695 .pc_func = nfsd3_proc_null,
696 .pc_decode = nfssvc_decode_voidarg,
697 .pc_encode = nfssvc_encode_voidres,
698 .pc_argsize = sizeof(struct nfsd_voidargs),
699 .pc_ressize = sizeof(struct nfsd_voidres),
700 .pc_cachetype = RC_NOCACHE,
704 [NFS3PROC_GETATTR] = {
705 .pc_func = nfsd3_proc_getattr,
706 .pc_decode = nfs3svc_decode_fhandleargs,
707 .pc_encode = nfs3svc_encode_getattrres,
708 .pc_release = nfs3svc_release_fhandle,
709 .pc_argsize = sizeof(struct nfsd_fhandle),
710 .pc_ressize = sizeof(struct nfsd3_attrstatres),
711 .pc_cachetype = RC_NOCACHE,
712 .pc_xdrressize = ST+AT,
713 .pc_name = "GETATTR",
715 [NFS3PROC_SETATTR] = {
716 .pc_func = nfsd3_proc_setattr,
717 .pc_decode = nfs3svc_decode_sattrargs,
718 .pc_encode = nfs3svc_encode_wccstatres,
719 .pc_release = nfs3svc_release_fhandle,
720 .pc_argsize = sizeof(struct nfsd3_sattrargs),
721 .pc_ressize = sizeof(struct nfsd3_wccstatres),
722 .pc_cachetype = RC_REPLBUFF,
723 .pc_xdrressize = ST+WC,
724 .pc_name = "SETATTR",
726 [NFS3PROC_LOOKUP] = {
727 .pc_func = nfsd3_proc_lookup,
728 .pc_decode = nfs3svc_decode_diropargs,
729 .pc_encode = nfs3svc_encode_lookupres,
730 .pc_release = nfs3svc_release_fhandle2,
731 .pc_argsize = sizeof(struct nfsd3_diropargs),
732 .pc_ressize = sizeof(struct nfsd3_diropres),
733 .pc_cachetype = RC_NOCACHE,
734 .pc_xdrressize = ST+FH+pAT+pAT,
737 [NFS3PROC_ACCESS] = {
738 .pc_func = nfsd3_proc_access,
739 .pc_decode = nfs3svc_decode_accessargs,
740 .pc_encode = nfs3svc_encode_accessres,
741 .pc_release = nfs3svc_release_fhandle,
742 .pc_argsize = sizeof(struct nfsd3_accessargs),
743 .pc_ressize = sizeof(struct nfsd3_accessres),
744 .pc_cachetype = RC_NOCACHE,
745 .pc_xdrressize = ST+pAT+1,
748 [NFS3PROC_READLINK] = {
749 .pc_func = nfsd3_proc_readlink,
750 .pc_decode = nfs3svc_decode_fhandleargs,
751 .pc_encode = nfs3svc_encode_readlinkres,
752 .pc_release = nfs3svc_release_fhandle,
753 .pc_argsize = sizeof(struct nfsd_fhandle),
754 .pc_ressize = sizeof(struct nfsd3_readlinkres),
755 .pc_cachetype = RC_NOCACHE,
756 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
757 .pc_name = "READLINK",
760 .pc_func = nfsd3_proc_read,
761 .pc_decode = nfs3svc_decode_readargs,
762 .pc_encode = nfs3svc_encode_readres,
763 .pc_release = nfs3svc_release_fhandle,
764 .pc_argsize = sizeof(struct nfsd3_readargs),
765 .pc_ressize = sizeof(struct nfsd3_readres),
766 .pc_cachetype = RC_NOCACHE,
767 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
771 .pc_func = nfsd3_proc_write,
772 .pc_decode = nfs3svc_decode_writeargs,
773 .pc_encode = nfs3svc_encode_writeres,
774 .pc_release = nfs3svc_release_fhandle,
775 .pc_argsize = sizeof(struct nfsd3_writeargs),
776 .pc_ressize = sizeof(struct nfsd3_writeres),
777 .pc_cachetype = RC_REPLBUFF,
778 .pc_xdrressize = ST+WC+4,
781 [NFS3PROC_CREATE] = {
782 .pc_func = nfsd3_proc_create,
783 .pc_decode = nfs3svc_decode_createargs,
784 .pc_encode = nfs3svc_encode_createres,
785 .pc_release = nfs3svc_release_fhandle2,
786 .pc_argsize = sizeof(struct nfsd3_createargs),
787 .pc_ressize = sizeof(struct nfsd3_createres),
788 .pc_cachetype = RC_REPLBUFF,
789 .pc_xdrressize = ST+(1+FH+pAT)+WC,
793 .pc_func = nfsd3_proc_mkdir,
794 .pc_decode = nfs3svc_decode_mkdirargs,
795 .pc_encode = nfs3svc_encode_createres,
796 .pc_release = nfs3svc_release_fhandle2,
797 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
798 .pc_ressize = sizeof(struct nfsd3_createres),
799 .pc_cachetype = RC_REPLBUFF,
800 .pc_xdrressize = ST+(1+FH+pAT)+WC,
803 [NFS3PROC_SYMLINK] = {
804 .pc_func = nfsd3_proc_symlink,
805 .pc_decode = nfs3svc_decode_symlinkargs,
806 .pc_encode = nfs3svc_encode_createres,
807 .pc_release = nfs3svc_release_fhandle2,
808 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
809 .pc_ressize = sizeof(struct nfsd3_createres),
810 .pc_cachetype = RC_REPLBUFF,
811 .pc_xdrressize = ST+(1+FH+pAT)+WC,
812 .pc_name = "SYMLINK",
815 .pc_func = nfsd3_proc_mknod,
816 .pc_decode = nfs3svc_decode_mknodargs,
817 .pc_encode = nfs3svc_encode_createres,
818 .pc_release = nfs3svc_release_fhandle2,
819 .pc_argsize = sizeof(struct nfsd3_mknodargs),
820 .pc_ressize = sizeof(struct nfsd3_createres),
821 .pc_cachetype = RC_REPLBUFF,
822 .pc_xdrressize = ST+(1+FH+pAT)+WC,
825 [NFS3PROC_REMOVE] = {
826 .pc_func = nfsd3_proc_remove,
827 .pc_decode = nfs3svc_decode_diropargs,
828 .pc_encode = nfs3svc_encode_wccstatres,
829 .pc_release = nfs3svc_release_fhandle,
830 .pc_argsize = sizeof(struct nfsd3_diropargs),
831 .pc_ressize = sizeof(struct nfsd3_wccstatres),
832 .pc_cachetype = RC_REPLBUFF,
833 .pc_xdrressize = ST+WC,
837 .pc_func = nfsd3_proc_rmdir,
838 .pc_decode = nfs3svc_decode_diropargs,
839 .pc_encode = nfs3svc_encode_wccstatres,
840 .pc_release = nfs3svc_release_fhandle,
841 .pc_argsize = sizeof(struct nfsd3_diropargs),
842 .pc_ressize = sizeof(struct nfsd3_wccstatres),
843 .pc_cachetype = RC_REPLBUFF,
844 .pc_xdrressize = ST+WC,
847 [NFS3PROC_RENAME] = {
848 .pc_func = nfsd3_proc_rename,
849 .pc_decode = nfs3svc_decode_renameargs,
850 .pc_encode = nfs3svc_encode_renameres,
851 .pc_release = nfs3svc_release_fhandle2,
852 .pc_argsize = sizeof(struct nfsd3_renameargs),
853 .pc_ressize = sizeof(struct nfsd3_renameres),
854 .pc_cachetype = RC_REPLBUFF,
855 .pc_xdrressize = ST+WC+WC,
859 .pc_func = nfsd3_proc_link,
860 .pc_decode = nfs3svc_decode_linkargs,
861 .pc_encode = nfs3svc_encode_linkres,
862 .pc_release = nfs3svc_release_fhandle2,
863 .pc_argsize = sizeof(struct nfsd3_linkargs),
864 .pc_ressize = sizeof(struct nfsd3_linkres),
865 .pc_cachetype = RC_REPLBUFF,
866 .pc_xdrressize = ST+pAT+WC,
869 [NFS3PROC_READDIR] = {
870 .pc_func = nfsd3_proc_readdir,
871 .pc_decode = nfs3svc_decode_readdirargs,
872 .pc_encode = nfs3svc_encode_readdirres,
873 .pc_release = nfs3svc_release_fhandle,
874 .pc_argsize = sizeof(struct nfsd3_readdirargs),
875 .pc_ressize = sizeof(struct nfsd3_readdirres),
876 .pc_cachetype = RC_NOCACHE,
877 .pc_name = "READDIR",
879 [NFS3PROC_READDIRPLUS] = {
880 .pc_func = nfsd3_proc_readdirplus,
881 .pc_decode = nfs3svc_decode_readdirplusargs,
882 .pc_encode = nfs3svc_encode_readdirres,
883 .pc_release = nfs3svc_release_fhandle,
884 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
885 .pc_ressize = sizeof(struct nfsd3_readdirres),
886 .pc_cachetype = RC_NOCACHE,
887 .pc_name = "READDIRPLUS",
889 [NFS3PROC_FSSTAT] = {
890 .pc_func = nfsd3_proc_fsstat,
891 .pc_decode = nfs3svc_decode_fhandleargs,
892 .pc_encode = nfs3svc_encode_fsstatres,
893 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
894 .pc_ressize = sizeof(struct nfsd3_fsstatres),
895 .pc_cachetype = RC_NOCACHE,
896 .pc_xdrressize = ST+pAT+2*6+1,
899 [NFS3PROC_FSINFO] = {
900 .pc_func = nfsd3_proc_fsinfo,
901 .pc_decode = nfs3svc_decode_fhandleargs,
902 .pc_encode = nfs3svc_encode_fsinfores,
903 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
904 .pc_ressize = sizeof(struct nfsd3_fsinfores),
905 .pc_cachetype = RC_NOCACHE,
906 .pc_xdrressize = ST+pAT+12,
909 [NFS3PROC_PATHCONF] = {
910 .pc_func = nfsd3_proc_pathconf,
911 .pc_decode = nfs3svc_decode_fhandleargs,
912 .pc_encode = nfs3svc_encode_pathconfres,
913 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
914 .pc_ressize = sizeof(struct nfsd3_pathconfres),
915 .pc_cachetype = RC_NOCACHE,
916 .pc_xdrressize = ST+pAT+6,
917 .pc_name = "PATHCONF",
919 [NFS3PROC_COMMIT] = {
920 .pc_func = nfsd3_proc_commit,
921 .pc_decode = nfs3svc_decode_commitargs,
922 .pc_encode = nfs3svc_encode_commitres,
923 .pc_release = nfs3svc_release_fhandle,
924 .pc_argsize = sizeof(struct nfsd3_commitargs),
925 .pc_ressize = sizeof(struct nfsd3_commitres),
926 .pc_cachetype = RC_NOCACHE,
927 .pc_xdrressize = ST+WC+2,
932 static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
933 const struct svc_version nfsd_version3 = {
936 .vs_proc = nfsd_procedures3,
937 .vs_dispatch = nfsd_dispatch,
938 .vs_count = nfsd_count3,
939 .vs_xdrsize = NFS3_SVC_XDRSIZE,