aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c273
1 files changed, 138 insertions, 135 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 41fc241b729..f3f239db04b 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -68,8 +68,8 @@
68#define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL 68#define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL
69#define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL 69#define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL
70 70
71static int 71static __be32
72check_filename(char *str, int len, int err) 72check_filename(char *str, int len, __be32 err)
73{ 73{
74 int i; 74 int i;
75 75
@@ -94,8 +94,8 @@ check_filename(char *str, int len, int err)
94 * consistent with the style used in NFSv2/v3... 94 * consistent with the style used in NFSv2/v3...
95 */ 95 */
96#define DECODE_HEAD \ 96#define DECODE_HEAD \
97 u32 *p; \ 97 __be32 *p; \
98 int status 98 __be32 status
99#define DECODE_TAIL \ 99#define DECODE_TAIL \
100 status = 0; \ 100 status = 0; \
101out: \ 101out: \
@@ -144,13 +144,13 @@ xdr_error: \
144 } \ 144 } \
145} while (0) 145} while (0)
146 146
147static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) 147static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
148{ 148{
149 /* We want more bytes than seem to be available. 149 /* We want more bytes than seem to be available.
150 * Maybe we need a new page, maybe we have just run out 150 * Maybe we need a new page, maybe we have just run out
151 */ 151 */
152 int avail = (char*)argp->end - (char*)argp->p; 152 int avail = (char*)argp->end - (char*)argp->p;
153 u32 *p; 153 __be32 *p;
154 if (avail + argp->pagelen < nbytes) 154 if (avail + argp->pagelen < nbytes)
155 return NULL; 155 return NULL;
156 if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */ 156 if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */
@@ -197,7 +197,7 @@ defer_free(struct nfsd4_compoundargs *argp,
197 return 0; 197 return 0;
198} 198}
199 199
200static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes) 200static char *savemem(struct nfsd4_compoundargs *argp, __be32 *p, int nbytes)
201{ 201{
202 void *new = NULL; 202 void *new = NULL;
203 if (p == argp->tmp) { 203 if (p == argp->tmp) {
@@ -217,7 +217,7 @@ static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes)
217} 217}
218 218
219 219
220static int 220static __be32
221nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) 221nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
222{ 222{
223 u32 bmlen; 223 u32 bmlen;
@@ -240,13 +240,14 @@ nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
240 DECODE_TAIL; 240 DECODE_TAIL;
241} 241}
242 242
243static int 243static __be32
244nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr, 244nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr,
245 struct nfs4_acl **acl) 245 struct nfs4_acl **acl)
246{ 246{
247 int expected_len, len = 0; 247 int expected_len, len = 0;
248 u32 dummy32; 248 u32 dummy32;
249 char *buf; 249 char *buf;
250 int host_err;
250 251
251 DECODE_HEAD; 252 DECODE_HEAD;
252 iattr->ia_valid = 0; 253 iattr->ia_valid = 0;
@@ -280,7 +281,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
280 281
281 *acl = nfs4_acl_new(); 282 *acl = nfs4_acl_new();
282 if (*acl == NULL) { 283 if (*acl == NULL) {
283 status = -ENOMEM; 284 host_err = -ENOMEM;
284 goto out_nfserr; 285 goto out_nfserr;
285 } 286 }
286 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl); 287 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl);
@@ -295,20 +296,20 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
295 len += XDR_QUADLEN(dummy32) << 2; 296 len += XDR_QUADLEN(dummy32) << 2;
296 READMEM(buf, dummy32); 297 READMEM(buf, dummy32);
297 ace.whotype = nfs4_acl_get_whotype(buf, dummy32); 298 ace.whotype = nfs4_acl_get_whotype(buf, dummy32);
298 status = 0; 299 host_err = 0;
299 if (ace.whotype != NFS4_ACL_WHO_NAMED) 300 if (ace.whotype != NFS4_ACL_WHO_NAMED)
300 ace.who = 0; 301 ace.who = 0;
301 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP) 302 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP)
302 status = nfsd_map_name_to_gid(argp->rqstp, 303 host_err = nfsd_map_name_to_gid(argp->rqstp,
303 buf, dummy32, &ace.who); 304 buf, dummy32, &ace.who);
304 else 305 else
305 status = nfsd_map_name_to_uid(argp->rqstp, 306 host_err = nfsd_map_name_to_uid(argp->rqstp,
306 buf, dummy32, &ace.who); 307 buf, dummy32, &ace.who);
307 if (status) 308 if (host_err)
308 goto out_nfserr; 309 goto out_nfserr;
309 status = nfs4_acl_add_ace(*acl, ace.type, ace.flag, 310 host_err = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
310 ace.access_mask, ace.whotype, ace.who); 311 ace.access_mask, ace.whotype, ace.who);
311 if (status) 312 if (host_err)
312 goto out_nfserr; 313 goto out_nfserr;
313 } 314 }
314 } else 315 } else
@@ -327,7 +328,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
327 READ_BUF(dummy32); 328 READ_BUF(dummy32);
328 len += (XDR_QUADLEN(dummy32) << 2); 329 len += (XDR_QUADLEN(dummy32) << 2);
329 READMEM(buf, dummy32); 330 READMEM(buf, dummy32);
330 if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) 331 if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
331 goto out_nfserr; 332 goto out_nfserr;
332 iattr->ia_valid |= ATTR_UID; 333 iattr->ia_valid |= ATTR_UID;
333 } 334 }
@@ -338,7 +339,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
338 READ_BUF(dummy32); 339 READ_BUF(dummy32);
339 len += (XDR_QUADLEN(dummy32) << 2); 340 len += (XDR_QUADLEN(dummy32) << 2);
340 READMEM(buf, dummy32); 341 READMEM(buf, dummy32);
341 if ((status = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid))) 342 if ((host_err = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
342 goto out_nfserr; 343 goto out_nfserr;
343 iattr->ia_valid |= ATTR_GID; 344 iattr->ia_valid |= ATTR_GID;
344 } 345 }
@@ -414,11 +415,11 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
414 DECODE_TAIL; 415 DECODE_TAIL;
415 416
416out_nfserr: 417out_nfserr:
417 status = nfserrno(status); 418 status = nfserrno(host_err);
418 goto out; 419 goto out;
419} 420}
420 421
421static int 422static __be32
422nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access) 423nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access)
423{ 424{
424 DECODE_HEAD; 425 DECODE_HEAD;
@@ -429,7 +430,7 @@ nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access
429 DECODE_TAIL; 430 DECODE_TAIL;
430} 431}
431 432
432static int 433static __be32
433nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) 434nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
434{ 435{
435 DECODE_HEAD; 436 DECODE_HEAD;
@@ -444,7 +445,7 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
444} 445}
445 446
446 447
447static int 448static __be32
448nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit) 449nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit)
449{ 450{
450 DECODE_HEAD; 451 DECODE_HEAD;
@@ -456,7 +457,7 @@ nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit
456 DECODE_TAIL; 457 DECODE_TAIL;
457} 458}
458 459
459static int 460static __be32
460nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) 461nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create)
461{ 462{
462 DECODE_HEAD; 463 DECODE_HEAD;
@@ -496,7 +497,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
496 DECODE_TAIL; 497 DECODE_TAIL;
497} 498}
498 499
499static inline int 500static inline __be32
500nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr) 501nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr)
501{ 502{
502 DECODE_HEAD; 503 DECODE_HEAD;
@@ -508,13 +509,13 @@ nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegretu
508 DECODE_TAIL; 509 DECODE_TAIL;
509} 510}
510 511
511static inline int 512static inline __be32
512nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr) 513nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr)
513{ 514{
514 return nfsd4_decode_bitmap(argp, getattr->ga_bmval); 515 return nfsd4_decode_bitmap(argp, getattr->ga_bmval);
515} 516}
516 517
517static int 518static __be32
518nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link) 519nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
519{ 520{
520 DECODE_HEAD; 521 DECODE_HEAD;
@@ -529,7 +530,7 @@ nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
529 DECODE_TAIL; 530 DECODE_TAIL;
530} 531}
531 532
532static int 533static __be32
533nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock) 534nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
534{ 535{
535 DECODE_HEAD; 536 DECODE_HEAD;
@@ -568,7 +569,7 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
568 DECODE_TAIL; 569 DECODE_TAIL;
569} 570}
570 571
571static int 572static __be32
572nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt) 573nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
573{ 574{
574 DECODE_HEAD; 575 DECODE_HEAD;
@@ -587,7 +588,7 @@ nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
587 DECODE_TAIL; 588 DECODE_TAIL;
588} 589}
589 590
590static int 591static __be32
591nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku) 592nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
592{ 593{
593 DECODE_HEAD; 594 DECODE_HEAD;
@@ -606,7 +607,7 @@ nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
606 DECODE_TAIL; 607 DECODE_TAIL;
607} 608}
608 609
609static int 610static __be32
610nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup) 611nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup)
611{ 612{
612 DECODE_HEAD; 613 DECODE_HEAD;
@@ -621,7 +622,7 @@ nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup
621 DECODE_TAIL; 622 DECODE_TAIL;
622} 623}
623 624
624static int 625static __be32
625nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) 626nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
626{ 627{
627 DECODE_HEAD; 628 DECODE_HEAD;
@@ -699,7 +700,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
699 DECODE_TAIL; 700 DECODE_TAIL;
700} 701}
701 702
702static int 703static __be32
703nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf) 704nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf)
704{ 705{
705 DECODE_HEAD; 706 DECODE_HEAD;
@@ -713,7 +714,7 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con
713 DECODE_TAIL; 714 DECODE_TAIL;
714} 715}
715 716
716static int 717static __be32
717nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down) 718nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down)
718{ 719{
719 DECODE_HEAD; 720 DECODE_HEAD;
@@ -729,7 +730,7 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d
729 DECODE_TAIL; 730 DECODE_TAIL;
730} 731}
731 732
732static int 733static __be32
733nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh) 734nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh)
734{ 735{
735 DECODE_HEAD; 736 DECODE_HEAD;
@@ -744,7 +745,7 @@ nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh)
744 DECODE_TAIL; 745 DECODE_TAIL;
745} 746}
746 747
747static int 748static __be32
748nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read) 749nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
749{ 750{
750 DECODE_HEAD; 751 DECODE_HEAD;
@@ -758,7 +759,7 @@ nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
758 DECODE_TAIL; 759 DECODE_TAIL;
759} 760}
760 761
761static int 762static __be32
762nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir) 763nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir)
763{ 764{
764 DECODE_HEAD; 765 DECODE_HEAD;
@@ -774,7 +775,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read
774 DECODE_TAIL; 775 DECODE_TAIL;
775} 776}
776 777
777static int 778static __be32
778nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove) 779nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove)
779{ 780{
780 DECODE_HEAD; 781 DECODE_HEAD;
@@ -789,7 +790,7 @@ nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove
789 DECODE_TAIL; 790 DECODE_TAIL;
790} 791}
791 792
792static int 793static __be32
793nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename) 794nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename)
794{ 795{
795 DECODE_HEAD; 796 DECODE_HEAD;
@@ -809,7 +810,7 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename
809 DECODE_TAIL; 810 DECODE_TAIL;
810} 811}
811 812
812static int 813static __be32
813nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid) 814nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
814{ 815{
815 DECODE_HEAD; 816 DECODE_HEAD;
@@ -820,7 +821,7 @@ nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
820 DECODE_TAIL; 821 DECODE_TAIL;
821} 822}
822 823
823static int 824static __be32
824nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr) 825nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
825{ 826{
826 DECODE_HEAD; 827 DECODE_HEAD;
@@ -834,7 +835,7 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta
834 DECODE_TAIL; 835 DECODE_TAIL;
835} 836}
836 837
837static int 838static __be32
838nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid) 839nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid)
839{ 840{
840 DECODE_HEAD; 841 DECODE_HEAD;
@@ -859,7 +860,7 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient
859 DECODE_TAIL; 860 DECODE_TAIL;
860} 861}
861 862
862static int 863static __be32
863nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c) 864nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c)
864{ 865{
865 DECODE_HEAD; 866 DECODE_HEAD;
@@ -872,7 +873,7 @@ nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_s
872} 873}
873 874
874/* Also used for NVERIFY */ 875/* Also used for NVERIFY */
875static int 876static __be32
876nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify) 877nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify)
877{ 878{
878#if 0 879#if 0
@@ -908,7 +909,7 @@ nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify
908 DECODE_TAIL; 909 DECODE_TAIL;
909} 910}
910 911
911static int 912static __be32
912nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) 913nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
913{ 914{
914 int avail; 915 int avail;
@@ -951,15 +952,15 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
951 argp->pagelen -= len; 952 argp->pagelen -= len;
952 } 953 }
953 } 954 }
954 argp->end = (u32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); 955 argp->end = (__be32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len);
955 argp->p = (u32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); 956 argp->p = (__be32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2));
956 argp->rqstp->rq_vec[v].iov_len = len; 957 argp->rqstp->rq_vec[v].iov_len = len;
957 write->wr_vlen = v+1; 958 write->wr_vlen = v+1;
958 959
959 DECODE_TAIL; 960 DECODE_TAIL;
960} 961}
961 962
962static int 963static __be32
963nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner) 964nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner)
964{ 965{
965 DECODE_HEAD; 966 DECODE_HEAD;
@@ -973,7 +974,7 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel
973 DECODE_TAIL; 974 DECODE_TAIL;
974} 975}
975 976
976static int 977static __be32
977nfsd4_decode_compound(struct nfsd4_compoundargs *argp) 978nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
978{ 979{
979 DECODE_HEAD; 980 DECODE_HEAD;
@@ -1179,7 +1180,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1179 * task to translate them into Linux-specific versions which are more 1180 * task to translate them into Linux-specific versions which are more
1180 * consistent with the style used in NFSv2/v3... 1181 * consistent with the style used in NFSv2/v3...
1181 */ 1182 */
1182#define ENCODE_HEAD u32 *p 1183#define ENCODE_HEAD __be32 *p
1183 1184
1184#define WRITE32(n) *p++ = htonl(n) 1185#define WRITE32(n) *p++ = htonl(n)
1185#define WRITE64(n) do { \ 1186#define WRITE64(n) do { \
@@ -1209,8 +1210,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1209 * Header routine to setup seqid operation replay cache 1210 * Header routine to setup seqid operation replay cache
1210 */ 1211 */
1211#define ENCODE_SEQID_OP_HEAD \ 1212#define ENCODE_SEQID_OP_HEAD \
1212 u32 *p; \ 1213 __be32 *p; \
1213 u32 *save; \ 1214 __be32 *save; \
1214 \ 1215 \
1215 save = resp->p; 1216 save = resp->p;
1216 1217
@@ -1234,11 +1235,11 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1234/* Encode as an array of strings the string given with components 1235/* Encode as an array of strings the string given with components
1235 * seperated @sep. 1236 * seperated @sep.
1236 */ 1237 */
1237static int nfsd4_encode_components(char sep, char *components, 1238static __be32 nfsd4_encode_components(char sep, char *components,
1238 u32 **pp, int *buflen) 1239 __be32 **pp, int *buflen)
1239{ 1240{
1240 u32 *p = *pp; 1241 __be32 *p = *pp;
1241 u32 *countp = p; 1242 __be32 *countp = p;
1242 int strlen, count=0; 1243 int strlen, count=0;
1243 char *str, *end; 1244 char *str, *end;
1244 1245
@@ -1271,11 +1272,11 @@ static int nfsd4_encode_components(char sep, char *components,
1271/* 1272/*
1272 * encode a location element of a fs_locations structure 1273 * encode a location element of a fs_locations structure
1273 */ 1274 */
1274static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, 1275static __be32 nfsd4_encode_fs_location4(struct nfsd4_fs_location *location,
1275 u32 **pp, int *buflen) 1276 __be32 **pp, int *buflen)
1276{ 1277{
1277 int status; 1278 __be32 status;
1278 u32 *p = *pp; 1279 __be32 *p = *pp;
1279 1280
1280 status = nfsd4_encode_components(':', location->hosts, &p, buflen); 1281 status = nfsd4_encode_components(':', location->hosts, &p, buflen);
1281 if (status) 1282 if (status)
@@ -1292,16 +1293,15 @@ static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location,
1292 * Returned string is safe to use as long as the caller holds a reference 1293 * Returned string is safe to use as long as the caller holds a reference
1293 * to @exp. 1294 * to @exp.
1294 */ 1295 */
1295static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp) 1296static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *stat)
1296{ 1297{
1297 struct svc_fh tmp_fh; 1298 struct svc_fh tmp_fh;
1298 char *path, *rootpath; 1299 char *path, *rootpath;
1299 int stat;
1300 1300
1301 fh_init(&tmp_fh, NFS4_FHSIZE); 1301 fh_init(&tmp_fh, NFS4_FHSIZE);
1302 stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle); 1302 *stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle);
1303 if (stat) 1303 if (*stat)
1304 return ERR_PTR(stat); 1304 return NULL;
1305 rootpath = tmp_fh.fh_export->ex_path; 1305 rootpath = tmp_fh.fh_export->ex_path;
1306 1306
1307 path = exp->ex_path; 1307 path = exp->ex_path;
@@ -1309,7 +1309,8 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp)
1309 if (strncmp(path, rootpath, strlen(rootpath))) { 1309 if (strncmp(path, rootpath, strlen(rootpath))) {
1310 printk("nfsd: fs_locations failed;" 1310 printk("nfsd: fs_locations failed;"
1311 "%s is not contained in %s\n", path, rootpath); 1311 "%s is not contained in %s\n", path, rootpath);
1312 return ERR_PTR(-EOPNOTSUPP); 1312 *stat = nfserr_notsupp;
1313 return NULL;
1313 } 1314 }
1314 1315
1315 return path + strlen(rootpath); 1316 return path + strlen(rootpath);
@@ -1318,17 +1319,18 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp)
1318/* 1319/*
1319 * encode a fs_locations structure 1320 * encode a fs_locations structure
1320 */ 1321 */
1321static int nfsd4_encode_fs_locations(struct svc_rqst *rqstp, 1322static __be32 nfsd4_encode_fs_locations(struct svc_rqst *rqstp,
1322 struct svc_export *exp, 1323 struct svc_export *exp,
1323 u32 **pp, int *buflen) 1324 __be32 **pp, int *buflen)
1324{ 1325{
1325 int status, i; 1326 __be32 status;
1326 u32 *p = *pp; 1327 int i;
1328 __be32 *p = *pp;
1327 struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs; 1329 struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs;
1328 char *root = nfsd4_path(rqstp, exp); 1330 char *root = nfsd4_path(rqstp, exp, &status);
1329 1331
1330 if (IS_ERR(root)) 1332 if (status)
1331 return PTR_ERR(root); 1333 return status;
1332 status = nfsd4_encode_components('/', root, &p, buflen); 1334 status = nfsd4_encode_components('/', root, &p, buflen);
1333 if (status) 1335 if (status)
1334 return status; 1336 return status;
@@ -1352,9 +1354,9 @@ static u32 nfs4_ftypes[16] = {
1352 NF4SOCK, NF4BAD, NF4LNK, NF4BAD, 1354 NF4SOCK, NF4BAD, NF4LNK, NF4BAD,
1353}; 1355};
1354 1356
1355static int 1357static __be32
1356nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group, 1358nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1357 u32 **p, int *buflen) 1359 __be32 **p, int *buflen)
1358{ 1360{
1359 int status; 1361 int status;
1360 1362
@@ -1374,21 +1376,21 @@ nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1374 return 0; 1376 return 0;
1375} 1377}
1376 1378
1377static inline int 1379static inline __be32
1378nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, u32 **p, int *buflen) 1380nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, __be32 **p, int *buflen)
1379{ 1381{
1380 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen); 1382 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen);
1381} 1383}
1382 1384
1383static inline int 1385static inline __be32
1384nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, u32 **p, int *buflen) 1386nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, __be32 **p, int *buflen)
1385{ 1387{
1386 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen); 1388 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen);
1387} 1389}
1388 1390
1389static inline int 1391static inline __be32
1390nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group, 1392nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1391 u32 **p, int *buflen) 1393 __be32 **p, int *buflen)
1392{ 1394{
1393 return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen); 1395 return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen);
1394} 1396}
@@ -1397,7 +1399,7 @@ nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1397 FATTR4_WORD0_RDATTR_ERROR) 1399 FATTR4_WORD0_RDATTR_ERROR)
1398#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID 1400#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID
1399 1401
1400static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) 1402static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
1401{ 1403{
1402 /* As per referral draft: */ 1404 /* As per referral draft: */
1403 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || 1405 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS ||
@@ -1420,9 +1422,9 @@ static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
1420 * @countp is the buffer size in _words_; upon successful return this becomes 1422 * @countp is the buffer size in _words_; upon successful return this becomes
1421 * replaced with the number of words written. 1423 * replaced with the number of words written.
1422 */ 1424 */
1423int 1425__be32
1424nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 1426nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1425 struct dentry *dentry, u32 *buffer, int *countp, u32 *bmval, 1427 struct dentry *dentry, __be32 *buffer, int *countp, u32 *bmval,
1426 struct svc_rqst *rqstp) 1428 struct svc_rqst *rqstp)
1427{ 1429{
1428 u32 bmval0 = bmval[0]; 1430 u32 bmval0 = bmval[0];
@@ -1431,12 +1433,13 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1431 struct svc_fh tempfh; 1433 struct svc_fh tempfh;
1432 struct kstatfs statfs; 1434 struct kstatfs statfs;
1433 int buflen = *countp << 2; 1435 int buflen = *countp << 2;
1434 u32 *attrlenp; 1436 __be32 *attrlenp;
1435 u32 dummy; 1437 u32 dummy;
1436 u64 dummy64; 1438 u64 dummy64;
1437 u32 rdattr_err = 0; 1439 u32 rdattr_err = 0;
1438 u32 *p = buffer; 1440 __be32 *p = buffer;
1439 int status; 1441 __be32 status;
1442 int err;
1440 int aclsupport = 0; 1443 int aclsupport = 0;
1441 struct nfs4_acl *acl = NULL; 1444 struct nfs4_acl *acl = NULL;
1442 1445
@@ -1450,14 +1453,14 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1450 goto out; 1453 goto out;
1451 } 1454 }
1452 1455
1453 status = vfs_getattr(exp->ex_mnt, dentry, &stat); 1456 err = vfs_getattr(exp->ex_mnt, dentry, &stat);
1454 if (status) 1457 if (err)
1455 goto out_nfserr; 1458 goto out_nfserr;
1456 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || 1459 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
1457 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | 1460 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
1458 FATTR4_WORD1_SPACE_TOTAL))) { 1461 FATTR4_WORD1_SPACE_TOTAL))) {
1459 status = vfs_statfs(dentry, &statfs); 1462 err = vfs_statfs(dentry, &statfs);
1460 if (status) 1463 if (err)
1461 goto out_nfserr; 1464 goto out_nfserr;
1462 } 1465 }
1463 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) { 1466 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) {
@@ -1469,15 +1472,15 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1469 } 1472 }
1470 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT 1473 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
1471 | FATTR4_WORD0_SUPPORTED_ATTRS)) { 1474 | FATTR4_WORD0_SUPPORTED_ATTRS)) {
1472 status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl); 1475 err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
1473 aclsupport = (status == 0); 1476 aclsupport = (err == 0);
1474 if (bmval0 & FATTR4_WORD0_ACL) { 1477 if (bmval0 & FATTR4_WORD0_ACL) {
1475 if (status == -EOPNOTSUPP) 1478 if (err == -EOPNOTSUPP)
1476 bmval0 &= ~FATTR4_WORD0_ACL; 1479 bmval0 &= ~FATTR4_WORD0_ACL;
1477 else if (status == -EINVAL) { 1480 else if (err == -EINVAL) {
1478 status = nfserr_attrnotsupp; 1481 status = nfserr_attrnotsupp;
1479 goto out; 1482 goto out;
1480 } else if (status != 0) 1483 } else if (err != 0)
1481 goto out_nfserr; 1484 goto out_nfserr;
1482 } 1485 }
1483 } 1486 }
@@ -1817,7 +1820,7 @@ out:
1817 fh_put(&tempfh); 1820 fh_put(&tempfh);
1818 return status; 1821 return status;
1819out_nfserr: 1822out_nfserr:
1820 status = nfserrno(status); 1823 status = nfserrno(err);
1821 goto out; 1824 goto out;
1822out_resource: 1825out_resource:
1823 *countp = 0; 1826 *countp = 0;
@@ -1828,13 +1831,13 @@ out_serverfault:
1828 goto out; 1831 goto out;
1829} 1832}
1830 1833
1831static int 1834static __be32
1832nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, 1835nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
1833 const char *name, int namlen, u32 *p, int *buflen) 1836 const char *name, int namlen, __be32 *p, int *buflen)
1834{ 1837{
1835 struct svc_export *exp = cd->rd_fhp->fh_export; 1838 struct svc_export *exp = cd->rd_fhp->fh_export;
1836 struct dentry *dentry; 1839 struct dentry *dentry;
1837 int nfserr; 1840 __be32 nfserr;
1838 1841
1839 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); 1842 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
1840 if (IS_ERR(dentry)) 1843 if (IS_ERR(dentry))
@@ -1863,10 +1866,10 @@ out_put:
1863 return nfserr; 1866 return nfserr;
1864} 1867}
1865 1868
1866static u32 * 1869static __be32 *
1867nfsd4_encode_rdattr_error(u32 *p, int buflen, int nfserr) 1870nfsd4_encode_rdattr_error(__be32 *p, int buflen, __be32 nfserr)
1868{ 1871{
1869 u32 *attrlenp; 1872 __be32 *attrlenp;
1870 1873
1871 if (buflen < 6) 1874 if (buflen < 6)
1872 return NULL; 1875 return NULL;
@@ -1886,8 +1889,8 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
1886{ 1889{
1887 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); 1890 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
1888 int buflen; 1891 int buflen;
1889 u32 *p = cd->buffer; 1892 __be32 *p = cd->buffer;
1890 int nfserr = nfserr_toosmall; 1893 __be32 nfserr = nfserr_toosmall;
1891 1894
1892 /* In nfsv4, "." and ".." never make it onto the wire.. */ 1895 /* In nfsv4, "." and ".." never make it onto the wire.. */
1893 if (name && isdotent(name, namlen)) { 1896 if (name && isdotent(name, namlen)) {
@@ -1943,7 +1946,7 @@ fail:
1943} 1946}
1944 1947
1945static void 1948static void
1946nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_access *access) 1949nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access)
1947{ 1950{
1948 ENCODE_HEAD; 1951 ENCODE_HEAD;
1949 1952
@@ -1956,7 +1959,7 @@ nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_acc
1956} 1959}
1957 1960
1958static void 1961static void
1959nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_close *close) 1962nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_close *close)
1960{ 1963{
1961 ENCODE_SEQID_OP_HEAD; 1964 ENCODE_SEQID_OP_HEAD;
1962 1965
@@ -1971,7 +1974,7 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_clos
1971 1974
1972 1975
1973static void 1976static void
1974nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_commit *commit) 1977nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit)
1975{ 1978{
1976 ENCODE_HEAD; 1979 ENCODE_HEAD;
1977 1980
@@ -1983,7 +1986,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_com
1983} 1986}
1984 1987
1985static void 1988static void
1986nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_create *create) 1989nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_create *create)
1987{ 1990{
1988 ENCODE_HEAD; 1991 ENCODE_HEAD;
1989 1992
@@ -1997,8 +2000,8 @@ nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_cre
1997 } 2000 }
1998} 2001}
1999 2002
2000static int 2003static __be32
2001nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_getattr *getattr) 2004nfsd4_encode_getattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_getattr *getattr)
2002{ 2005{
2003 struct svc_fh *fhp = getattr->ga_fhp; 2006 struct svc_fh *fhp = getattr->ga_fhp;
2004 int buflen; 2007 int buflen;
@@ -2016,7 +2019,7 @@ nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ge
2016} 2019}
2017 2020
2018static void 2021static void
2019nfsd4_encode_getfh(struct nfsd4_compoundres *resp, int nfserr, struct svc_fh *fhp) 2022nfsd4_encode_getfh(struct nfsd4_compoundres *resp, __be32 nfserr, struct svc_fh *fhp)
2020{ 2023{
2021 unsigned int len; 2024 unsigned int len;
2022 ENCODE_HEAD; 2025 ENCODE_HEAD;
@@ -2056,7 +2059,7 @@ nfsd4_encode_lock_denied(struct nfsd4_compoundres *resp, struct nfsd4_lock_denie
2056} 2059}
2057 2060
2058static void 2061static void
2059nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock *lock) 2062nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lock *lock)
2060{ 2063{
2061 ENCODE_SEQID_OP_HEAD; 2064 ENCODE_SEQID_OP_HEAD;
2062 2065
@@ -2072,14 +2075,14 @@ nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock
2072} 2075}
2073 2076
2074static void 2077static void
2075nfsd4_encode_lockt(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lockt *lockt) 2078nfsd4_encode_lockt(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lockt *lockt)
2076{ 2079{
2077 if (nfserr == nfserr_denied) 2080 if (nfserr == nfserr_denied)
2078 nfsd4_encode_lock_denied(resp, &lockt->lt_denied); 2081 nfsd4_encode_lock_denied(resp, &lockt->lt_denied);
2079} 2082}
2080 2083
2081static void 2084static void
2082nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_locku *locku) 2085nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_locku *locku)
2083{ 2086{
2084 ENCODE_SEQID_OP_HEAD; 2087 ENCODE_SEQID_OP_HEAD;
2085 2088
@@ -2095,7 +2098,7 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock
2095 2098
2096 2099
2097static void 2100static void
2098nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link *link) 2101nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_link *link)
2099{ 2102{
2100 ENCODE_HEAD; 2103 ENCODE_HEAD;
2101 2104
@@ -2108,7 +2111,7 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link
2108 2111
2109 2112
2110static void 2113static void
2111nfsd4_encode_open(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open *open) 2114nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open)
2112{ 2115{
2113 ENCODE_SEQID_OP_HEAD; 2116 ENCODE_SEQID_OP_HEAD;
2114 2117
@@ -2173,7 +2176,7 @@ out:
2173} 2176}
2174 2177
2175static void 2178static void
2176nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_confirm *oc) 2179nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc)
2177{ 2180{
2178 ENCODE_SEQID_OP_HEAD; 2181 ENCODE_SEQID_OP_HEAD;
2179 2182
@@ -2188,7 +2191,7 @@ nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfs
2188} 2191}
2189 2192
2190static void 2193static void
2191nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_downgrade *od) 2194nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od)
2192{ 2195{
2193 ENCODE_SEQID_OP_HEAD; 2196 ENCODE_SEQID_OP_HEAD;
2194 2197
@@ -2202,8 +2205,8 @@ nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct n
2202 ENCODE_SEQID_OP_TAIL(od->od_stateowner); 2205 ENCODE_SEQID_OP_TAIL(od->od_stateowner);
2203} 2206}
2204 2207
2205static int 2208static __be32
2206nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, 2209nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
2207 struct nfsd4_read *read) 2210 struct nfsd4_read *read)
2208{ 2211{
2209 u32 eof; 2212 u32 eof;
@@ -2267,8 +2270,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr,
2267 return 0; 2270 return 0;
2268} 2271}
2269 2272
2270static int 2273static __be32
2271nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readlink *readlink) 2274nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readlink *readlink)
2272{ 2275{
2273 int maxcount; 2276 int maxcount;
2274 char *page; 2277 char *page;
@@ -2315,12 +2318,12 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_r
2315 return 0; 2318 return 0;
2316} 2319}
2317 2320
2318static int 2321static __be32
2319nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readdir *readdir) 2322nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readdir *readdir)
2320{ 2323{
2321 int maxcount; 2324 int maxcount;
2322 loff_t offset; 2325 loff_t offset;
2323 u32 *page, *savep, *tailbase; 2326 __be32 *page, *savep, *tailbase;
2324 ENCODE_HEAD; 2327 ENCODE_HEAD;
2325 2328
2326 if (nfserr) 2329 if (nfserr)
@@ -2395,7 +2398,7 @@ err_no_verf:
2395} 2398}
2396 2399
2397static void 2400static void
2398nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_remove *remove) 2401nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_remove *remove)
2399{ 2402{
2400 ENCODE_HEAD; 2403 ENCODE_HEAD;
2401 2404
@@ -2407,7 +2410,7 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rem
2407} 2410}
2408 2411
2409static void 2412static void
2410nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rename *rename) 2413nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_rename *rename)
2411{ 2414{
2412 ENCODE_HEAD; 2415 ENCODE_HEAD;
2413 2416
@@ -2424,7 +2427,7 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ren
2424 * regardless of the error status. 2427 * regardless of the error status.
2425 */ 2428 */
2426static void 2429static void
2427nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setattr *setattr) 2430nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setattr *setattr)
2428{ 2431{
2429 ENCODE_HEAD; 2432 ENCODE_HEAD;
2430 2433
@@ -2443,7 +2446,7 @@ nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_se
2443} 2446}
2444 2447
2445static void 2448static void
2446nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setclientid *scd) 2449nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setclientid *scd)
2447{ 2450{
2448 ENCODE_HEAD; 2451 ENCODE_HEAD;
2449 2452
@@ -2462,7 +2465,7 @@ nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd
2462} 2465}
2463 2466
2464static void 2467static void
2465nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_write *write) 2468nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_write *write)
2466{ 2469{
2467 ENCODE_HEAD; 2470 ENCODE_HEAD;
2468 2471
@@ -2478,7 +2481,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ
2478void 2481void
2479nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) 2482nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
2480{ 2483{
2481 u32 *statp; 2484 __be32 *statp;
2482 ENCODE_HEAD; 2485 ENCODE_HEAD;
2483 2486
2484 RESERVE_SPACE(8); 2487 RESERVE_SPACE(8);
@@ -2616,7 +2619,7 @@ nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
2616 */ 2619 */
2617 2620
2618int 2621int
2619nfs4svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) 2622nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
2620{ 2623{
2621 return xdr_ressize_check(rqstp, p); 2624 return xdr_ressize_check(rqstp, p);
2622} 2625}
@@ -2638,9 +2641,9 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args)
2638} 2641}
2639 2642
2640int 2643int
2641nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundargs *args) 2644nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundargs *args)
2642{ 2645{
2643 int status; 2646 __be32 status;
2644 2647
2645 args->p = p; 2648 args->p = p;
2646 args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len; 2649 args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len;
@@ -2659,7 +2662,7 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoun
2659} 2662}
2660 2663
2661int 2664int
2662nfs4svc_encode_compoundres(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundres *resp) 2665nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundres *resp)
2663{ 2666{
2664 /* 2667 /*
2665 * All that remains is to write the tag and operation count... 2668 * All that remains is to write the tag and operation count...