diff options
Diffstat (limited to 'fs/nfsd/nfsproc.c')
-rw-r--r-- | fs/nfsd/nfsproc.c | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 9ee1dab5d44a..ec983b777680 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -30,22 +30,22 @@ typedef struct svc_buf svc_buf; | |||
30 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 30 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
31 | 31 | ||
32 | 32 | ||
33 | static int | 33 | static __be32 |
34 | nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | 34 | nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) |
35 | { | 35 | { |
36 | return nfs_ok; | 36 | return nfs_ok; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int | 39 | static __be32 |
40 | nfsd_return_attrs(int err, struct nfsd_attrstat *resp) | 40 | nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) |
41 | { | 41 | { |
42 | if (err) return err; | 42 | if (err) return err; |
43 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, | 43 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, |
44 | resp->fh.fh_dentry, | 44 | resp->fh.fh_dentry, |
45 | &resp->stat)); | 45 | &resp->stat)); |
46 | } | 46 | } |
47 | static int | 47 | static __be32 |
48 | nfsd_return_dirop(int err, struct nfsd_diropres *resp) | 48 | nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) |
49 | { | 49 | { |
50 | if (err) return err; | 50 | if (err) return err; |
51 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, | 51 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, |
@@ -56,11 +56,11 @@ nfsd_return_dirop(int err, struct nfsd_diropres *resp) | |||
56 | * Get a file's attributes | 56 | * Get a file's attributes |
57 | * N.B. After this call resp->fh needs an fh_put | 57 | * N.B. After this call resp->fh needs an fh_put |
58 | */ | 58 | */ |
59 | static int | 59 | static __be32 |
60 | nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | 60 | nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, |
61 | struct nfsd_attrstat *resp) | 61 | struct nfsd_attrstat *resp) |
62 | { | 62 | { |
63 | int nfserr; | 63 | __be32 nfserr; |
64 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); | 64 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); |
65 | 65 | ||
66 | fh_copy(&resp->fh, &argp->fh); | 66 | fh_copy(&resp->fh, &argp->fh); |
@@ -72,11 +72,11 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | |||
72 | * Set a file's attributes | 72 | * Set a file's attributes |
73 | * N.B. After this call resp->fh needs an fh_put | 73 | * N.B. After this call resp->fh needs an fh_put |
74 | */ | 74 | */ |
75 | static int | 75 | static __be32 |
76 | nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, | 76 | nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, |
77 | struct nfsd_attrstat *resp) | 77 | struct nfsd_attrstat *resp) |
78 | { | 78 | { |
79 | int nfserr; | 79 | __be32 nfserr; |
80 | dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", | 80 | dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", |
81 | SVCFH_fmt(&argp->fh), | 81 | SVCFH_fmt(&argp->fh), |
82 | argp->attrs.ia_valid, (long) argp->attrs.ia_size); | 82 | argp->attrs.ia_valid, (long) argp->attrs.ia_size); |
@@ -92,11 +92,11 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, | |||
92 | * doesn't exist yet. | 92 | * doesn't exist yet. |
93 | * N.B. After this call resp->fh needs an fh_put | 93 | * N.B. After this call resp->fh needs an fh_put |
94 | */ | 94 | */ |
95 | static int | 95 | static __be32 |
96 | nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | 96 | nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, |
97 | struct nfsd_diropres *resp) | 97 | struct nfsd_diropres *resp) |
98 | { | 98 | { |
99 | int nfserr; | 99 | __be32 nfserr; |
100 | 100 | ||
101 | dprintk("nfsd: LOOKUP %s %.*s\n", | 101 | dprintk("nfsd: LOOKUP %s %.*s\n", |
102 | SVCFH_fmt(&argp->fh), argp->len, argp->name); | 102 | SVCFH_fmt(&argp->fh), argp->len, argp->name); |
@@ -112,11 +112,11 @@ nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | |||
112 | /* | 112 | /* |
113 | * Read a symlink. | 113 | * Read a symlink. |
114 | */ | 114 | */ |
115 | static int | 115 | static __be32 |
116 | nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, | 116 | nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, |
117 | struct nfsd_readlinkres *resp) | 117 | struct nfsd_readlinkres *resp) |
118 | { | 118 | { |
119 | int nfserr; | 119 | __be32 nfserr; |
120 | 120 | ||
121 | dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh)); | 121 | dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh)); |
122 | 122 | ||
@@ -132,11 +132,11 @@ nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, | |||
132 | * Read a portion of a file. | 132 | * Read a portion of a file. |
133 | * N.B. After this call resp->fh needs an fh_put | 133 | * N.B. After this call resp->fh needs an fh_put |
134 | */ | 134 | */ |
135 | static int | 135 | static __be32 |
136 | nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, | 136 | nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, |
137 | struct nfsd_readres *resp) | 137 | struct nfsd_readres *resp) |
138 | { | 138 | { |
139 | int nfserr; | 139 | __be32 nfserr; |
140 | 140 | ||
141 | dprintk("nfsd: READ %s %d bytes at %d\n", | 141 | dprintk("nfsd: READ %s %d bytes at %d\n", |
142 | SVCFH_fmt(&argp->fh), | 142 | SVCFH_fmt(&argp->fh), |
@@ -172,11 +172,11 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, | |||
172 | * Write data to a file | 172 | * Write data to a file |
173 | * N.B. After this call resp->fh needs an fh_put | 173 | * N.B. After this call resp->fh needs an fh_put |
174 | */ | 174 | */ |
175 | static int | 175 | static __be32 |
176 | nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, | 176 | nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, |
177 | struct nfsd_attrstat *resp) | 177 | struct nfsd_attrstat *resp) |
178 | { | 178 | { |
179 | int nfserr; | 179 | __be32 nfserr; |
180 | int stable = 1; | 180 | int stable = 1; |
181 | 181 | ||
182 | dprintk("nfsd: WRITE %s %d bytes at %d\n", | 182 | dprintk("nfsd: WRITE %s %d bytes at %d\n", |
@@ -197,7 +197,7 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, | |||
197 | * and the actual create() call in compliance with VFS protocols. | 197 | * and the actual create() call in compliance with VFS protocols. |
198 | * N.B. After this call _both_ argp->fh and resp->fh need an fh_put | 198 | * N.B. After this call _both_ argp->fh and resp->fh need an fh_put |
199 | */ | 199 | */ |
200 | static int | 200 | static __be32 |
201 | nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | 201 | nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, |
202 | struct nfsd_diropres *resp) | 202 | struct nfsd_diropres *resp) |
203 | { | 203 | { |
@@ -206,7 +206,8 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
206 | struct iattr *attr = &argp->attrs; | 206 | struct iattr *attr = &argp->attrs; |
207 | struct inode *inode; | 207 | struct inode *inode; |
208 | struct dentry *dchild; | 208 | struct dentry *dchild; |
209 | int nfserr, type, mode; | 209 | int type, mode; |
210 | __be32 nfserr; | ||
210 | dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size); | 211 | dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size); |
211 | 212 | ||
212 | dprintk("nfsd: CREATE %s %.*s\n", | 213 | dprintk("nfsd: CREATE %s %.*s\n", |
@@ -348,11 +349,11 @@ done: | |||
348 | return nfsd_return_dirop(nfserr, resp); | 349 | return nfsd_return_dirop(nfserr, resp); |
349 | } | 350 | } |
350 | 351 | ||
351 | static int | 352 | static __be32 |
352 | nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | 353 | nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, |
353 | void *resp) | 354 | void *resp) |
354 | { | 355 | { |
355 | int nfserr; | 356 | __be32 nfserr; |
356 | 357 | ||
357 | dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh), | 358 | dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh), |
358 | argp->len, argp->name); | 359 | argp->len, argp->name); |
@@ -363,11 +364,11 @@ nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | |||
363 | return nfserr; | 364 | return nfserr; |
364 | } | 365 | } |
365 | 366 | ||
366 | static int | 367 | static __be32 |
367 | nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, | 368 | nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, |
368 | void *resp) | 369 | void *resp) |
369 | { | 370 | { |
370 | int nfserr; | 371 | __be32 nfserr; |
371 | 372 | ||
372 | dprintk("nfsd: RENAME %s %.*s -> \n", | 373 | dprintk("nfsd: RENAME %s %.*s -> \n", |
373 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname); | 374 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname); |
@@ -381,11 +382,11 @@ nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, | |||
381 | return nfserr; | 382 | return nfserr; |
382 | } | 383 | } |
383 | 384 | ||
384 | static int | 385 | static __be32 |
385 | nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, | 386 | nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, |
386 | void *resp) | 387 | void *resp) |
387 | { | 388 | { |
388 | int nfserr; | 389 | __be32 nfserr; |
389 | 390 | ||
390 | dprintk("nfsd: LINK %s ->\n", | 391 | dprintk("nfsd: LINK %s ->\n", |
391 | SVCFH_fmt(&argp->ffh)); | 392 | SVCFH_fmt(&argp->ffh)); |
@@ -401,12 +402,12 @@ nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, | |||
401 | return nfserr; | 402 | return nfserr; |
402 | } | 403 | } |
403 | 404 | ||
404 | static int | 405 | static __be32 |
405 | nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, | 406 | nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, |
406 | void *resp) | 407 | void *resp) |
407 | { | 408 | { |
408 | struct svc_fh newfh; | 409 | struct svc_fh newfh; |
409 | int nfserr; | 410 | __be32 nfserr; |
410 | 411 | ||
411 | dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n", | 412 | dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n", |
412 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname, | 413 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname, |
@@ -430,11 +431,11 @@ nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, | |||
430 | * Make directory. This operation is not idempotent. | 431 | * Make directory. This operation is not idempotent. |
431 | * N.B. After this call resp->fh needs an fh_put | 432 | * N.B. After this call resp->fh needs an fh_put |
432 | */ | 433 | */ |
433 | static int | 434 | static __be32 |
434 | nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | 435 | nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, |
435 | struct nfsd_diropres *resp) | 436 | struct nfsd_diropres *resp) |
436 | { | 437 | { |
437 | int nfserr; | 438 | __be32 nfserr; |
438 | 439 | ||
439 | dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); | 440 | dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); |
440 | 441 | ||
@@ -454,11 +455,11 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
454 | /* | 455 | /* |
455 | * Remove a directory | 456 | * Remove a directory |
456 | */ | 457 | */ |
457 | static int | 458 | static __be32 |
458 | nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | 459 | nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, |
459 | void *resp) | 460 | void *resp) |
460 | { | 461 | { |
461 | int nfserr; | 462 | __be32 nfserr; |
462 | 463 | ||
463 | dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); | 464 | dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); |
464 | 465 | ||
@@ -470,11 +471,12 @@ nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | |||
470 | /* | 471 | /* |
471 | * Read a portion of a directory. | 472 | * Read a portion of a directory. |
472 | */ | 473 | */ |
473 | static int | 474 | static __be32 |
474 | nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, | 475 | nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, |
475 | struct nfsd_readdirres *resp) | 476 | struct nfsd_readdirres *resp) |
476 | { | 477 | { |
477 | int nfserr, count; | 478 | int count; |
479 | __be32 nfserr; | ||
478 | loff_t offset; | 480 | loff_t offset; |
479 | 481 | ||
480 | dprintk("nfsd: READDIR %s %d bytes at %d\n", | 482 | dprintk("nfsd: READDIR %s %d bytes at %d\n", |
@@ -509,11 +511,11 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, | |||
509 | /* | 511 | /* |
510 | * Get file system info | 512 | * Get file system info |
511 | */ | 513 | */ |
512 | static int | 514 | static __be32 |
513 | nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | 515 | nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, |
514 | struct nfsd_statfsres *resp) | 516 | struct nfsd_statfsres *resp) |
515 | { | 517 | { |
516 | int nfserr; | 518 | __be32 nfserr; |
517 | 519 | ||
518 | dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); | 520 | dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); |
519 | 521 | ||
@@ -579,11 +581,11 @@ struct svc_version nfsd_version2 = { | |||
579 | /* | 581 | /* |
580 | * Map errnos to NFS errnos. | 582 | * Map errnos to NFS errnos. |
581 | */ | 583 | */ |
582 | int | 584 | __be32 |
583 | nfserrno (int errno) | 585 | nfserrno (int errno) |
584 | { | 586 | { |
585 | static struct { | 587 | static struct { |
586 | int nfserr; | 588 | __be32 nfserr; |
587 | int syserr; | 589 | int syserr; |
588 | } nfs_errtbl[] = { | 590 | } nfs_errtbl[] = { |
589 | { nfs_ok, 0 }, | 591 | { nfs_ok, 0 }, |
@@ -615,11 +617,10 @@ nfserrno (int errno) | |||
615 | { nfserr_badname, -ESRCH }, | 617 | { nfserr_badname, -ESRCH }, |
616 | { nfserr_io, -ETXTBSY }, | 618 | { nfserr_io, -ETXTBSY }, |
617 | { nfserr_notsupp, -EOPNOTSUPP }, | 619 | { nfserr_notsupp, -EOPNOTSUPP }, |
618 | { -1, -EIO } | ||
619 | }; | 620 | }; |
620 | int i; | 621 | int i; |
621 | 622 | ||
622 | for (i = 0; nfs_errtbl[i].nfserr != -1; i++) { | 623 | for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) { |
623 | if (nfs_errtbl[i].syserr == errno) | 624 | if (nfs_errtbl[i].syserr == errno) |
624 | return nfs_errtbl[i].nfserr; | 625 | return nfs_errtbl[i].nfserr; |
625 | } | 626 | } |