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