9 #include <linux/magic.h>
15 #define NFSDDBG_FACILITY NFSDDBG_PROC
17 #define RETURN_STATUS(st) { resp->status = (st); return (st); }
19 static int nfs3_ftypes[] = {
49 dprintk(
"nfsd: GETATTR(3) %s\n",
52 fh_copy(&resp->
fh, &argp->
fh);
59 resp->
fh.fh_dentry, &resp->
stat);
74 dprintk(
"nfsd: SETATTR(3) %s\n",
77 fh_copy(&resp->
fh, &argp->
fh);
92 dprintk(
"nfsd: LOOKUP(3) %s %.*s\n",
97 fh_copy(&resp->
dirfh, &argp->
fh);
116 dprintk(
"nfsd: ACCESS(3) %s 0x%x\n",
120 fh_copy(&resp->
fh, &argp->
fh);
122 nfserr = nfsd_access(rqstp, &resp->
fh, &resp->
access,
NULL);
138 fh_copy(&resp->
fh, &argp->
fh);
154 dprintk(
"nfsd: READ(3) %s %lu bytes at %Lu\n",
156 (
unsigned long) argp->
count,
157 (
unsigned long long) argp->
offset);
165 if (max_blocksize < resp->
count)
166 resp->
count = max_blocksize;
170 fh_copy(&resp->
fh, &argp->
fh);
192 unsigned long cnt = argp->
len;
194 dprintk(
"nfsd: WRITE(3) %s %d bytes at %Lu%s\n",
197 (
unsigned long long) argp->
offset,
198 argp->
stable?
" stable" :
"");
200 fh_copy(&resp->
fh, &argp->
fh);
224 dprintk(
"nfsd: CREATE(3) %s %.*s\n",
229 dirfhp = fh_copy(&resp->
dirfh, &argp->
fh);
248 nfserr = do_nfsd_create(rqstp, dirfhp, argp->
name, argp->
len,
264 dprintk(
"nfsd: MKDIR(3) %s %.*s\n",
270 fh_copy(&resp->
dirfh, &argp->
fh);
274 fh_unlock(&resp->
dirfh);
284 dprintk(
"nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
308 dprintk(
"nfsd: MKNOD(3) %s %.*s\n",
313 fh_copy(&resp->
dirfh, &argp->
fh);
327 type = nfs3_ftypes[argp->
ftype];
329 &argp->
attrs, type, rdev, &resp->
fh);
330 fh_unlock(&resp->
dirfh);
343 dprintk(
"nfsd: REMOVE(3) %s %.*s\n",
349 fh_copy(&resp->
fh, &argp->
fh);
351 fh_unlock(&resp->
fh);
364 dprintk(
"nfsd: RMDIR(3) %s %.*s\n",
369 fh_copy(&resp->
fh, &argp->
fh);
371 fh_unlock(&resp->
fh);
381 dprintk(
"nfsd: RENAME(3) %s %.*s ->\n",
390 fh_copy(&resp->
ffh, &argp->
ffh);
391 fh_copy(&resp->
tfh, &argp->
tfh);
403 dprintk(
"nfsd: LINK(3) %s ->\n",
410 fh_copy(&resp->
fh, &argp->
ffh);
411 fh_copy(&resp->
tfh, &argp->
tfh);
427 dprintk(
"nfsd: READDIR(3) %s %d bytes at %d\n",
433 count = (argp->
count >> 2) - 2;
436 fh_copy(&resp->
fh, &argp->
fh);
466 dprintk(
"nfsd: READDIR+(3) %s %d bytes at %d\n",
475 fh_copy(&resp->
fh, &argp->
fh);
497 resp->
count = count >> 2;
505 xdr_encode_hyper(resp->
offset, offset);
521 dprintk(
"nfsd: FSSTAT(3) %s\n",
539 dprintk(
"nfsd: FSINFO(3) %s\n",
581 dprintk(
"nfsd: PATHCONF(3) %s\n",
624 dprintk(
"nfsd: COMMIT(3) %s %u@%Lu\n",
627 (
unsigned long long) argp->
offset);
632 fh_copy(&resp->
fh, &argp->
fh);
633 nfserr = nfsd_commit(rqstp, &resp->
fh, argp->
offset, argp->
count);
643 #define nfs3svc_decode_fhandleargs nfs3svc_decode_fhandle
644 #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat
645 #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat
646 #define nfsd3_mkdirargs nfsd3_createargs
647 #define nfsd3_readdirplusargs nfsd3_readdirargs
648 #define nfsd3_fhandleargs nfsd_fhandle
649 #define nfsd3_fhandleres nfsd3_attrstat
650 #define nfsd3_attrstatres nfsd3_attrstat
651 #define nfsd3_wccstatres nfsd3_attrstat
652 #define nfsd3_createres nfsd3_diropres
653 #define nfsd3_voidres nfsd3_voidargs
656 #define PROC(name, argt, rest, relt, cache, respsize) \
657 { (svc_procfunc) nfsd3_proc_##name, \
658 (kxdrproc_t) nfs3svc_decode_##argt##args, \
659 (kxdrproc_t) nfs3svc_encode_##rest##res, \
660 (kxdrproc_t) nfs3svc_release_##relt, \
661 sizeof(struct nfsd3_##argt##args), \
662 sizeof(struct nfsd3_##rest##res), \
691 .pc_xdrressize =
ST+
AT,
701 .pc_xdrressize =
ST+
WC,
721 .pc_xdrressize =
ST+
pAT+1,
751 .pc_xdrressize =
ST+
WC+4,
801 .pc_xdrressize =
ST+
WC,
811 .pc_xdrressize =
ST+
WC,
821 .pc_xdrressize =
ST+
WC+
WC,
858 .pc_xdrressize =
ST+
pAT+2*6+1,
867 .pc_xdrressize =
ST+
pAT+12,
876 .pc_xdrressize =
ST+
pAT+6,
886 .pc_xdrressize =
ST+
WC+2,
893 .vs_proc = nfsd_procedures3,