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 #define RETURN_STATUS(st) { resp->status = (st); return (st); }
20 static int nfs3_ftypes
[] = {
27 S_IFSOCK
, /* NF3SOCK */
28 S_IFIFO
, /* NF3FIFO */
35 nfsd3_proc_null(struct svc_rqst
*rqstp
)
41 * Get a file's attributes
44 nfsd3_proc_getattr(struct svc_rqst
*rqstp
)
46 struct nfsd_fhandle
*argp
= rqstp
->rq_argp
;
47 struct nfsd3_attrstat
*resp
= rqstp
->rq_resp
;
50 dprintk("nfsd: GETATTR(3) %s\n",
51 SVCFH_fmt(&argp
->fh
));
53 fh_copy(&resp
->fh
, &argp
->fh
);
54 nfserr
= fh_verify(rqstp
, &resp
->fh
, 0,
55 NFSD_MAY_NOP
| NFSD_MAY_BYPASS_GSS_ON_ROOT
);
57 RETURN_STATUS(nfserr
);
59 nfserr
= fh_getattr(&resp
->fh
, &resp
->stat
);
61 RETURN_STATUS(nfserr
);
65 * Set a file's attributes
68 nfsd3_proc_setattr(struct svc_rqst
*rqstp
)
70 struct nfsd3_sattrargs
*argp
= rqstp
->rq_argp
;
71 struct nfsd3_attrstat
*resp
= rqstp
->rq_resp
;
74 dprintk("nfsd: SETATTR(3) %s\n",
75 SVCFH_fmt(&argp
->fh
));
77 fh_copy(&resp
->fh
, &argp
->fh
);
78 nfserr
= nfsd_setattr(rqstp
, &resp
->fh
, &argp
->attrs
,
79 argp
->check_guard
, argp
->guardtime
);
80 RETURN_STATUS(nfserr
);
84 * Look up a path name component
87 nfsd3_proc_lookup(struct svc_rqst
*rqstp
)
89 struct nfsd3_diropargs
*argp
= rqstp
->rq_argp
;
90 struct nfsd3_diropres
*resp
= rqstp
->rq_resp
;
93 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
98 fh_copy(&resp
->dirfh
, &argp
->fh
);
99 fh_init(&resp
->fh
, NFS3_FHSIZE
);
101 nfserr
= nfsd_lookup(rqstp
, &resp
->dirfh
,
105 RETURN_STATUS(nfserr
);
112 nfsd3_proc_access(struct svc_rqst
*rqstp
)
114 struct nfsd3_accessargs
*argp
= rqstp
->rq_argp
;
115 struct nfsd3_accessres
*resp
= rqstp
->rq_resp
;
118 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
119 SVCFH_fmt(&argp
->fh
),
122 fh_copy(&resp
->fh
, &argp
->fh
);
123 resp
->access
= argp
->access
;
124 nfserr
= nfsd_access(rqstp
, &resp
->fh
, &resp
->access
, NULL
);
125 RETURN_STATUS(nfserr
);
132 nfsd3_proc_readlink(struct svc_rqst
*rqstp
)
134 struct nfsd3_readlinkargs
*argp
= rqstp
->rq_argp
;
135 struct nfsd3_readlinkres
*resp
= rqstp
->rq_resp
;
138 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp
->fh
));
140 /* Read the symlink. */
141 fh_copy(&resp
->fh
, &argp
->fh
);
142 resp
->len
= NFS3_MAXPATHLEN
;
143 nfserr
= nfsd_readlink(rqstp
, &resp
->fh
, argp
->buffer
, &resp
->len
);
144 RETURN_STATUS(nfserr
);
148 * Read a portion of a file.
151 nfsd3_proc_read(struct svc_rqst
*rqstp
)
153 struct nfsd3_readargs
*argp
= rqstp
->rq_argp
;
154 struct nfsd3_readres
*resp
= rqstp
->rq_resp
;
156 u32 max_blocksize
= svc_max_payload(rqstp
);
157 unsigned long cnt
= min(argp
->count
, max_blocksize
);
159 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
160 SVCFH_fmt(&argp
->fh
),
161 (unsigned long) argp
->count
,
162 (unsigned long long) argp
->offset
);
164 /* Obtain buffer pointer for payload.
165 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
166 * + 1 (xdr opaque byte count) = 26
169 svc_reserve_auth(rqstp
, ((1 + NFS3_POST_OP_ATTR_WORDS
+ 3)<<2) + resp
->count
+4);
171 fh_copy(&resp
->fh
, &argp
->fh
);
172 nfserr
= nfsd_read(rqstp
, &resp
->fh
,
174 rqstp
->rq_vec
, argp
->vlen
,
177 struct inode
*inode
= d_inode(resp
->fh
.fh_dentry
);
178 resp
->eof
= nfsd_eof_on_read(cnt
, resp
->count
, argp
->offset
,
182 RETURN_STATUS(nfserr
);
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
;
194 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 nfserr
= nfsd_write(rqstp
, &resp
->fh
, argp
->offset
,
205 rqstp
->rq_vec
, argp
->vlen
,
206 &cnt
, resp
->committed
);
208 RETURN_STATUS(nfserr
);
212 * With NFSv3, CREATE processing is a lot easier than with NFSv2.
213 * At least in theory; we'll see how it fares in practice when the
214 * first reports about SunOS compatibility problems start to pour in...
217 nfsd3_proc_create(struct svc_rqst
*rqstp
)
219 struct nfsd3_createargs
*argp
= rqstp
->rq_argp
;
220 struct nfsd3_diropres
*resp
= rqstp
->rq_resp
;
221 svc_fh
*dirfhp
, *newfhp
= NULL
;
225 dprintk("nfsd: CREATE(3) %s %.*s\n",
226 SVCFH_fmt(&argp
->fh
),
230 dirfhp
= fh_copy(&resp
->dirfh
, &argp
->fh
);
231 newfhp
= fh_init(&resp
->fh
, NFS3_FHSIZE
);
234 /* Unfudge the mode bits */
235 attr
->ia_mode
&= ~S_IFMT
;
236 if (!(attr
->ia_valid
& ATTR_MODE
)) {
237 attr
->ia_valid
|= ATTR_MODE
;
238 attr
->ia_mode
= S_IFREG
;
240 attr
->ia_mode
= (attr
->ia_mode
& ~S_IFMT
) | S_IFREG
;
243 /* Now create the file and set attributes */
244 nfserr
= do_nfsd_create(rqstp
, dirfhp
, argp
->name
, argp
->len
,
246 argp
->createmode
, (u32
*)argp
->verf
, NULL
, NULL
);
248 RETURN_STATUS(nfserr
);
252 * Make directory. This operation is not idempotent.
255 nfsd3_proc_mkdir(struct svc_rqst
*rqstp
)
257 struct nfsd3_createargs
*argp
= rqstp
->rq_argp
;
258 struct nfsd3_diropres
*resp
= rqstp
->rq_resp
;
261 dprintk("nfsd: MKDIR(3) %s %.*s\n",
262 SVCFH_fmt(&argp
->fh
),
266 argp
->attrs
.ia_valid
&= ~ATTR_SIZE
;
267 fh_copy(&resp
->dirfh
, &argp
->fh
);
268 fh_init(&resp
->fh
, NFS3_FHSIZE
);
269 nfserr
= nfsd_create(rqstp
, &resp
->dirfh
, argp
->name
, argp
->len
,
270 &argp
->attrs
, S_IFDIR
, 0, &resp
->fh
);
271 fh_unlock(&resp
->dirfh
);
272 RETURN_STATUS(nfserr
);
276 nfsd3_proc_symlink(struct svc_rqst
*rqstp
)
278 struct nfsd3_symlinkargs
*argp
= rqstp
->rq_argp
;
279 struct nfsd3_diropres
*resp
= rqstp
->rq_resp
;
282 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
283 SVCFH_fmt(&argp
->ffh
),
284 argp
->flen
, argp
->fname
,
285 argp
->tlen
, argp
->tname
);
287 fh_copy(&resp
->dirfh
, &argp
->ffh
);
288 fh_init(&resp
->fh
, NFS3_FHSIZE
);
289 nfserr
= nfsd_symlink(rqstp
, &resp
->dirfh
, argp
->fname
, argp
->flen
,
290 argp
->tname
, &resp
->fh
);
291 RETURN_STATUS(nfserr
);
295 * Make socket/fifo/device.
298 nfsd3_proc_mknod(struct svc_rqst
*rqstp
)
300 struct nfsd3_mknodargs
*argp
= rqstp
->rq_argp
;
301 struct nfsd3_diropres
*resp
= rqstp
->rq_resp
;
306 dprintk("nfsd: MKNOD(3) %s %.*s\n",
307 SVCFH_fmt(&argp
->fh
),
311 fh_copy(&resp
->dirfh
, &argp
->fh
);
312 fh_init(&resp
->fh
, NFS3_FHSIZE
);
314 if (argp
->ftype
== 0 || argp
->ftype
>= NF3BAD
)
315 RETURN_STATUS(nfserr_inval
);
316 if (argp
->ftype
== NF3CHR
|| argp
->ftype
== NF3BLK
) {
317 rdev
= MKDEV(argp
->major
, argp
->minor
);
318 if (MAJOR(rdev
) != argp
->major
||
319 MINOR(rdev
) != argp
->minor
)
320 RETURN_STATUS(nfserr_inval
);
322 if (argp
->ftype
!= NF3SOCK
&& argp
->ftype
!= NF3FIFO
)
323 RETURN_STATUS(nfserr_inval
);
325 type
= nfs3_ftypes
[argp
->ftype
];
326 nfserr
= nfsd_create(rqstp
, &resp
->dirfh
, argp
->name
, argp
->len
,
327 &argp
->attrs
, type
, rdev
, &resp
->fh
);
328 fh_unlock(&resp
->dirfh
);
329 RETURN_STATUS(nfserr
);
333 * Remove file/fifo/socket etc.
336 nfsd3_proc_remove(struct svc_rqst
*rqstp
)
338 struct nfsd3_diropargs
*argp
= rqstp
->rq_argp
;
339 struct nfsd3_attrstat
*resp
= rqstp
->rq_resp
;
342 dprintk("nfsd: REMOVE(3) %s %.*s\n",
343 SVCFH_fmt(&argp
->fh
),
347 /* Unlink. -S_IFDIR means file must not be a directory */
348 fh_copy(&resp
->fh
, &argp
->fh
);
349 nfserr
= nfsd_unlink(rqstp
, &resp
->fh
, -S_IFDIR
, argp
->name
, argp
->len
);
350 fh_unlock(&resp
->fh
);
351 RETURN_STATUS(nfserr
);
358 nfsd3_proc_rmdir(struct svc_rqst
*rqstp
)
360 struct nfsd3_diropargs
*argp
= rqstp
->rq_argp
;
361 struct nfsd3_attrstat
*resp
= rqstp
->rq_resp
;
364 dprintk("nfsd: RMDIR(3) %s %.*s\n",
365 SVCFH_fmt(&argp
->fh
),
369 fh_copy(&resp
->fh
, &argp
->fh
);
370 nfserr
= nfsd_unlink(rqstp
, &resp
->fh
, S_IFDIR
, argp
->name
, argp
->len
);
371 fh_unlock(&resp
->fh
);
372 RETURN_STATUS(nfserr
);
376 nfsd3_proc_rename(struct svc_rqst
*rqstp
)
378 struct nfsd3_renameargs
*argp
= rqstp
->rq_argp
;
379 struct nfsd3_renameres
*resp
= rqstp
->rq_resp
;
382 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
383 SVCFH_fmt(&argp
->ffh
),
386 dprintk("nfsd: -> %s %.*s\n",
387 SVCFH_fmt(&argp
->tfh
),
391 fh_copy(&resp
->ffh
, &argp
->ffh
);
392 fh_copy(&resp
->tfh
, &argp
->tfh
);
393 nfserr
= nfsd_rename(rqstp
, &resp
->ffh
, argp
->fname
, argp
->flen
,
394 &resp
->tfh
, argp
->tname
, argp
->tlen
);
395 RETURN_STATUS(nfserr
);
399 nfsd3_proc_link(struct svc_rqst
*rqstp
)
401 struct nfsd3_linkargs
*argp
= rqstp
->rq_argp
;
402 struct nfsd3_linkres
*resp
= rqstp
->rq_resp
;
405 dprintk("nfsd: LINK(3) %s ->\n",
406 SVCFH_fmt(&argp
->ffh
));
407 dprintk("nfsd: -> %s %.*s\n",
408 SVCFH_fmt(&argp
->tfh
),
412 fh_copy(&resp
->fh
, &argp
->ffh
);
413 fh_copy(&resp
->tfh
, &argp
->tfh
);
414 nfserr
= nfsd_link(rqstp
, &resp
->tfh
, argp
->tname
, argp
->tlen
,
416 RETURN_STATUS(nfserr
);
420 * Read a portion of a directory.
423 nfsd3_proc_readdir(struct svc_rqst
*rqstp
)
425 struct nfsd3_readdirargs
*argp
= rqstp
->rq_argp
;
426 struct nfsd3_readdirres
*resp
= rqstp
->rq_resp
;
430 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
431 SVCFH_fmt(&argp
->fh
),
432 argp
->count
, (u32
) argp
->cookie
);
434 /* Make sure we've room for the NULL ptr & eof flag, and shrink to
435 * client read size */
436 count
= (argp
->count
>> 2) - 2;
438 /* Read directory and encode entries on the fly */
439 fh_copy(&resp
->fh
, &argp
->fh
);
441 resp
->buflen
= count
;
442 resp
->common
.err
= nfs_ok
;
443 resp
->buffer
= argp
->buffer
;
445 nfserr
= nfsd_readdir(rqstp
, &resp
->fh
, (loff_t
*) &argp
->cookie
,
446 &resp
->common
, nfs3svc_encode_entry
);
447 memcpy(resp
->verf
, argp
->verf
, 8);
448 resp
->count
= resp
->buffer
- argp
->buffer
;
450 loff_t offset
= argp
->cookie
;
452 if (unlikely(resp
->offset1
)) {
453 /* we ended up with offset on a page boundary */
454 *resp
->offset
= htonl(offset
>> 32);
455 *resp
->offset1
= htonl(offset
& 0xffffffff);
456 resp
->offset1
= NULL
;
458 xdr_encode_hyper(resp
->offset
, offset
);
463 RETURN_STATUS(nfserr
);
467 * Read a portion of a directory, including file handles and attrs.
468 * For now, we choose to ignore the dircount parameter.
471 nfsd3_proc_readdirplus(struct svc_rqst
*rqstp
)
473 struct nfsd3_readdirargs
*argp
= rqstp
->rq_argp
;
474 struct nfsd3_readdirres
*resp
= rqstp
->rq_resp
;
479 caddr_t page_addr
= NULL
;
481 dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
482 SVCFH_fmt(&argp
->fh
),
483 argp
->count
, (u32
) argp
->cookie
);
485 /* Convert byte count to number of words (i.e. >> 2),
486 * and reserve room for the NULL ptr & eof flag (-2 words) */
487 resp
->count
= (argp
->count
>> 2) - 2;
489 /* Read directory and encode entries on the fly */
490 fh_copy(&resp
->fh
, &argp
->fh
);
492 resp
->common
.err
= nfs_ok
;
493 resp
->buffer
= argp
->buffer
;
494 resp
->buflen
= resp
->count
;
496 offset
= argp
->cookie
;
498 nfserr
= fh_verify(rqstp
, &resp
->fh
, S_IFDIR
, NFSD_MAY_NOP
);
500 RETURN_STATUS(nfserr
);
502 if (resp
->fh
.fh_export
->ex_flags
& NFSEXP_NOREADDIRPLUS
)
503 RETURN_STATUS(nfserr_notsupp
);
505 nfserr
= nfsd_readdir(rqstp
, &resp
->fh
,
508 nfs3svc_encode_entry_plus
);
509 memcpy(resp
->verf
, argp
->verf
, 8);
510 for (p
= rqstp
->rq_respages
+ 1; p
< rqstp
->rq_next_page
; p
++) {
511 page_addr
= page_address(*p
);
513 if (((caddr_t
)resp
->buffer
>= page_addr
) &&
514 ((caddr_t
)resp
->buffer
< page_addr
+ PAGE_SIZE
)) {
515 count
+= (caddr_t
)resp
->buffer
- page_addr
;
520 resp
->count
= count
>> 2;
522 if (unlikely(resp
->offset1
)) {
523 /* we ended up with offset on a page boundary */
524 *resp
->offset
= htonl(offset
>> 32);
525 *resp
->offset1
= htonl(offset
& 0xffffffff);
526 resp
->offset1
= NULL
;
528 xdr_encode_hyper(resp
->offset
, offset
);
533 RETURN_STATUS(nfserr
);
537 * Get file system stats
540 nfsd3_proc_fsstat(struct svc_rqst
*rqstp
)
542 struct nfsd_fhandle
*argp
= rqstp
->rq_argp
;
543 struct nfsd3_fsstatres
*resp
= rqstp
->rq_resp
;
546 dprintk("nfsd: FSSTAT(3) %s\n",
547 SVCFH_fmt(&argp
->fh
));
549 nfserr
= nfsd_statfs(rqstp
, &argp
->fh
, &resp
->stats
, 0);
551 RETURN_STATUS(nfserr
);
555 * Get file system info
558 nfsd3_proc_fsinfo(struct svc_rqst
*rqstp
)
560 struct nfsd_fhandle
*argp
= rqstp
->rq_argp
;
561 struct nfsd3_fsinfores
*resp
= rqstp
->rq_resp
;
563 u32 max_blocksize
= svc_max_payload(rqstp
);
565 dprintk("nfsd: FSINFO(3) %s\n",
566 SVCFH_fmt(&argp
->fh
));
568 resp
->f_rtmax
= max_blocksize
;
569 resp
->f_rtpref
= max_blocksize
;
570 resp
->f_rtmult
= PAGE_SIZE
;
571 resp
->f_wtmax
= max_blocksize
;
572 resp
->f_wtpref
= max_blocksize
;
573 resp
->f_wtmult
= PAGE_SIZE
;
574 resp
->f_dtpref
= PAGE_SIZE
;
575 resp
->f_maxfilesize
= ~(u32
) 0;
576 resp
->f_properties
= NFS3_FSF_DEFAULT
;
578 nfserr
= fh_verify(rqstp
, &argp
->fh
, 0,
579 NFSD_MAY_NOP
| NFSD_MAY_BYPASS_GSS_ON_ROOT
);
581 /* Check special features of the file system. May request
582 * different read/write sizes for file systems known to have
583 * problems with large blocks */
585 struct super_block
*sb
= argp
->fh
.fh_dentry
->d_sb
;
587 /* Note that we don't care for remote fs's here */
588 if (sb
->s_magic
== MSDOS_SUPER_MAGIC
) {
589 resp
->f_properties
= NFS3_FSF_BILLYBOY
;
591 resp
->f_maxfilesize
= sb
->s_maxbytes
;
595 RETURN_STATUS(nfserr
);
599 * Get pathconf info for the specified file
602 nfsd3_proc_pathconf(struct svc_rqst
*rqstp
)
604 struct nfsd_fhandle
*argp
= rqstp
->rq_argp
;
605 struct nfsd3_pathconfres
*resp
= rqstp
->rq_resp
;
608 dprintk("nfsd: PATHCONF(3) %s\n",
609 SVCFH_fmt(&argp
->fh
));
611 /* Set default pathconf */
612 resp
->p_link_max
= 255; /* at least */
613 resp
->p_name_max
= 255; /* at least */
614 resp
->p_no_trunc
= 0;
615 resp
->p_chown_restricted
= 1;
616 resp
->p_case_insensitive
= 0;
617 resp
->p_case_preserving
= 1;
619 nfserr
= fh_verify(rqstp
, &argp
->fh
, 0, NFSD_MAY_NOP
);
622 struct super_block
*sb
= argp
->fh
.fh_dentry
->d_sb
;
624 /* Note that we don't care for remote fs's here */
625 switch (sb
->s_magic
) {
626 case EXT2_SUPER_MAGIC
:
627 resp
->p_link_max
= EXT2_LINK_MAX
;
628 resp
->p_name_max
= EXT2_NAME_LEN
;
630 case MSDOS_SUPER_MAGIC
:
631 resp
->p_case_insensitive
= 1;
632 resp
->p_case_preserving
= 0;
638 RETURN_STATUS(nfserr
);
643 * Commit a file (range) to stable storage.
646 nfsd3_proc_commit(struct svc_rqst
*rqstp
)
648 struct nfsd3_commitargs
*argp
= rqstp
->rq_argp
;
649 struct nfsd3_commitres
*resp
= rqstp
->rq_resp
;
652 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
653 SVCFH_fmt(&argp
->fh
),
655 (unsigned long long) argp
->offset
);
657 if (argp
->offset
> NFS_OFFSET_MAX
)
658 RETURN_STATUS(nfserr_inval
);
660 fh_copy(&resp
->fh
, &argp
->fh
);
661 nfserr
= nfsd_commit(rqstp
, &resp
->fh
, argp
->offset
, argp
->count
);
663 RETURN_STATUS(nfserr
);
668 * NFSv3 Server procedures.
669 * Only the results of non-idempotent operations are cached.
671 #define nfs3svc_decode_fhandleargs nfs3svc_decode_fhandle
672 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
673 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
674 #define nfsd3_mkdirargs nfsd3_createargs
675 #define nfsd3_readdirplusargs nfsd3_readdirargs
676 #define nfsd3_fhandleargs nfsd_fhandle
677 #define nfsd3_fhandleres nfsd3_attrstat
678 #define nfsd3_attrstatres nfsd3_attrstat
679 #define nfsd3_wccstatres nfsd3_attrstat
680 #define nfsd3_createres nfsd3_diropres
681 #define nfsd3_voidres nfsd3_voidargs
682 struct nfsd3_voidargs
{ int dummy
; };
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_encode
= nfs3svc_encode_voidres
,
694 .pc_argsize
= sizeof(struct nfsd3_voidargs
),
695 .pc_ressize
= sizeof(struct nfsd3_voidres
),
696 .pc_cachetype
= RC_NOCACHE
,
699 [NFS3PROC_GETATTR
] = {
700 .pc_func
= nfsd3_proc_getattr
,
701 .pc_decode
= nfs3svc_decode_fhandleargs
,
702 .pc_encode
= nfs3svc_encode_attrstatres
,
703 .pc_release
= nfs3svc_release_fhandle
,
704 .pc_argsize
= sizeof(struct nfsd3_fhandleargs
),
705 .pc_ressize
= sizeof(struct nfsd3_attrstatres
),
706 .pc_cachetype
= RC_NOCACHE
,
707 .pc_xdrressize
= ST
+AT
,
709 [NFS3PROC_SETATTR
] = {
710 .pc_func
= nfsd3_proc_setattr
,
711 .pc_decode
= nfs3svc_decode_sattrargs
,
712 .pc_encode
= nfs3svc_encode_wccstatres
,
713 .pc_release
= nfs3svc_release_fhandle
,
714 .pc_argsize
= sizeof(struct nfsd3_sattrargs
),
715 .pc_ressize
= sizeof(struct nfsd3_wccstatres
),
716 .pc_cachetype
= RC_REPLBUFF
,
717 .pc_xdrressize
= ST
+WC
,
719 [NFS3PROC_LOOKUP
] = {
720 .pc_func
= nfsd3_proc_lookup
,
721 .pc_decode
= nfs3svc_decode_diropargs
,
722 .pc_encode
= nfs3svc_encode_diropres
,
723 .pc_release
= nfs3svc_release_fhandle2
,
724 .pc_argsize
= sizeof(struct nfsd3_diropargs
),
725 .pc_ressize
= sizeof(struct nfsd3_diropres
),
726 .pc_cachetype
= RC_NOCACHE
,
727 .pc_xdrressize
= ST
+FH
+pAT
+pAT
,
729 [NFS3PROC_ACCESS
] = {
730 .pc_func
= nfsd3_proc_access
,
731 .pc_decode
= nfs3svc_decode_accessargs
,
732 .pc_encode
= nfs3svc_encode_accessres
,
733 .pc_release
= nfs3svc_release_fhandle
,
734 .pc_argsize
= sizeof(struct nfsd3_accessargs
),
735 .pc_ressize
= sizeof(struct nfsd3_accessres
),
736 .pc_cachetype
= RC_NOCACHE
,
737 .pc_xdrressize
= ST
+pAT
+1,
739 [NFS3PROC_READLINK
] = {
740 .pc_func
= nfsd3_proc_readlink
,
741 .pc_decode
= nfs3svc_decode_readlinkargs
,
742 .pc_encode
= nfs3svc_encode_readlinkres
,
743 .pc_release
= nfs3svc_release_fhandle
,
744 .pc_argsize
= sizeof(struct nfsd3_readlinkargs
),
745 .pc_ressize
= sizeof(struct nfsd3_readlinkres
),
746 .pc_cachetype
= RC_NOCACHE
,
747 .pc_xdrressize
= ST
+pAT
+1+NFS3_MAXPATHLEN
/4,
750 .pc_func
= nfsd3_proc_read
,
751 .pc_decode
= nfs3svc_decode_readargs
,
752 .pc_encode
= nfs3svc_encode_readres
,
753 .pc_release
= nfs3svc_release_fhandle
,
754 .pc_argsize
= sizeof(struct nfsd3_readargs
),
755 .pc_ressize
= sizeof(struct nfsd3_readres
),
756 .pc_cachetype
= RC_NOCACHE
,
757 .pc_xdrressize
= ST
+pAT
+4+NFSSVC_MAXBLKSIZE
/4,
760 .pc_func
= nfsd3_proc_write
,
761 .pc_decode
= nfs3svc_decode_writeargs
,
762 .pc_encode
= nfs3svc_encode_writeres
,
763 .pc_release
= nfs3svc_release_fhandle
,
764 .pc_argsize
= sizeof(struct nfsd3_writeargs
),
765 .pc_ressize
= sizeof(struct nfsd3_writeres
),
766 .pc_cachetype
= RC_REPLBUFF
,
767 .pc_xdrressize
= ST
+WC
+4,
769 [NFS3PROC_CREATE
] = {
770 .pc_func
= nfsd3_proc_create
,
771 .pc_decode
= nfs3svc_decode_createargs
,
772 .pc_encode
= nfs3svc_encode_createres
,
773 .pc_release
= nfs3svc_release_fhandle2
,
774 .pc_argsize
= sizeof(struct nfsd3_createargs
),
775 .pc_ressize
= sizeof(struct nfsd3_createres
),
776 .pc_cachetype
= RC_REPLBUFF
,
777 .pc_xdrressize
= ST
+(1+FH
+pAT
)+WC
,
780 .pc_func
= nfsd3_proc_mkdir
,
781 .pc_decode
= nfs3svc_decode_mkdirargs
,
782 .pc_encode
= nfs3svc_encode_createres
,
783 .pc_release
= nfs3svc_release_fhandle2
,
784 .pc_argsize
= sizeof(struct nfsd3_mkdirargs
),
785 .pc_ressize
= sizeof(struct nfsd3_createres
),
786 .pc_cachetype
= RC_REPLBUFF
,
787 .pc_xdrressize
= ST
+(1+FH
+pAT
)+WC
,
789 [NFS3PROC_SYMLINK
] = {
790 .pc_func
= nfsd3_proc_symlink
,
791 .pc_decode
= nfs3svc_decode_symlinkargs
,
792 .pc_encode
= nfs3svc_encode_createres
,
793 .pc_release
= nfs3svc_release_fhandle2
,
794 .pc_argsize
= sizeof(struct nfsd3_symlinkargs
),
795 .pc_ressize
= sizeof(struct nfsd3_createres
),
796 .pc_cachetype
= RC_REPLBUFF
,
797 .pc_xdrressize
= ST
+(1+FH
+pAT
)+WC
,
800 .pc_func
= nfsd3_proc_mknod
,
801 .pc_decode
= nfs3svc_decode_mknodargs
,
802 .pc_encode
= nfs3svc_encode_createres
,
803 .pc_release
= nfs3svc_release_fhandle2
,
804 .pc_argsize
= sizeof(struct nfsd3_mknodargs
),
805 .pc_ressize
= sizeof(struct nfsd3_createres
),
806 .pc_cachetype
= RC_REPLBUFF
,
807 .pc_xdrressize
= ST
+(1+FH
+pAT
)+WC
,
809 [NFS3PROC_REMOVE
] = {
810 .pc_func
= nfsd3_proc_remove
,
811 .pc_decode
= nfs3svc_decode_diropargs
,
812 .pc_encode
= nfs3svc_encode_wccstatres
,
813 .pc_release
= nfs3svc_release_fhandle
,
814 .pc_argsize
= sizeof(struct nfsd3_diropargs
),
815 .pc_ressize
= sizeof(struct nfsd3_wccstatres
),
816 .pc_cachetype
= RC_REPLBUFF
,
817 .pc_xdrressize
= ST
+WC
,
820 .pc_func
= nfsd3_proc_rmdir
,
821 .pc_decode
= nfs3svc_decode_diropargs
,
822 .pc_encode
= nfs3svc_encode_wccstatres
,
823 .pc_release
= nfs3svc_release_fhandle
,
824 .pc_argsize
= sizeof(struct nfsd3_diropargs
),
825 .pc_ressize
= sizeof(struct nfsd3_wccstatres
),
826 .pc_cachetype
= RC_REPLBUFF
,
827 .pc_xdrressize
= ST
+WC
,
829 [NFS3PROC_RENAME
] = {
830 .pc_func
= nfsd3_proc_rename
,
831 .pc_decode
= nfs3svc_decode_renameargs
,
832 .pc_encode
= nfs3svc_encode_renameres
,
833 .pc_release
= nfs3svc_release_fhandle2
,
834 .pc_argsize
= sizeof(struct nfsd3_renameargs
),
835 .pc_ressize
= sizeof(struct nfsd3_renameres
),
836 .pc_cachetype
= RC_REPLBUFF
,
837 .pc_xdrressize
= ST
+WC
+WC
,
840 .pc_func
= nfsd3_proc_link
,
841 .pc_decode
= nfs3svc_decode_linkargs
,
842 .pc_encode
= nfs3svc_encode_linkres
,
843 .pc_release
= nfs3svc_release_fhandle2
,
844 .pc_argsize
= sizeof(struct nfsd3_linkargs
),
845 .pc_ressize
= sizeof(struct nfsd3_linkres
),
846 .pc_cachetype
= RC_REPLBUFF
,
847 .pc_xdrressize
= ST
+pAT
+WC
,
849 [NFS3PROC_READDIR
] = {
850 .pc_func
= nfsd3_proc_readdir
,
851 .pc_decode
= nfs3svc_decode_readdirargs
,
852 .pc_encode
= nfs3svc_encode_readdirres
,
853 .pc_release
= nfs3svc_release_fhandle
,
854 .pc_argsize
= sizeof(struct nfsd3_readdirargs
),
855 .pc_ressize
= sizeof(struct nfsd3_readdirres
),
856 .pc_cachetype
= RC_NOCACHE
,
858 [NFS3PROC_READDIRPLUS
] = {
859 .pc_func
= nfsd3_proc_readdirplus
,
860 .pc_decode
= nfs3svc_decode_readdirplusargs
,
861 .pc_encode
= nfs3svc_encode_readdirres
,
862 .pc_release
= nfs3svc_release_fhandle
,
863 .pc_argsize
= sizeof(struct nfsd3_readdirplusargs
),
864 .pc_ressize
= sizeof(struct nfsd3_readdirres
),
865 .pc_cachetype
= RC_NOCACHE
,
867 [NFS3PROC_FSSTAT
] = {
868 .pc_func
= nfsd3_proc_fsstat
,
869 .pc_decode
= nfs3svc_decode_fhandleargs
,
870 .pc_encode
= nfs3svc_encode_fsstatres
,
871 .pc_argsize
= sizeof(struct nfsd3_fhandleargs
),
872 .pc_ressize
= sizeof(struct nfsd3_fsstatres
),
873 .pc_cachetype
= RC_NOCACHE
,
874 .pc_xdrressize
= ST
+pAT
+2*6+1,
876 [NFS3PROC_FSINFO
] = {
877 .pc_func
= nfsd3_proc_fsinfo
,
878 .pc_decode
= nfs3svc_decode_fhandleargs
,
879 .pc_encode
= nfs3svc_encode_fsinfores
,
880 .pc_argsize
= sizeof(struct nfsd3_fhandleargs
),
881 .pc_ressize
= sizeof(struct nfsd3_fsinfores
),
882 .pc_cachetype
= RC_NOCACHE
,
883 .pc_xdrressize
= ST
+pAT
+12,
885 [NFS3PROC_PATHCONF
] = {
886 .pc_func
= nfsd3_proc_pathconf
,
887 .pc_decode
= nfs3svc_decode_fhandleargs
,
888 .pc_encode
= nfs3svc_encode_pathconfres
,
889 .pc_argsize
= sizeof(struct nfsd3_fhandleargs
),
890 .pc_ressize
= sizeof(struct nfsd3_pathconfres
),
891 .pc_cachetype
= RC_NOCACHE
,
892 .pc_xdrressize
= ST
+pAT
+6,
894 [NFS3PROC_COMMIT
] = {
895 .pc_func
= nfsd3_proc_commit
,
896 .pc_decode
= nfs3svc_decode_commitargs
,
897 .pc_encode
= nfs3svc_encode_commitres
,
898 .pc_release
= nfs3svc_release_fhandle
,
899 .pc_argsize
= sizeof(struct nfsd3_commitargs
),
900 .pc_ressize
= sizeof(struct nfsd3_commitres
),
901 .pc_cachetype
= RC_NOCACHE
,
902 .pc_xdrressize
= ST
+WC
+2,
906 static unsigned int nfsd_count3
[ARRAY_SIZE(nfsd_procedures3
)];
907 const struct svc_version nfsd_version3
= {
910 .vs_proc
= nfsd_procedures3
,
911 .vs_dispatch
= nfsd_dispatch
,
912 .vs_count
= nfsd_count3
,
913 .vs_xdrsize
= NFS3_SVC_XDRSIZE
,