aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-08-14 10:19:37 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-14 13:23:58 -0400
commit6f723f7710024bb151ca8c5277ce8c71beec4db8 (patch)
tree7f5b65f1bed759aae76a258a02693b12976073fc /fs/nfs/nfs4xdr.c
parent811652bd6edd66dd35bf9caacdfe96d19f75a47e (diff)
nfs: nfs4xdr: get rid of READ32
s/READ32\((.*)\)/\1 = be32_to_cpup(p++)/ Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c145
1 files changed, 72 insertions, 73 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index efa78ad98228..5f6b46f17c5b 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2433,7 +2433,6 @@ static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p,
2433 * task to translate them into Linux-specific versions which are more 2433 * task to translate them into Linux-specific versions which are more
2434 * consistent with the style used in NFSv2/v3... 2434 * consistent with the style used in NFSv2/v3...
2435 */ 2435 */
2436#define READ32(x) (x) = ntohl(*p++)
2437#define READ64(x) do { \ 2436#define READ64(x) do { \
2438 (x) = (u64)ntohl(*p++) << 32; \ 2437 (x) = (u64)ntohl(*p++) << 32; \
2439 (x) |= ntohl(*p++); \ 2438 (x) |= ntohl(*p++); \
@@ -2464,7 +2463,7 @@ static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char
2464 __be32 *p; 2463 __be32 *p;
2465 2464
2466 READ_BUF(4); 2465 READ_BUF(4);
2467 READ32(*len); 2466 *len = be32_to_cpup(p++);
2468 READ_BUF(*len); 2467 READ_BUF(*len);
2469 *string = (char *)p; 2468 *string = (char *)p;
2470 return 0; 2469 return 0;
@@ -2475,13 +2474,13 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
2475 __be32 *p; 2474 __be32 *p;
2476 2475
2477 READ_BUF(8); 2476 READ_BUF(8);
2478 READ32(hdr->status); 2477 hdr->status = be32_to_cpup(p++);
2479 READ32(hdr->taglen); 2478 hdr->taglen = be32_to_cpup(p++);
2480 2479
2481 READ_BUF(hdr->taglen + 4); 2480 READ_BUF(hdr->taglen + 4);
2482 hdr->tag = (char *)p; 2481 hdr->tag = (char *)p;
2483 p += XDR_QUADLEN(hdr->taglen); 2482 p += XDR_QUADLEN(hdr->taglen);
2484 READ32(hdr->nops); 2483 hdr->nops = be32_to_cpup(p++);
2485 if (unlikely(hdr->nops < 1)) 2484 if (unlikely(hdr->nops < 1))
2486 return nfs4_stat_to_errno(hdr->status); 2485 return nfs4_stat_to_errno(hdr->status);
2487 return 0; 2486 return 0;
@@ -2494,14 +2493,14 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
2494 int32_t nfserr; 2493 int32_t nfserr;
2495 2494
2496 READ_BUF(8); 2495 READ_BUF(8);
2497 READ32(opnum); 2496 opnum = be32_to_cpup(p++);
2498 if (opnum != expected) { 2497 if (opnum != expected) {
2499 dprintk("nfs: Server returned operation" 2498 dprintk("nfs: Server returned operation"
2500 " %d but we issued a request for %d\n", 2499 " %d but we issued a request for %d\n",
2501 opnum, expected); 2500 opnum, expected);
2502 return -EIO; 2501 return -EIO;
2503 } 2502 }
2504 READ32(nfserr); 2503 nfserr = be32_to_cpup(p++);
2505 if (nfserr != NFS_OK) 2504 if (nfserr != NFS_OK)
2506 return nfs4_stat_to_errno(nfserr); 2505 return nfs4_stat_to_errno(nfserr);
2507 return 0; 2506 return 0;
@@ -2524,14 +2523,14 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
2524 __be32 *p; 2523 __be32 *p;
2525 2524
2526 READ_BUF(4); 2525 READ_BUF(4);
2527 READ32(bmlen); 2526 bmlen = be32_to_cpup(p++);
2528 2527
2529 bitmap[0] = bitmap[1] = 0; 2528 bitmap[0] = bitmap[1] = 0;
2530 READ_BUF((bmlen << 2)); 2529 READ_BUF((bmlen << 2));
2531 if (bmlen > 0) { 2530 if (bmlen > 0) {
2532 READ32(bitmap[0]); 2531 bitmap[0] = be32_to_cpup(p++);
2533 if (bmlen > 1) 2532 if (bmlen > 1)
2534 READ32(bitmap[1]); 2533 bitmap[1] = be32_to_cpup(p++);
2535 } 2534 }
2536 return 0; 2535 return 0;
2537} 2536}
@@ -2541,7 +2540,7 @@ static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen,
2541 __be32 *p; 2540 __be32 *p;
2542 2541
2543 READ_BUF(4); 2542 READ_BUF(4);
2544 READ32(*attrlen); 2543 *attrlen = be32_to_cpup(p++);
2545 *savep = xdr->p; 2544 *savep = xdr->p;
2546 return 0; 2545 return 0;
2547} 2546}
@@ -2567,7 +2566,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
2567 return -EIO; 2566 return -EIO;
2568 if (likely(bitmap[0] & FATTR4_WORD0_TYPE)) { 2567 if (likely(bitmap[0] & FATTR4_WORD0_TYPE)) {
2569 READ_BUF(4); 2568 READ_BUF(4);
2570 READ32(*type); 2569 *type = be32_to_cpup(p++);
2571 if (*type < NF4REG || *type > NF4NAMEDATTR) { 2570 if (*type < NF4REG || *type > NF4NAMEDATTR) {
2572 dprintk("%s: bad type %d\n", __func__, *type); 2571 dprintk("%s: bad type %d\n", __func__, *type);
2573 return -EIO; 2572 return -EIO;
@@ -2625,7 +2624,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui
2625 return -EIO; 2624 return -EIO;
2626 if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) { 2625 if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) {
2627 READ_BUF(4); 2626 READ_BUF(4);
2628 READ32(*res); 2627 *res = be32_to_cpup(p++);
2629 bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; 2628 bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT;
2630 } 2629 }
2631 dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true"); 2630 dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true");
@@ -2641,7 +2640,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap,
2641 return -EIO; 2640 return -EIO;
2642 if (likely(bitmap[0] & FATTR4_WORD0_SYMLINK_SUPPORT)) { 2641 if (likely(bitmap[0] & FATTR4_WORD0_SYMLINK_SUPPORT)) {
2643 READ_BUF(4); 2642 READ_BUF(4);
2644 READ32(*res); 2643 *res = be32_to_cpup(p++);
2645 bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; 2644 bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT;
2646 } 2645 }
2647 dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true"); 2646 dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true");
@@ -2679,7 +2678,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint
2679 return -EIO; 2678 return -EIO;
2680 if (likely(bitmap[0] & FATTR4_WORD0_LEASE_TIME)) { 2679 if (likely(bitmap[0] & FATTR4_WORD0_LEASE_TIME)) {
2681 READ_BUF(4); 2680 READ_BUF(4);
2682 READ32(*res); 2681 *res = be32_to_cpup(p++);
2683 bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; 2682 bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME;
2684 } 2683 }
2685 dprintk("%s: file size=%u\n", __func__, (unsigned int)*res); 2684 dprintk("%s: file size=%u\n", __func__, (unsigned int)*res);
@@ -2695,7 +2694,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint
2695 return -EIO; 2694 return -EIO;
2696 if (likely(bitmap[0] & FATTR4_WORD0_ACLSUPPORT)) { 2695 if (likely(bitmap[0] & FATTR4_WORD0_ACLSUPPORT)) {
2697 READ_BUF(4); 2696 READ_BUF(4);
2698 READ32(*res); 2697 *res = be32_to_cpup(p++);
2699 bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; 2698 bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT;
2700 } 2699 }
2701 dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res); 2700 dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res);
@@ -2796,7 +2795,7 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
2796 int status = 0; 2795 int status = 0;
2797 2796
2798 READ_BUF(4); 2797 READ_BUF(4);
2799 READ32(n); 2798 n = be32_to_cpup(p++);
2800 if (n == 0) 2799 if (n == 0)
2801 goto root_path; 2800 goto root_path;
2802 dprintk("path "); 2801 dprintk("path ");
@@ -2848,7 +2847,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2848 if (unlikely(status != 0)) 2847 if (unlikely(status != 0))
2849 goto out; 2848 goto out;
2850 READ_BUF(4); 2849 READ_BUF(4);
2851 READ32(n); 2850 n = be32_to_cpup(p++);
2852 if (n <= 0) 2851 if (n <= 0)
2853 goto out_eio; 2852 goto out_eio;
2854 res->nlocations = 0; 2853 res->nlocations = 0;
@@ -2857,7 +2856,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2857 struct nfs4_fs_location *loc = &res->locations[res->nlocations]; 2856 struct nfs4_fs_location *loc = &res->locations[res->nlocations];
2858 2857
2859 READ_BUF(4); 2858 READ_BUF(4);
2860 READ32(m); 2859 m = be32_to_cpup(p++);
2861 2860
2862 loc->nservers = 0; 2861 loc->nservers = 0;
2863 dprintk("%s: servers ", __func__); 2862 dprintk("%s: servers ", __func__);
@@ -2928,7 +2927,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2928 return -EIO; 2927 return -EIO;
2929 if (likely(bitmap[0] & FATTR4_WORD0_MAXLINK)) { 2928 if (likely(bitmap[0] & FATTR4_WORD0_MAXLINK)) {
2930 READ_BUF(4); 2929 READ_BUF(4);
2931 READ32(*maxlink); 2930 *maxlink = be32_to_cpup(p++);
2932 bitmap[0] &= ~FATTR4_WORD0_MAXLINK; 2931 bitmap[0] &= ~FATTR4_WORD0_MAXLINK;
2933 } 2932 }
2934 dprintk("%s: maxlink=%u\n", __func__, *maxlink); 2933 dprintk("%s: maxlink=%u\n", __func__, *maxlink);
@@ -2945,7 +2944,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2945 return -EIO; 2944 return -EIO;
2946 if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) { 2945 if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) {
2947 READ_BUF(4); 2946 READ_BUF(4);
2948 READ32(*maxname); 2947 *maxname = be32_to_cpup(p++);
2949 bitmap[0] &= ~FATTR4_WORD0_MAXNAME; 2948 bitmap[0] &= ~FATTR4_WORD0_MAXNAME;
2950 } 2949 }
2951 dprintk("%s: maxname=%u\n", __func__, *maxname); 2950 dprintk("%s: maxname=%u\n", __func__, *maxname);
@@ -3005,7 +3004,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *m
3005 return -EIO; 3004 return -EIO;
3006 if (likely(bitmap[1] & FATTR4_WORD1_MODE)) { 3005 if (likely(bitmap[1] & FATTR4_WORD1_MODE)) {
3007 READ_BUF(4); 3006 READ_BUF(4);
3008 READ32(tmp); 3007 tmp = be32_to_cpup(p++);
3009 *mode = tmp & ~S_IFMT; 3008 *mode = tmp & ~S_IFMT;
3010 bitmap[1] &= ~FATTR4_WORD1_MODE; 3009 bitmap[1] &= ~FATTR4_WORD1_MODE;
3011 ret = NFS_ATTR_FATTR_MODE; 3010 ret = NFS_ATTR_FATTR_MODE;
@@ -3024,7 +3023,7 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t
3024 return -EIO; 3023 return -EIO;
3025 if (likely(bitmap[1] & FATTR4_WORD1_NUMLINKS)) { 3024 if (likely(bitmap[1] & FATTR4_WORD1_NUMLINKS)) {
3026 READ_BUF(4); 3025 READ_BUF(4);
3027 READ32(*nlink); 3026 *nlink = be32_to_cpup(p++);
3028 bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; 3027 bitmap[1] &= ~FATTR4_WORD1_NUMLINKS;
3029 ret = NFS_ATTR_FATTR_NLINK; 3028 ret = NFS_ATTR_FATTR_NLINK;
3030 } 3029 }
@@ -3043,7 +3042,7 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
3043 return -EIO; 3042 return -EIO;
3044 if (likely(bitmap[1] & FATTR4_WORD1_OWNER)) { 3043 if (likely(bitmap[1] & FATTR4_WORD1_OWNER)) {
3045 READ_BUF(4); 3044 READ_BUF(4);
3046 READ32(len); 3045 len = be32_to_cpup(p++);
3047 READ_BUF(len); 3046 READ_BUF(len);
3048 if (len < XDR_MAX_NETOBJ) { 3047 if (len < XDR_MAX_NETOBJ) {
3049 if (nfs_map_name_to_uid(clp, (char *)p, len, uid) == 0) 3048 if (nfs_map_name_to_uid(clp, (char *)p, len, uid) == 0)
@@ -3071,7 +3070,7 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
3071 return -EIO; 3070 return -EIO;
3072 if (likely(bitmap[1] & FATTR4_WORD1_OWNER_GROUP)) { 3071 if (likely(bitmap[1] & FATTR4_WORD1_OWNER_GROUP)) {
3073 READ_BUF(4); 3072 READ_BUF(4);
3074 READ32(len); 3073 len = be32_to_cpup(p++);
3075 READ_BUF(len); 3074 READ_BUF(len);
3076 if (len < XDR_MAX_NETOBJ) { 3075 if (len < XDR_MAX_NETOBJ) {
3077 if (nfs_map_group_to_gid(clp, (char *)p, len, gid) == 0) 3076 if (nfs_map_group_to_gid(clp, (char *)p, len, gid) == 0)
@@ -3101,8 +3100,8 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde
3101 dev_t tmp; 3100 dev_t tmp;
3102 3101
3103 READ_BUF(8); 3102 READ_BUF(8);
3104 READ32(major); 3103 major = be32_to_cpup(p++);
3105 READ32(minor); 3104 minor = be32_to_cpup(p++);
3106 tmp = MKDEV(major, minor); 3105 tmp = MKDEV(major, minor);
3107 if (MAJOR(tmp) == major && MINOR(tmp) == minor) 3106 if (MAJOR(tmp) == major && MINOR(tmp) == minor)
3108 *rdev = tmp; 3107 *rdev = tmp;
@@ -3191,7 +3190,7 @@ static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time)
3191 3190
3192 READ_BUF(12); 3191 READ_BUF(12);
3193 READ64(sec); 3192 READ64(sec);
3194 READ32(nsec); 3193 nsec = be32_to_cpup(p++);
3195 time->tv_sec = (time_t)sec; 3194 time->tv_sec = (time_t)sec;
3196 time->tv_nsec = (long)nsec; 3195 time->tv_nsec = (long)nsec;
3197 return 0; 3196 return 0;
@@ -3273,7 +3272,7 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c
3273 __be32 *p; 3272 __be32 *p;
3274 3273
3275 READ_BUF(20); 3274 READ_BUF(20);
3276 READ32(cinfo->atomic); 3275 cinfo->atomic = be32_to_cpup(p++);
3277 READ64(cinfo->before); 3276 READ64(cinfo->before);
3278 READ64(cinfo->after); 3277 READ64(cinfo->after);
3279 return 0; 3278 return 0;
@@ -3289,8 +3288,8 @@ static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access)
3289 if (status) 3288 if (status)
3290 return status; 3289 return status;
3291 READ_BUF(8); 3290 READ_BUF(8);
3292 READ32(supp); 3291 supp = be32_to_cpup(p++);
3293 READ32(acc); 3292 acc = be32_to_cpup(p++);
3294 access->supported = supp; 3293 access->supported = supp;
3295 access->access = acc; 3294 access->access = acc;
3296 return 0; 3295 return 0;
@@ -3336,7 +3335,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
3336 if ((status = decode_change_info(xdr, cinfo))) 3335 if ((status = decode_change_info(xdr, cinfo)))
3337 return status; 3336 return status;
3338 READ_BUF(4); 3337 READ_BUF(4);
3339 READ32(bmlen); 3338 bmlen = be32_to_cpup(p++);
3340 READ_BUF(bmlen << 2); 3339 READ_BUF(bmlen << 2);
3341 return 0; 3340 return 0;
3342} 3341}
@@ -3591,7 +3590,7 @@ static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh)
3591 return status; 3590 return status;
3592 3591
3593 READ_BUF(4); 3592 READ_BUF(4);
3594 READ32(len); 3593 len = be32_to_cpup(p++);
3595 if (len > NFS4_FHSIZE) 3594 if (len > NFS4_FHSIZE)
3596 return -EIO; 3595 return -EIO;
3597 fh->size = len; 3596 fh->size = len;
@@ -3622,7 +3621,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
3622 READ_BUF(32); 3621 READ_BUF(32);
3623 READ64(offset); 3622 READ64(offset);
3624 READ64(length); 3623 READ64(length);
3625 READ32(type); 3624 type = be32_to_cpup(p++);
3626 if (fl != NULL) { 3625 if (fl != NULL) {
3627 fl->fl_start = (loff_t)offset; 3626 fl->fl_start = (loff_t)offset;
3628 fl->fl_end = fl->fl_start + (loff_t)length - 1; 3627 fl->fl_end = fl->fl_start + (loff_t)length - 1;
@@ -3634,7 +3633,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
3634 fl->fl_pid = 0; 3633 fl->fl_pid = 0;
3635 } 3634 }
3636 READ64(clientid); 3635 READ64(clientid);
3637 READ32(namelen); 3636 namelen = be32_to_cpup(p++);
3638 READ_BUF(namelen); 3637 READ_BUF(namelen);
3639 return -NFS4ERR_DENIED; 3638 return -NFS4ERR_DENIED;
3640} 3639}
@@ -3695,14 +3694,14 @@ static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize)
3695 uint32_t limit_type, nblocks, blocksize; 3694 uint32_t limit_type, nblocks, blocksize;
3696 3695
3697 READ_BUF(12); 3696 READ_BUF(12);
3698 READ32(limit_type); 3697 limit_type = be32_to_cpup(p++);
3699 switch (limit_type) { 3698 switch (limit_type) {
3700 case 1: 3699 case 1:
3701 READ64(*maxsize); 3700 READ64(*maxsize);
3702 break; 3701 break;
3703 case 2: 3702 case 2:
3704 READ32(nblocks); 3703 nblocks = be32_to_cpup(p++);
3705 READ32(blocksize); 3704 blocksize = be32_to_cpup(p++);
3706 *maxsize = (uint64_t)nblocks * (uint64_t)blocksize; 3705 *maxsize = (uint64_t)nblocks * (uint64_t)blocksize;
3707 } 3706 }
3708 return 0; 3707 return 0;
@@ -3714,14 +3713,14 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
3714 uint32_t delegation_type; 3713 uint32_t delegation_type;
3715 3714
3716 READ_BUF(4); 3715 READ_BUF(4);
3717 READ32(delegation_type); 3716 delegation_type = be32_to_cpup(p++);
3718 if (delegation_type == NFS4_OPEN_DELEGATE_NONE) { 3717 if (delegation_type == NFS4_OPEN_DELEGATE_NONE) {
3719 res->delegation_type = 0; 3718 res->delegation_type = 0;
3720 return 0; 3719 return 0;
3721 } 3720 }
3722 READ_BUF(NFS4_STATEID_SIZE+4); 3721 READ_BUF(NFS4_STATEID_SIZE+4);
3723 COPYMEM(res->delegation.data, NFS4_STATEID_SIZE); 3722 COPYMEM(res->delegation.data, NFS4_STATEID_SIZE);
3724 READ32(res->do_recall); 3723 res->do_recall = be32_to_cpup(p++);
3725 3724
3726 switch (delegation_type) { 3725 switch (delegation_type) {
3727 case NFS4_OPEN_DELEGATE_READ: 3726 case NFS4_OPEN_DELEGATE_READ:
@@ -3752,15 +3751,15 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
3752 decode_change_info(xdr, &res->cinfo); 3751 decode_change_info(xdr, &res->cinfo);
3753 3752
3754 READ_BUF(8); 3753 READ_BUF(8);
3755 READ32(res->rflags); 3754 res->rflags = be32_to_cpup(p++);
3756 READ32(bmlen); 3755 bmlen = be32_to_cpup(p++);
3757 if (bmlen > 10) 3756 if (bmlen > 10)
3758 goto xdr_error; 3757 goto xdr_error;
3759 3758
3760 READ_BUF(bmlen << 2); 3759 READ_BUF(bmlen << 2);
3761 savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE); 3760 savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE);
3762 for (i = 0; i < savewords; ++i) 3761 for (i = 0; i < savewords; ++i)
3763 READ32(res->attrset[i]); 3762 res->attrset[i] = be32_to_cpup(p++);
3764 for (; i < NFS4_BITMAP_SIZE; i++) 3763 for (; i < NFS4_BITMAP_SIZE; i++)
3765 res->attrset[i] = 0; 3764 res->attrset[i] = 0;
3766 3765
@@ -3821,8 +3820,8 @@ static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_
3821 if (status) 3820 if (status)
3822 return status; 3821 return status;
3823 READ_BUF(8); 3822 READ_BUF(8);
3824 READ32(eof); 3823 eof = be32_to_cpup(p++);
3825 READ32(count); 3824 count = be32_to_cpup(p++);
3826 hdrlen = (u8 *) p - (u8 *) iov->iov_base; 3825 hdrlen = (u8 *) p - (u8 *) iov->iov_base;
3827 recvd = req->rq_rcv_buf.len - hdrlen; 3826 recvd = req->rq_rcv_buf.len - hdrlen;
3828 if (count > recvd) { 3827 if (count > recvd) {
@@ -3948,7 +3947,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
3948 3947
3949 /* Convert length of symlink */ 3948 /* Convert length of symlink */
3950 READ_BUF(4); 3949 READ_BUF(4);
3951 READ32(len); 3950 len = be32_to_cpup(p++);
3952 if (len >= rcvbuf->page_len || len <= 0) { 3951 if (len >= rcvbuf->page_len || len <= 0) {
3953 dprintk("nfs: server returned giant symlink!\n"); 3952 dprintk("nfs: server returned giant symlink!\n");
3954 return -ENAMETOOLONG; 3953 return -ENAMETOOLONG;
@@ -4070,7 +4069,7 @@ static int decode_setattr(struct xdr_stream *xdr)
4070 if (status) 4069 if (status)
4071 return status; 4070 return status;
4072 READ_BUF(4); 4071 READ_BUF(4);
4073 READ32(bmlen); 4072 bmlen = be32_to_cpup(p++);
4074 READ_BUF(bmlen << 2); 4073 READ_BUF(bmlen << 2);
4075 return 0; 4074 return 0;
4076} 4075}
@@ -4082,13 +4081,13 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
4082 int32_t nfserr; 4081 int32_t nfserr;
4083 4082
4084 READ_BUF(8); 4083 READ_BUF(8);
4085 READ32(opnum); 4084 opnum = be32_to_cpup(p++);
4086 if (opnum != OP_SETCLIENTID) { 4085 if (opnum != OP_SETCLIENTID) {
4087 dprintk("nfs: decode_setclientid: Server returned operation" 4086 dprintk("nfs: decode_setclientid: Server returned operation"
4088 " %d\n", opnum); 4087 " %d\n", opnum);
4089 return -EIO; 4088 return -EIO;
4090 } 4089 }
4091 READ32(nfserr); 4090 nfserr = be32_to_cpup(p++);
4092 if (nfserr == NFS_OK) { 4091 if (nfserr == NFS_OK) {
4093 READ_BUF(8 + NFS4_VERIFIER_SIZE); 4092 READ_BUF(8 + NFS4_VERIFIER_SIZE);
4094 READ64(clp->cl_clientid); 4093 READ64(clp->cl_clientid);
@@ -4098,12 +4097,12 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
4098 4097
4099 /* skip netid string */ 4098 /* skip netid string */
4100 READ_BUF(4); 4099 READ_BUF(4);
4101 READ32(len); 4100 len = be32_to_cpup(p++);
4102 READ_BUF(len); 4101 READ_BUF(len);
4103 4102
4104 /* skip uaddr string */ 4103 /* skip uaddr string */
4105 READ_BUF(4); 4104 READ_BUF(4);
4106 READ32(len); 4105 len = be32_to_cpup(p++);
4107 READ_BUF(len); 4106 READ_BUF(len);
4108 return -NFSERR_CLID_INUSE; 4107 return -NFSERR_CLID_INUSE;
4109 } else 4108 } else
@@ -4127,8 +4126,8 @@ static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res)
4127 return status; 4126 return status;
4128 4127
4129 READ_BUF(16); 4128 READ_BUF(16);
4130 READ32(res->count); 4129 res->count = be32_to_cpup(p++);
4131 READ32(res->verf->committed); 4130 res->verf->committed = be32_to_cpup(p++);
4132 COPYMEM(res->verf->verifier, 8); 4131 COPYMEM(res->verf->verifier, 8);
4133 return 0; 4132 return 0;
4134} 4133}
@@ -4154,11 +4153,11 @@ static int decode_exchange_id(struct xdr_stream *xdr,
4154 READ_BUF(8); 4153 READ_BUF(8);
4155 READ64(clp->cl_ex_clid); 4154 READ64(clp->cl_ex_clid);
4156 READ_BUF(12); 4155 READ_BUF(12);
4157 READ32(clp->cl_seqid); 4156 clp->cl_seqid = be32_to_cpup(p++);
4158 READ32(clp->cl_exchange_flags); 4157 clp->cl_exchange_flags = be32_to_cpup(p++);
4159 4158
4160 /* We ask for SP4_NONE */ 4159 /* We ask for SP4_NONE */
4161 READ32(dummy); 4160 dummy = be32_to_cpup(p++);
4162 if (dummy != SP4_NONE) 4161 if (dummy != SP4_NONE)
4163 return -EIO; 4162 return -EIO;
4164 4163
@@ -4167,17 +4166,17 @@ static int decode_exchange_id(struct xdr_stream *xdr,
4167 4166
4168 /* Throw away Major id */ 4167 /* Throw away Major id */
4169 READ_BUF(4); 4168 READ_BUF(4);
4170 READ32(dummy); 4169 dummy = be32_to_cpup(p++);
4171 READ_BUF(dummy); 4170 READ_BUF(dummy);
4172 4171
4173 /* Throw away server_scope */ 4172 /* Throw away server_scope */
4174 READ_BUF(4); 4173 READ_BUF(4);
4175 READ32(dummy); 4174 dummy = be32_to_cpup(p++);
4176 READ_BUF(dummy); 4175 READ_BUF(dummy);
4177 4176
4178 /* Throw away Implementation id array */ 4177 /* Throw away Implementation id array */
4179 READ_BUF(4); 4178 READ_BUF(4);
4180 READ32(dummy); 4179 dummy = be32_to_cpup(p++);
4181 READ_BUF(dummy); 4180 READ_BUF(dummy);
4182 4181
4183 return 0; 4182 return 0;
@@ -4190,13 +4189,13 @@ static int decode_chan_attrs(struct xdr_stream *xdr,
4190 u32 nr_attrs; 4189 u32 nr_attrs;
4191 4190
4192 READ_BUF(28); 4191 READ_BUF(28);
4193 READ32(attrs->headerpadsz); 4192 attrs->headerpadsz = be32_to_cpup(p++);
4194 READ32(attrs->max_rqst_sz); 4193 attrs->max_rqst_sz = be32_to_cpup(p++);
4195 READ32(attrs->max_resp_sz); 4194 attrs->max_resp_sz = be32_to_cpup(p++);
4196 READ32(attrs->max_resp_sz_cached); 4195 attrs->max_resp_sz_cached = be32_to_cpup(p++);
4197 READ32(attrs->max_ops); 4196 attrs->max_ops = be32_to_cpup(p++);
4198 READ32(attrs->max_reqs); 4197 attrs->max_reqs = be32_to_cpup(p++);
4199 READ32(nr_attrs); 4198 nr_attrs = be32_to_cpup(p++);
4200 if (unlikely(nr_attrs > 1)) { 4199 if (unlikely(nr_attrs > 1)) {
4201 printk(KERN_WARNING "%s: Invalid rdma channel attrs count %u\n", 4200 printk(KERN_WARNING "%s: Invalid rdma channel attrs count %u\n",
4202 __func__, nr_attrs); 4201 __func__, nr_attrs);
@@ -4226,8 +4225,8 @@ static int decode_create_session(struct xdr_stream *xdr,
4226 4225
4227 /* seqid, flags */ 4226 /* seqid, flags */
4228 READ_BUF(8); 4227 READ_BUF(8);
4229 READ32(clp->cl_seqid); 4228 clp->cl_seqid = be32_to_cpup(p++);
4230 READ32(session->flags); 4229 session->flags = be32_to_cpup(p++);
4231 4230
4232 /* Channel attributes */ 4231 /* Channel attributes */
4233 status = decode_chan_attrs(xdr, &session->fc_attrs); 4232 status = decode_chan_attrs(xdr, &session->fc_attrs);
@@ -4275,23 +4274,23 @@ static int decode_sequence(struct xdr_stream *xdr,
4275 goto out_err; 4274 goto out_err;
4276 } 4275 }
4277 /* seqid */ 4276 /* seqid */
4278 READ32(dummy); 4277 dummy = be32_to_cpup(p++);
4279 if (dummy != slot->seq_nr) { 4278 if (dummy != slot->seq_nr) {
4280 dprintk("%s Invalid sequence number\n", __func__); 4279 dprintk("%s Invalid sequence number\n", __func__);
4281 goto out_err; 4280 goto out_err;
4282 } 4281 }
4283 /* slot id */ 4282 /* slot id */
4284 READ32(dummy); 4283 dummy = be32_to_cpup(p++);
4285 if (dummy != res->sr_slotid) { 4284 if (dummy != res->sr_slotid) {
4286 dprintk("%s Invalid slot id\n", __func__); 4285 dprintk("%s Invalid slot id\n", __func__);
4287 goto out_err; 4286 goto out_err;
4288 } 4287 }
4289 /* highest slot id - currently not processed */ 4288 /* highest slot id - currently not processed */
4290 READ32(dummy); 4289 dummy = be32_to_cpup(p++);
4291 /* target highest slot id - currently not processed */ 4290 /* target highest slot id - currently not processed */
4292 READ32(dummy); 4291 dummy = be32_to_cpup(p++);
4293 /* result flags - currently not processed */ 4292 /* result flags - currently not processed */
4294 READ32(dummy); 4293 dummy = be32_to_cpup(p++);
4295 status = 0; 4294 status = 0;
4296out_err: 4295out_err:
4297 res->sr_status = status; 4296 res->sr_status = status;