1 // SPDX-License-Identifier: GPL-2.0
3 * Process version 3 NFS requests.
5 * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de>
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;
152 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
153 SVCFH_fmt(&argp->fh),
154 (unsigned long) argp->count,
155 (unsigned long long) argp->offset);
157 argp->count = min_t(u32, argp->count, svc_max_payload(rqstp));
158 argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen);
159 if (argp->offset > (u64)OFFSET_MAX)
160 argp->offset = (u64)OFFSET_MAX;
161 if (argp->offset + argp->count > (u64)OFFSET_MAX)
162 argp->count = (u64)OFFSET_MAX - argp->offset;
166 resp->pages = rqstp->rq_next_page;
168 struct page *page = *(rqstp->rq_next_page++);
170 rqstp->rq_vec[v].iov_base = page_address(page);
171 rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE);
172 len -= rqstp->rq_vec[v].iov_len;
176 /* Obtain buffer pointer for payload.
177 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
178 * + 1 (xdr opaque byte count) = 26
180 resp->count = argp->count;
181 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
183 fh_copy(&resp->fh, &argp->fh);
184 resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
185 rqstp->rq_vec, v, &resp->count, &resp->eof);
190 * Write data to a file
193 nfsd3_proc_write(struct svc_rqst *rqstp)
195 struct nfsd3_writeargs *argp = rqstp->rq_argp;
196 struct nfsd3_writeres *resp = rqstp->rq_resp;
197 unsigned long cnt = argp->len;
200 dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
201 SVCFH_fmt(&argp->fh),
203 (unsigned long long) argp->offset,
204 argp->stable? " stable" : "");
206 resp->status = nfserr_fbig;
207 if (argp->offset > (u64)OFFSET_MAX ||
208 argp->offset + argp->len > (u64)OFFSET_MAX)
211 fh_copy(&resp->fh, &argp->fh);
212 resp->committed = argp->stable;
213 nvecs = svc_fill_write_vector(rqstp, &argp->payload);
215 resp->status = nfsd_write(rqstp, &resp->fh, argp->offset,
216 rqstp->rq_vec, nvecs, &cnt,
217 resp->committed, resp->verf);
223 * With NFSv3, CREATE processing is a lot easier than with NFSv2.
224 * At least in theory; we'll see how it fares in practice when the
225 * first reports about SunOS compatibility problems start to pour in...
228 nfsd3_proc_create(struct svc_rqst *rqstp)
230 struct nfsd3_createargs *argp = rqstp->rq_argp;
231 struct nfsd3_diropres *resp = rqstp->rq_resp;
232 svc_fh *dirfhp, *newfhp = NULL;
235 dprintk("nfsd: CREATE(3) %s %.*s\n",
236 SVCFH_fmt(&argp->fh),
240 dirfhp = fh_copy(&resp->dirfh, &argp->fh);
241 newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
244 /* Unfudge the mode bits */
245 attr->ia_mode &= ~S_IFMT;
246 if (!(attr->ia_valid & ATTR_MODE)) {
247 attr->ia_valid |= ATTR_MODE;
248 attr->ia_mode = S_IFREG;
250 attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG;
253 /* Now create the file and set attributes */
254 resp->status = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len,
255 attr, newfhp, argp->createmode,
256 (u32 *)argp->verf, NULL, NULL);
261 * Make directory. This operation is not idempotent.
264 nfsd3_proc_mkdir(struct svc_rqst *rqstp)
266 struct nfsd3_createargs *argp = rqstp->rq_argp;
267 struct nfsd3_diropres *resp = rqstp->rq_resp;
269 dprintk("nfsd: MKDIR(3) %s %.*s\n",
270 SVCFH_fmt(&argp->fh),
274 argp->attrs.ia_valid &= ~ATTR_SIZE;
275 fh_copy(&resp->dirfh, &argp->fh);
276 fh_init(&resp->fh, NFS3_FHSIZE);
277 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
278 &argp->attrs, S_IFDIR, 0, &resp->fh);
279 fh_unlock(&resp->dirfh);
284 nfsd3_proc_symlink(struct svc_rqst *rqstp)
286 struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
287 struct nfsd3_diropres *resp = rqstp->rq_resp;
289 if (argp->tlen == 0) {
290 resp->status = nfserr_inval;
293 if (argp->tlen > NFS3_MAXPATHLEN) {
294 resp->status = nfserr_nametoolong;
298 argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first,
299 page_address(rqstp->rq_arg.pages[0]),
301 if (IS_ERR(argp->tname)) {
302 resp->status = nfserrno(PTR_ERR(argp->tname));
306 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
307 SVCFH_fmt(&argp->ffh),
308 argp->flen, argp->fname,
309 argp->tlen, argp->tname);
311 fh_copy(&resp->dirfh, &argp->ffh);
312 fh_init(&resp->fh, NFS3_FHSIZE);
313 resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
314 argp->flen, argp->tname, &resp->fh);
321 * Make socket/fifo/device.
324 nfsd3_proc_mknod(struct svc_rqst *rqstp)
326 struct nfsd3_mknodargs *argp = rqstp->rq_argp;
327 struct nfsd3_diropres *resp = rqstp->rq_resp;
331 dprintk("nfsd: MKNOD(3) %s %.*s\n",
332 SVCFH_fmt(&argp->fh),
336 fh_copy(&resp->dirfh, &argp->fh);
337 fh_init(&resp->fh, NFS3_FHSIZE);
339 if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
340 rdev = MKDEV(argp->major, argp->minor);
341 if (MAJOR(rdev) != argp->major ||
342 MINOR(rdev) != argp->minor) {
343 resp->status = nfserr_inval;
346 } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
347 resp->status = nfserr_badtype;
351 type = nfs3_ftypes[argp->ftype];
352 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
353 &argp->attrs, type, rdev, &resp->fh);
354 fh_unlock(&resp->dirfh);
360 * Remove file/fifo/socket etc.
363 nfsd3_proc_remove(struct svc_rqst *rqstp)
365 struct nfsd3_diropargs *argp = rqstp->rq_argp;
366 struct nfsd3_attrstat *resp = rqstp->rq_resp;
368 dprintk("nfsd: REMOVE(3) %s %.*s\n",
369 SVCFH_fmt(&argp->fh),
373 /* Unlink. -S_IFDIR means file must not be a directory */
374 fh_copy(&resp->fh, &argp->fh);
375 resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
376 argp->name, argp->len);
377 fh_unlock(&resp->fh);
385 nfsd3_proc_rmdir(struct svc_rqst *rqstp)
387 struct nfsd3_diropargs *argp = rqstp->rq_argp;
388 struct nfsd3_attrstat *resp = rqstp->rq_resp;
390 dprintk("nfsd: RMDIR(3) %s %.*s\n",
391 SVCFH_fmt(&argp->fh),
395 fh_copy(&resp->fh, &argp->fh);
396 resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
397 argp->name, argp->len);
398 fh_unlock(&resp->fh);
403 nfsd3_proc_rename(struct svc_rqst *rqstp)
405 struct nfsd3_renameargs *argp = rqstp->rq_argp;
406 struct nfsd3_renameres *resp = rqstp->rq_resp;
408 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
409 SVCFH_fmt(&argp->ffh),
412 dprintk("nfsd: -> %s %.*s\n",
413 SVCFH_fmt(&argp->tfh),
417 fh_copy(&resp->ffh, &argp->ffh);
418 fh_copy(&resp->tfh, &argp->tfh);
419 resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
420 &resp->tfh, argp->tname, argp->tlen);
425 nfsd3_proc_link(struct svc_rqst *rqstp)
427 struct nfsd3_linkargs *argp = rqstp->rq_argp;
428 struct nfsd3_linkres *resp = rqstp->rq_resp;
430 dprintk("nfsd: LINK(3) %s ->\n",
431 SVCFH_fmt(&argp->ffh));
432 dprintk("nfsd: -> %s %.*s\n",
433 SVCFH_fmt(&argp->tfh),
437 fh_copy(&resp->fh, &argp->ffh);
438 fh_copy(&resp->tfh, &argp->tfh);
439 resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
444 static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
445 struct nfsd3_readdirres *resp,
448 struct xdr_buf *buf = &resp->dirlist;
449 struct xdr_stream *xdr = &resp->xdr;
450 unsigned int sendbuf = min_t(unsigned int, rqstp->rq_res.buflen,
451 svc_max_payload(rqstp));
453 memset(buf, 0, sizeof(*buf));
455 /* Reserve room for the NULL ptr & eof flag (-2 words) */
456 buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), sendbuf);
457 buf->buflen -= XDR_UNIT * 2;
458 buf->pages = rqstp->rq_next_page;
459 rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
461 /* This is xdr_init_encode(), but it assumes that
462 * the head kvec has already been consumed. */
463 xdr_set_scratch_buffer(xdr, NULL, 0);
465 xdr->page_ptr = buf->pages;
467 xdr->p = page_address(*buf->pages);
468 xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
473 * Read a portion of a directory.
476 nfsd3_proc_readdir(struct svc_rqst *rqstp)
478 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
479 struct nfsd3_readdirres *resp = rqstp->rq_resp;
482 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
483 SVCFH_fmt(&argp->fh),
484 argp->count, (u32) argp->cookie);
486 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
488 fh_copy(&resp->fh, &argp->fh);
489 resp->common.err = nfs_ok;
490 resp->cookie_offset = 0;
492 offset = argp->cookie;
493 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
494 &resp->common, nfs3svc_encode_entry3);
495 memcpy(resp->verf, argp->verf, 8);
496 nfs3svc_encode_cookie3(resp, offset);
498 /* Recycle only pages that were part of the reply */
499 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
505 * Read a portion of a directory, including file handles and attrs.
506 * For now, we choose to ignore the dircount parameter.
509 nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
511 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
512 struct nfsd3_readdirres *resp = rqstp->rq_resp;
515 dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
516 SVCFH_fmt(&argp->fh),
517 argp->count, (u32) argp->cookie);
519 nfsd3_init_dirlist_pages(rqstp, resp, argp->count);
521 fh_copy(&resp->fh, &argp->fh);
522 resp->common.err = nfs_ok;
523 resp->cookie_offset = 0;
525 offset = argp->cookie;
527 resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP);
528 if (resp->status != nfs_ok)
531 if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) {
532 resp->status = nfserr_notsupp;
536 resp->status = nfsd_readdir(rqstp, &resp->fh, &offset,
537 &resp->common, nfs3svc_encode_entryplus3);
538 memcpy(resp->verf, argp->verf, 8);
539 nfs3svc_encode_cookie3(resp, offset);
541 /* Recycle only pages that were part of the reply */
542 rqstp->rq_next_page = resp->xdr.page_ptr + 1;
549 * Get file system stats
552 nfsd3_proc_fsstat(struct svc_rqst *rqstp)
554 struct nfsd_fhandle *argp = rqstp->rq_argp;
555 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
557 dprintk("nfsd: FSSTAT(3) %s\n",
558 SVCFH_fmt(&argp->fh));
560 resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
566 * Get file system info
569 nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
571 struct nfsd_fhandle *argp = rqstp->rq_argp;
572 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
573 u32 max_blocksize = svc_max_payload(rqstp);
575 dprintk("nfsd: FSINFO(3) %s\n",
576 SVCFH_fmt(&argp->fh));
578 resp->f_rtmax = max_blocksize;
579 resp->f_rtpref = max_blocksize;
580 resp->f_rtmult = PAGE_SIZE;
581 resp->f_wtmax = max_blocksize;
582 resp->f_wtpref = max_blocksize;
583 resp->f_wtmult = PAGE_SIZE;
584 resp->f_dtpref = max_blocksize;
585 resp->f_maxfilesize = ~(u32) 0;
586 resp->f_properties = NFS3_FSF_DEFAULT;
588 resp->status = fh_verify(rqstp, &argp->fh, 0,
589 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
591 /* Check special features of the file system. May request
592 * different read/write sizes for file systems known to have
593 * problems with large blocks */
594 if (resp->status == nfs_ok) {
595 struct super_block *sb = argp->fh.fh_dentry->d_sb;
597 /* Note that we don't care for remote fs's here */
598 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
599 resp->f_properties = NFS3_FSF_BILLYBOY;
601 resp->f_maxfilesize = sb->s_maxbytes;
609 * Get pathconf info for the specified file
612 nfsd3_proc_pathconf(struct svc_rqst *rqstp)
614 struct nfsd_fhandle *argp = rqstp->rq_argp;
615 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
617 dprintk("nfsd: PATHCONF(3) %s\n",
618 SVCFH_fmt(&argp->fh));
620 /* Set default pathconf */
621 resp->p_link_max = 255; /* at least */
622 resp->p_name_max = 255; /* at least */
623 resp->p_no_trunc = 0;
624 resp->p_chown_restricted = 1;
625 resp->p_case_insensitive = 0;
626 resp->p_case_preserving = 1;
628 resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
630 if (resp->status == nfs_ok) {
631 struct super_block *sb = argp->fh.fh_dentry->d_sb;
633 /* Note that we don't care for remote fs's here */
634 switch (sb->s_magic) {
635 case EXT2_SUPER_MAGIC:
636 resp->p_link_max = EXT2_LINK_MAX;
637 resp->p_name_max = EXT2_NAME_LEN;
639 case MSDOS_SUPER_MAGIC:
640 resp->p_case_insensitive = 1;
641 resp->p_case_preserving = 0;
651 * Commit a file (range) to stable storage.
654 nfsd3_proc_commit(struct svc_rqst *rqstp)
656 struct nfsd3_commitargs *argp = rqstp->rq_argp;
657 struct nfsd3_commitres *resp = rqstp->rq_resp;
659 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
660 SVCFH_fmt(&argp->fh),
662 (unsigned long long) argp->offset);
664 fh_copy(&resp->fh, &argp->fh);
665 resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset,
666 argp->count, resp->verf);
672 * NFSv3 Server procedures.
673 * Only the results of non-idempotent operations are cached.
675 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
676 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
677 #define nfsd3_mkdirargs nfsd3_createargs
678 #define nfsd3_readdirplusargs nfsd3_readdirargs
679 #define nfsd3_fhandleargs nfsd_fhandle
680 #define nfsd3_attrstatres nfsd3_attrstat
681 #define nfsd3_wccstatres nfsd3_attrstat
682 #define nfsd3_createres nfsd3_diropres
684 #define ST 1 /* status*/
685 #define FH 17 /* filehandle with length */
686 #define AT 21 /* attributes */
687 #define pAT (1+AT) /* post attributes - conditional */
688 #define WC (7+pAT) /* WCC attributes */
690 static const struct svc_procedure nfsd_procedures3[22] = {
692 .pc_func = nfsd3_proc_null,
693 .pc_decode = nfssvc_decode_voidarg,
694 .pc_encode = nfssvc_encode_voidres,
695 .pc_argsize = sizeof(struct nfsd_voidargs),
696 .pc_ressize = sizeof(struct nfsd_voidres),
697 .pc_cachetype = RC_NOCACHE,
701 [NFS3PROC_GETATTR] = {
702 .pc_func = nfsd3_proc_getattr,
703 .pc_decode = nfs3svc_decode_fhandleargs,
704 .pc_encode = nfs3svc_encode_getattrres,
705 .pc_release = nfs3svc_release_fhandle,
706 .pc_argsize = sizeof(struct nfsd_fhandle),
707 .pc_ressize = sizeof(struct nfsd3_attrstatres),
708 .pc_cachetype = RC_NOCACHE,
709 .pc_xdrressize = ST+AT,
710 .pc_name = "GETATTR",
712 [NFS3PROC_SETATTR] = {
713 .pc_func = nfsd3_proc_setattr,
714 .pc_decode = nfs3svc_decode_sattrargs,
715 .pc_encode = nfs3svc_encode_wccstatres,
716 .pc_release = nfs3svc_release_fhandle,
717 .pc_argsize = sizeof(struct nfsd3_sattrargs),
718 .pc_ressize = sizeof(struct nfsd3_wccstatres),
719 .pc_cachetype = RC_REPLBUFF,
720 .pc_xdrressize = ST+WC,
721 .pc_name = "SETATTR",
723 [NFS3PROC_LOOKUP] = {
724 .pc_func = nfsd3_proc_lookup,
725 .pc_decode = nfs3svc_decode_diropargs,
726 .pc_encode = nfs3svc_encode_lookupres,
727 .pc_release = nfs3svc_release_fhandle2,
728 .pc_argsize = sizeof(struct nfsd3_diropargs),
729 .pc_ressize = sizeof(struct nfsd3_diropres),
730 .pc_cachetype = RC_NOCACHE,
731 .pc_xdrressize = ST+FH+pAT+pAT,
734 [NFS3PROC_ACCESS] = {
735 .pc_func = nfsd3_proc_access,
736 .pc_decode = nfs3svc_decode_accessargs,
737 .pc_encode = nfs3svc_encode_accessres,
738 .pc_release = nfs3svc_release_fhandle,
739 .pc_argsize = sizeof(struct nfsd3_accessargs),
740 .pc_ressize = sizeof(struct nfsd3_accessres),
741 .pc_cachetype = RC_NOCACHE,
742 .pc_xdrressize = ST+pAT+1,
745 [NFS3PROC_READLINK] = {
746 .pc_func = nfsd3_proc_readlink,
747 .pc_decode = nfs3svc_decode_fhandleargs,
748 .pc_encode = nfs3svc_encode_readlinkres,
749 .pc_release = nfs3svc_release_fhandle,
750 .pc_argsize = sizeof(struct nfsd_fhandle),
751 .pc_ressize = sizeof(struct nfsd3_readlinkres),
752 .pc_cachetype = RC_NOCACHE,
753 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
754 .pc_name = "READLINK",
757 .pc_func = nfsd3_proc_read,
758 .pc_decode = nfs3svc_decode_readargs,
759 .pc_encode = nfs3svc_encode_readres,
760 .pc_release = nfs3svc_release_fhandle,
761 .pc_argsize = sizeof(struct nfsd3_readargs),
762 .pc_ressize = sizeof(struct nfsd3_readres),
763 .pc_cachetype = RC_NOCACHE,
764 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
768 .pc_func = nfsd3_proc_write,
769 .pc_decode = nfs3svc_decode_writeargs,
770 .pc_encode = nfs3svc_encode_writeres,
771 .pc_release = nfs3svc_release_fhandle,
772 .pc_argsize = sizeof(struct nfsd3_writeargs),
773 .pc_ressize = sizeof(struct nfsd3_writeres),
774 .pc_cachetype = RC_REPLBUFF,
775 .pc_xdrressize = ST+WC+4,
778 [NFS3PROC_CREATE] = {
779 .pc_func = nfsd3_proc_create,
780 .pc_decode = nfs3svc_decode_createargs,
781 .pc_encode = nfs3svc_encode_createres,
782 .pc_release = nfs3svc_release_fhandle2,
783 .pc_argsize = sizeof(struct nfsd3_createargs),
784 .pc_ressize = sizeof(struct nfsd3_createres),
785 .pc_cachetype = RC_REPLBUFF,
786 .pc_xdrressize = ST+(1+FH+pAT)+WC,
790 .pc_func = nfsd3_proc_mkdir,
791 .pc_decode = nfs3svc_decode_mkdirargs,
792 .pc_encode = nfs3svc_encode_createres,
793 .pc_release = nfs3svc_release_fhandle2,
794 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
795 .pc_ressize = sizeof(struct nfsd3_createres),
796 .pc_cachetype = RC_REPLBUFF,
797 .pc_xdrressize = ST+(1+FH+pAT)+WC,
800 [NFS3PROC_SYMLINK] = {
801 .pc_func = nfsd3_proc_symlink,
802 .pc_decode = nfs3svc_decode_symlinkargs,
803 .pc_encode = nfs3svc_encode_createres,
804 .pc_release = nfs3svc_release_fhandle2,
805 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
806 .pc_ressize = sizeof(struct nfsd3_createres),
807 .pc_cachetype = RC_REPLBUFF,
808 .pc_xdrressize = ST+(1+FH+pAT)+WC,
809 .pc_name = "SYMLINK",
812 .pc_func = nfsd3_proc_mknod,
813 .pc_decode = nfs3svc_decode_mknodargs,
814 .pc_encode = nfs3svc_encode_createres,
815 .pc_release = nfs3svc_release_fhandle2,
816 .pc_argsize = sizeof(struct nfsd3_mknodargs),
817 .pc_ressize = sizeof(struct nfsd3_createres),
818 .pc_cachetype = RC_REPLBUFF,
819 .pc_xdrressize = ST+(1+FH+pAT)+WC,
822 [NFS3PROC_REMOVE] = {
823 .pc_func = nfsd3_proc_remove,
824 .pc_decode = nfs3svc_decode_diropargs,
825 .pc_encode = nfs3svc_encode_wccstatres,
826 .pc_release = nfs3svc_release_fhandle,
827 .pc_argsize = sizeof(struct nfsd3_diropargs),
828 .pc_ressize = sizeof(struct nfsd3_wccstatres),
829 .pc_cachetype = RC_REPLBUFF,
830 .pc_xdrressize = ST+WC,
834 .pc_func = nfsd3_proc_rmdir,
835 .pc_decode = nfs3svc_decode_diropargs,
836 .pc_encode = nfs3svc_encode_wccstatres,
837 .pc_release = nfs3svc_release_fhandle,
838 .pc_argsize = sizeof(struct nfsd3_diropargs),
839 .pc_ressize = sizeof(struct nfsd3_wccstatres),
840 .pc_cachetype = RC_REPLBUFF,
841 .pc_xdrressize = ST+WC,
844 [NFS3PROC_RENAME] = {
845 .pc_func = nfsd3_proc_rename,
846 .pc_decode = nfs3svc_decode_renameargs,
847 .pc_encode = nfs3svc_encode_renameres,
848 .pc_release = nfs3svc_release_fhandle2,
849 .pc_argsize = sizeof(struct nfsd3_renameargs),
850 .pc_ressize = sizeof(struct nfsd3_renameres),
851 .pc_cachetype = RC_REPLBUFF,
852 .pc_xdrressize = ST+WC+WC,
856 .pc_func = nfsd3_proc_link,
857 .pc_decode = nfs3svc_decode_linkargs,
858 .pc_encode = nfs3svc_encode_linkres,
859 .pc_release = nfs3svc_release_fhandle2,
860 .pc_argsize = sizeof(struct nfsd3_linkargs),
861 .pc_ressize = sizeof(struct nfsd3_linkres),
862 .pc_cachetype = RC_REPLBUFF,
863 .pc_xdrressize = ST+pAT+WC,
866 [NFS3PROC_READDIR] = {
867 .pc_func = nfsd3_proc_readdir,
868 .pc_decode = nfs3svc_decode_readdirargs,
869 .pc_encode = nfs3svc_encode_readdirres,
870 .pc_release = nfs3svc_release_fhandle,
871 .pc_argsize = sizeof(struct nfsd3_readdirargs),
872 .pc_ressize = sizeof(struct nfsd3_readdirres),
873 .pc_cachetype = RC_NOCACHE,
874 .pc_name = "READDIR",
876 [NFS3PROC_READDIRPLUS] = {
877 .pc_func = nfsd3_proc_readdirplus,
878 .pc_decode = nfs3svc_decode_readdirplusargs,
879 .pc_encode = nfs3svc_encode_readdirres,
880 .pc_release = nfs3svc_release_fhandle,
881 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
882 .pc_ressize = sizeof(struct nfsd3_readdirres),
883 .pc_cachetype = RC_NOCACHE,
884 .pc_name = "READDIRPLUS",
886 [NFS3PROC_FSSTAT] = {
887 .pc_func = nfsd3_proc_fsstat,
888 .pc_decode = nfs3svc_decode_fhandleargs,
889 .pc_encode = nfs3svc_encode_fsstatres,
890 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
891 .pc_ressize = sizeof(struct nfsd3_fsstatres),
892 .pc_cachetype = RC_NOCACHE,
893 .pc_xdrressize = ST+pAT+2*6+1,
896 [NFS3PROC_FSINFO] = {
897 .pc_func = nfsd3_proc_fsinfo,
898 .pc_decode = nfs3svc_decode_fhandleargs,
899 .pc_encode = nfs3svc_encode_fsinfores,
900 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
901 .pc_ressize = sizeof(struct nfsd3_fsinfores),
902 .pc_cachetype = RC_NOCACHE,
903 .pc_xdrressize = ST+pAT+12,
906 [NFS3PROC_PATHCONF] = {
907 .pc_func = nfsd3_proc_pathconf,
908 .pc_decode = nfs3svc_decode_fhandleargs,
909 .pc_encode = nfs3svc_encode_pathconfres,
910 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
911 .pc_ressize = sizeof(struct nfsd3_pathconfres),
912 .pc_cachetype = RC_NOCACHE,
913 .pc_xdrressize = ST+pAT+6,
914 .pc_name = "PATHCONF",
916 [NFS3PROC_COMMIT] = {
917 .pc_func = nfsd3_proc_commit,
918 .pc_decode = nfs3svc_decode_commitargs,
919 .pc_encode = nfs3svc_encode_commitres,
920 .pc_release = nfs3svc_release_fhandle,
921 .pc_argsize = sizeof(struct nfsd3_commitargs),
922 .pc_ressize = sizeof(struct nfsd3_commitres),
923 .pc_cachetype = RC_NOCACHE,
924 .pc_xdrressize = ST+WC+2,
929 static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
930 const struct svc_version nfsd_version3 = {
933 .vs_proc = nfsd_procedures3,
934 .vs_dispatch = nfsd_dispatch,
935 .vs_count = nfsd_count3,
936 .vs_xdrsize = NFS3_SVC_XDRSIZE,