aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4proc.c
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2006-10-20 02:28:59 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 13:26:42 -0400
commitb37ad28bcaa7c486a4ff0fb6c3bdaaacd67b86ce (patch)
tree17bb3677f3e63dc469b64a123a74cee0266768df /fs/nfsd/nfs4proc.c
parent6264d69d7df654ca64f625e9409189a0e50734e9 (diff)
[PATCH] nfsd: nfs4 code returns error values in net-endian
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no> Acked-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r--fs/nfsd/nfs4proc.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index ca6414248527..63823945f972 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -67,10 +67,10 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
67 *dst = *src; 67 *dst = *src;
68} 68}
69 69
70static int 70static __be32
71do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode) 71do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
72{ 72{
73 int status; 73 __be32 status;
74 74
75 if (open->op_truncate && 75 if (open->op_truncate &&
76 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) 76 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
@@ -88,11 +88,11 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
88 return status; 88 return status;
89} 89}
90 90
91static int 91static __be32
92do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 92do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
93{ 93{
94 struct svc_fh resfh; 94 struct svc_fh resfh;
95 int status; 95 __be32 status;
96 96
97 fh_init(&resfh, NFS4_FHSIZE); 97 fh_init(&resfh, NFS4_FHSIZE);
98 open->op_truncate = 0; 98 open->op_truncate = 0;
@@ -131,10 +131,10 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
131 return status; 131 return status;
132} 132}
133 133
134static int 134static __be32
135do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 135do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
136{ 136{
137 int status; 137 __be32 status;
138 138
139 /* Only reclaims from previously confirmed clients are valid */ 139 /* Only reclaims from previously confirmed clients are valid */
140 if ((status = nfs4_check_open_reclaim(&open->op_clientid))) 140 if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
@@ -161,10 +161,10 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
161} 161}
162 162
163 163
164static inline int 164static inline __be32
165nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) 165nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner)
166{ 166{
167 int status; 167 __be32 status;
168 dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", 168 dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
169 (int)open->op_fname.len, open->op_fname.data, 169 (int)open->op_fname.len, open->op_fname.data,
170 open->op_stateowner); 170 open->op_stateowner);
@@ -261,7 +261,7 @@ out:
261/* 261/*
262 * filehandle-manipulating ops. 262 * filehandle-manipulating ops.
263 */ 263 */
264static inline int 264static inline __be32
265nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) 265nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh)
266{ 266{
267 if (!current_fh->fh_dentry) 267 if (!current_fh->fh_dentry)
@@ -271,7 +271,7 @@ nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh)
271 return nfs_ok; 271 return nfs_ok;
272} 272}
273 273
274static inline int 274static inline __be32
275nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh) 275nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh)
276{ 276{
277 fh_put(current_fh); 277 fh_put(current_fh);
@@ -280,10 +280,10 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putf
280 return fh_verify(rqstp, current_fh, 0, MAY_NOP); 280 return fh_verify(rqstp, current_fh, 0, MAY_NOP);
281} 281}
282 282
283static inline int 283static inline __be32
284nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) 284nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
285{ 285{
286 int status; 286 __be32 status;
287 287
288 fh_put(current_fh); 288 fh_put(current_fh);
289 status = exp_pseudoroot(rqstp->rq_client, current_fh, 289 status = exp_pseudoroot(rqstp->rq_client, current_fh,
@@ -291,7 +291,7 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
291 return status; 291 return status;
292} 292}
293 293
294static inline int 294static inline __be32
295nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) 295nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
296{ 296{
297 if (!save_fh->fh_dentry) 297 if (!save_fh->fh_dentry)
@@ -301,7 +301,7 @@ nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
301 return nfs_ok; 301 return nfs_ok;
302} 302}
303 303
304static inline int 304static inline __be32
305nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) 305nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
306{ 306{
307 if (!current_fh->fh_dentry) 307 if (!current_fh->fh_dentry)
@@ -314,7 +314,7 @@ nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
314/* 314/*
315 * misc nfsv4 ops 315 * misc nfsv4 ops
316 */ 316 */
317static inline int 317static inline __be32
318nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access) 318nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access)
319{ 319{
320 if (access->ac_req_access & ~NFS3_ACCESS_FULL) 320 if (access->ac_req_access & ~NFS3_ACCESS_FULL)
@@ -324,10 +324,10 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc
324 return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported); 324 return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported);
325} 325}
326 326
327static inline int 327static inline __be32
328nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) 328nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit)
329{ 329{
330 int status; 330 __be32 status;
331 331
332 u32 *p = (u32 *)commit->co_verf.data; 332 u32 *p = (u32 *)commit->co_verf.data;
333 *p++ = nfssvc_boot.tv_sec; 333 *p++ = nfssvc_boot.tv_sec;
@@ -339,11 +339,11 @@ nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_com
339 return status; 339 return status;
340} 340}
341 341
342static int 342static __be32
343nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create) 343nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create)
344{ 344{
345 struct svc_fh resfh; 345 struct svc_fh resfh;
346 int status; 346 __be32 status;
347 dev_t rdev; 347 dev_t rdev;
348 348
349 fh_init(&resfh, NFS4_FHSIZE); 349 fh_init(&resfh, NFS4_FHSIZE);
@@ -423,10 +423,10 @@ nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_cre
423 return status; 423 return status;
424} 424}
425 425
426static inline int 426static inline __be32
427nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr) 427nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr)
428{ 428{
429 int status; 429 __be32 status;
430 430
431 status = fh_verify(rqstp, current_fh, 0, MAY_NOP); 431 status = fh_verify(rqstp, current_fh, 0, MAY_NOP);
432 if (status) 432 if (status)
@@ -442,11 +442,11 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ge
442 return nfs_ok; 442 return nfs_ok;
443} 443}
444 444
445static inline int 445static inline __be32
446nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, 446nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh,
447 struct svc_fh *save_fh, struct nfsd4_link *link) 447 struct svc_fh *save_fh, struct nfsd4_link *link)
448{ 448{
449 int status = nfserr_nofilehandle; 449 __be32 status = nfserr_nofilehandle;
450 450
451 if (!save_fh->fh_dentry) 451 if (!save_fh->fh_dentry)
452 return status; 452 return status;
@@ -456,11 +456,11 @@ nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh,
456 return status; 456 return status;
457} 457}
458 458
459static int 459static __be32
460nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) 460nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh)
461{ 461{
462 struct svc_fh tmp_fh; 462 struct svc_fh tmp_fh;
463 int ret; 463 __be32 ret;
464 464
465 fh_init(&tmp_fh, NFS4_FHSIZE); 465 fh_init(&tmp_fh, NFS4_FHSIZE);
466 if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh, 466 if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh,
@@ -474,16 +474,16 @@ nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh)
474 return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh); 474 return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh);
475} 475}
476 476
477static inline int 477static inline __be32
478nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup) 478nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup)
479{ 479{
480 return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh); 480 return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh);
481} 481}
482 482
483static inline int 483static inline __be32
484nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read) 484nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read)
485{ 485{
486 int status; 486 __be32 status;
487 487
488 /* no need to check permission - this will be done in nfsd_read() */ 488 /* no need to check permission - this will be done in nfsd_read() */
489 489
@@ -508,7 +508,7 @@ out:
508 return status; 508 return status;
509} 509}
510 510
511static inline int 511static inline __be32
512nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir) 512nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir)
513{ 513{
514 u64 cookie = readdir->rd_cookie; 514 u64 cookie = readdir->rd_cookie;
@@ -531,7 +531,7 @@ nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_re
531 return nfs_ok; 531 return nfs_ok;
532} 532}
533 533
534static inline int 534static inline __be32
535nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink) 535nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink)
536{ 536{
537 readlink->rl_rqstp = rqstp; 537 readlink->rl_rqstp = rqstp;
@@ -539,10 +539,10 @@ nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_r
539 return nfs_ok; 539 return nfs_ok;
540} 540}
541 541
542static inline int 542static inline __be32
543nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove) 543nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove)
544{ 544{
545 int status; 545 __be32 status;
546 546
547 if (nfs4_in_grace()) 547 if (nfs4_in_grace())
548 return nfserr_grace; 548 return nfserr_grace;
@@ -556,11 +556,11 @@ nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_rem
556 return status; 556 return status;
557} 557}
558 558
559static inline int 559static inline __be32
560nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, 560nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh,
561 struct svc_fh *save_fh, struct nfsd4_rename *rename) 561 struct svc_fh *save_fh, struct nfsd4_rename *rename)
562{ 562{
563 int status = nfserr_nofilehandle; 563 __be32 status = nfserr_nofilehandle;
564 564
565 if (!save_fh->fh_dentry) 565 if (!save_fh->fh_dentry)
566 return status; 566 return status;
@@ -589,10 +589,10 @@ nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh,
589 return status; 589 return status;
590} 590}
591 591
592static inline int 592static inline __be32
593nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr) 593nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr)
594{ 594{
595 int status = nfs_ok; 595 __be32 status = nfs_ok;
596 596
597 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 597 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
598 nfs4_lock_state(); 598 nfs4_lock_state();
@@ -614,13 +614,13 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se
614 return status; 614 return status;
615} 615}
616 616
617static inline int 617static inline __be32
618nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write) 618nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write)
619{ 619{
620 stateid_t *stateid = &write->wr_stateid; 620 stateid_t *stateid = &write->wr_stateid;
621 struct file *filp = NULL; 621 struct file *filp = NULL;
622 u32 *p; 622 u32 *p;
623 int status = nfs_ok; 623 __be32 status = nfs_ok;
624 624
625 /* no need to check permission - this will be done in nfsd_write() */ 625 /* no need to check permission - this will be done in nfsd_write() */
626 626
@@ -661,12 +661,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
661 * attributes matched. VERIFY is implemented by mapping NFSERR_SAME 661 * attributes matched. VERIFY is implemented by mapping NFSERR_SAME
662 * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK. 662 * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK.
663 */ 663 */
664static int 664static __be32
665nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify) 665nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify)
666{ 666{
667 __be32 *buf, *p; 667 __be32 *buf, *p;
668 int count; 668 int count;
669 int status; 669 __be32 status;
670 670
671 status = fh_verify(rqstp, current_fh, 0, MAY_NOP); 671 status = fh_verify(rqstp, current_fh, 0, MAY_NOP);
672 if (status) 672 if (status)
@@ -741,7 +741,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
741 struct svc_fh *save_fh = NULL; 741 struct svc_fh *save_fh = NULL;
742 struct nfs4_stateowner *replay_owner = NULL; 742 struct nfs4_stateowner *replay_owner = NULL;
743 int slack_space; /* in words, not bytes! */ 743 int slack_space; /* in words, not bytes! */
744 int status; 744 __be32 status;
745 745
746 status = nfserr_resource; 746 status = nfserr_resource;
747 current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL); 747 current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL);