diff options
author | Benny Halevy <bhalevy@panasas.com> | 2009-08-14 10:19:41 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-14 13:24:13 -0400 |
commit | 3ceb4dbb993fdab6a6fafc69db36686278871134 (patch) | |
tree | 4ca8c09861175fae937ad1a869d045bae283a282 | |
parent | 6f723f7710024bb151ca8c5277ce8c71beec4db8 (diff) |
nfs: nfs4xdr: get rid of READ64
s/READ64\(\*(.*)\)/p = xdr_decode_hyper(p, \1)/
s/READ64\((.*)\)/p = xdr_decode_hyper(p, &\1)/
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4xdr.c | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 5f6b46f17c5b..238189ceae3f 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -2433,10 +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 READ64(x) do { \ | ||
2437 | (x) = (u64)ntohl(*p++) << 32; \ | ||
2438 | (x) |= ntohl(*p++); \ | ||
2439 | } while (0) | ||
2440 | #define READTIME(x) do { \ | 2436 | #define READTIME(x) do { \ |
2441 | p++; \ | 2437 | p++; \ |
2442 | (x.tv_sec) = ntohl(*p++); \ | 2438 | (x.tv_sec) = ntohl(*p++); \ |
@@ -2588,7 +2584,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2588 | return -EIO; | 2584 | return -EIO; |
2589 | if (likely(bitmap[0] & FATTR4_WORD0_CHANGE)) { | 2585 | if (likely(bitmap[0] & FATTR4_WORD0_CHANGE)) { |
2590 | READ_BUF(8); | 2586 | READ_BUF(8); |
2591 | READ64(*change); | 2587 | p = xdr_decode_hyper(p, change); |
2592 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; | 2588 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; |
2593 | ret = NFS_ATTR_FATTR_CHANGE; | 2589 | ret = NFS_ATTR_FATTR_CHANGE; |
2594 | } | 2590 | } |
@@ -2607,7 +2603,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t * | |||
2607 | return -EIO; | 2603 | return -EIO; |
2608 | if (likely(bitmap[0] & FATTR4_WORD0_SIZE)) { | 2604 | if (likely(bitmap[0] & FATTR4_WORD0_SIZE)) { |
2609 | READ_BUF(8); | 2605 | READ_BUF(8); |
2610 | READ64(*size); | 2606 | p = xdr_decode_hyper(p, size); |
2611 | bitmap[0] &= ~FATTR4_WORD0_SIZE; | 2607 | bitmap[0] &= ~FATTR4_WORD0_SIZE; |
2612 | ret = NFS_ATTR_FATTR_SIZE; | 2608 | ret = NFS_ATTR_FATTR_SIZE; |
2613 | } | 2609 | } |
@@ -2658,8 +2654,8 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs | |||
2658 | return -EIO; | 2654 | return -EIO; |
2659 | if (likely(bitmap[0] & FATTR4_WORD0_FSID)) { | 2655 | if (likely(bitmap[0] & FATTR4_WORD0_FSID)) { |
2660 | READ_BUF(16); | 2656 | READ_BUF(16); |
2661 | READ64(fsid->major); | 2657 | p = xdr_decode_hyper(p, &fsid->major); |
2662 | READ64(fsid->minor); | 2658 | p = xdr_decode_hyper(p, &fsid->minor); |
2663 | bitmap[0] &= ~FATTR4_WORD0_FSID; | 2659 | bitmap[0] &= ~FATTR4_WORD0_FSID; |
2664 | ret = NFS_ATTR_FATTR_FSID; | 2660 | ret = NFS_ATTR_FATTR_FSID; |
2665 | } | 2661 | } |
@@ -2711,7 +2707,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2711 | return -EIO; | 2707 | return -EIO; |
2712 | if (likely(bitmap[0] & FATTR4_WORD0_FILEID)) { | 2708 | if (likely(bitmap[0] & FATTR4_WORD0_FILEID)) { |
2713 | READ_BUF(8); | 2709 | READ_BUF(8); |
2714 | READ64(*fileid); | 2710 | p = xdr_decode_hyper(p, fileid); |
2715 | bitmap[0] &= ~FATTR4_WORD0_FILEID; | 2711 | bitmap[0] &= ~FATTR4_WORD0_FILEID; |
2716 | ret = NFS_ATTR_FATTR_FILEID; | 2712 | ret = NFS_ATTR_FATTR_FILEID; |
2717 | } | 2713 | } |
@@ -2729,7 +2725,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma | |||
2729 | return -EIO; | 2725 | return -EIO; |
2730 | if (likely(bitmap[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) { | 2726 | if (likely(bitmap[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) { |
2731 | READ_BUF(8); | 2727 | READ_BUF(8); |
2732 | READ64(*fileid); | 2728 | p = xdr_decode_hyper(p, fileid); |
2733 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | 2729 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; |
2734 | ret = NFS_ATTR_FATTR_FILEID; | 2730 | ret = NFS_ATTR_FATTR_FILEID; |
2735 | } | 2731 | } |
@@ -2747,7 +2743,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2747 | return -EIO; | 2743 | return -EIO; |
2748 | if (likely(bitmap[0] & FATTR4_WORD0_FILES_AVAIL)) { | 2744 | if (likely(bitmap[0] & FATTR4_WORD0_FILES_AVAIL)) { |
2749 | READ_BUF(8); | 2745 | READ_BUF(8); |
2750 | READ64(*res); | 2746 | p = xdr_decode_hyper(p, res); |
2751 | bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; | 2747 | bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; |
2752 | } | 2748 | } |
2753 | dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res); | 2749 | dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res); |
@@ -2764,7 +2760,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2764 | return -EIO; | 2760 | return -EIO; |
2765 | if (likely(bitmap[0] & FATTR4_WORD0_FILES_FREE)) { | 2761 | if (likely(bitmap[0] & FATTR4_WORD0_FILES_FREE)) { |
2766 | READ_BUF(8); | 2762 | READ_BUF(8); |
2767 | READ64(*res); | 2763 | p = xdr_decode_hyper(p, res); |
2768 | bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; | 2764 | bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; |
2769 | } | 2765 | } |
2770 | dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res); | 2766 | dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res); |
@@ -2781,7 +2777,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2781 | return -EIO; | 2777 | return -EIO; |
2782 | if (likely(bitmap[0] & FATTR4_WORD0_FILES_TOTAL)) { | 2778 | if (likely(bitmap[0] & FATTR4_WORD0_FILES_TOTAL)) { |
2783 | READ_BUF(8); | 2779 | READ_BUF(8); |
2784 | READ64(*res); | 2780 | p = xdr_decode_hyper(p, res); |
2785 | bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; | 2781 | bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; |
2786 | } | 2782 | } |
2787 | dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res); | 2783 | dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res); |
@@ -2910,7 +2906,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2910 | return -EIO; | 2906 | return -EIO; |
2911 | if (likely(bitmap[0] & FATTR4_WORD0_MAXFILESIZE)) { | 2907 | if (likely(bitmap[0] & FATTR4_WORD0_MAXFILESIZE)) { |
2912 | READ_BUF(8); | 2908 | READ_BUF(8); |
2913 | READ64(*res); | 2909 | p = xdr_decode_hyper(p, res); |
2914 | bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; | 2910 | bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; |
2915 | } | 2911 | } |
2916 | dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res); | 2912 | dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res); |
@@ -2962,7 +2958,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
2962 | if (likely(bitmap[0] & FATTR4_WORD0_MAXREAD)) { | 2958 | if (likely(bitmap[0] & FATTR4_WORD0_MAXREAD)) { |
2963 | uint64_t maxread; | 2959 | uint64_t maxread; |
2964 | READ_BUF(8); | 2960 | READ_BUF(8); |
2965 | READ64(maxread); | 2961 | p = xdr_decode_hyper(p, &maxread); |
2966 | if (maxread > 0x7FFFFFFF) | 2962 | if (maxread > 0x7FFFFFFF) |
2967 | maxread = 0x7FFFFFFF; | 2963 | maxread = 0x7FFFFFFF; |
2968 | *res = (uint32_t)maxread; | 2964 | *res = (uint32_t)maxread; |
@@ -2983,7 +2979,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32 | |||
2983 | if (likely(bitmap[0] & FATTR4_WORD0_MAXWRITE)) { | 2979 | if (likely(bitmap[0] & FATTR4_WORD0_MAXWRITE)) { |
2984 | uint64_t maxwrite; | 2980 | uint64_t maxwrite; |
2985 | READ_BUF(8); | 2981 | READ_BUF(8); |
2986 | READ64(maxwrite); | 2982 | p = xdr_decode_hyper(p, &maxwrite); |
2987 | if (maxwrite > 0x7FFFFFFF) | 2983 | if (maxwrite > 0x7FFFFFFF) |
2988 | maxwrite = 0x7FFFFFFF; | 2984 | maxwrite = 0x7FFFFFFF; |
2989 | *res = (uint32_t)maxwrite; | 2985 | *res = (uint32_t)maxwrite; |
@@ -3122,7 +3118,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
3122 | return -EIO; | 3118 | return -EIO; |
3123 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_AVAIL)) { | 3119 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_AVAIL)) { |
3124 | READ_BUF(8); | 3120 | READ_BUF(8); |
3125 | READ64(*res); | 3121 | p = xdr_decode_hyper(p, res); |
3126 | bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; | 3122 | bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; |
3127 | } | 3123 | } |
3128 | dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res); | 3124 | dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res); |
@@ -3139,7 +3135,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
3139 | return -EIO; | 3135 | return -EIO; |
3140 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_FREE)) { | 3136 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_FREE)) { |
3141 | READ_BUF(8); | 3137 | READ_BUF(8); |
3142 | READ64(*res); | 3138 | p = xdr_decode_hyper(p, res); |
3143 | bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; | 3139 | bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; |
3144 | } | 3140 | } |
3145 | dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res); | 3141 | dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res); |
@@ -3156,7 +3152,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
3156 | return -EIO; | 3152 | return -EIO; |
3157 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_TOTAL)) { | 3153 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_TOTAL)) { |
3158 | READ_BUF(8); | 3154 | READ_BUF(8); |
3159 | READ64(*res); | 3155 | p = xdr_decode_hyper(p, res); |
3160 | bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; | 3156 | bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; |
3161 | } | 3157 | } |
3162 | dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res); | 3158 | dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res); |
@@ -3173,7 +3169,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
3173 | return -EIO; | 3169 | return -EIO; |
3174 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_USED)) { | 3170 | if (likely(bitmap[1] & FATTR4_WORD1_SPACE_USED)) { |
3175 | READ_BUF(8); | 3171 | READ_BUF(8); |
3176 | READ64(*used); | 3172 | p = xdr_decode_hyper(p, used); |
3177 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; | 3173 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; |
3178 | ret = NFS_ATTR_FATTR_SPACE_USED; | 3174 | ret = NFS_ATTR_FATTR_SPACE_USED; |
3179 | } | 3175 | } |
@@ -3189,7 +3185,7 @@ static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) | |||
3189 | uint32_t nsec; | 3185 | uint32_t nsec; |
3190 | 3186 | ||
3191 | READ_BUF(12); | 3187 | READ_BUF(12); |
3192 | READ64(sec); | 3188 | p = xdr_decode_hyper(p, &sec); |
3193 | nsec = be32_to_cpup(p++); | 3189 | nsec = be32_to_cpup(p++); |
3194 | time->tv_sec = (time_t)sec; | 3190 | time->tv_sec = (time_t)sec; |
3195 | time->tv_nsec = (long)nsec; | 3191 | time->tv_nsec = (long)nsec; |
@@ -3273,8 +3269,8 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c | |||
3273 | 3269 | ||
3274 | READ_BUF(20); | 3270 | READ_BUF(20); |
3275 | cinfo->atomic = be32_to_cpup(p++); | 3271 | cinfo->atomic = be32_to_cpup(p++); |
3276 | READ64(cinfo->before); | 3272 | p = xdr_decode_hyper(p, &cinfo->before); |
3277 | READ64(cinfo->after); | 3273 | p = xdr_decode_hyper(p, &cinfo->after); |
3278 | return 0; | 3274 | return 0; |
3279 | } | 3275 | } |
3280 | 3276 | ||
@@ -3619,8 +3615,8 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) | |||
3619 | uint32_t namelen, type; | 3615 | uint32_t namelen, type; |
3620 | 3616 | ||
3621 | READ_BUF(32); | 3617 | READ_BUF(32); |
3622 | READ64(offset); | 3618 | p = xdr_decode_hyper(p, &offset); |
3623 | READ64(length); | 3619 | p = xdr_decode_hyper(p, &length); |
3624 | type = be32_to_cpup(p++); | 3620 | type = be32_to_cpup(p++); |
3625 | if (fl != NULL) { | 3621 | if (fl != NULL) { |
3626 | fl->fl_start = (loff_t)offset; | 3622 | fl->fl_start = (loff_t)offset; |
@@ -3632,7 +3628,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) | |||
3632 | fl->fl_type = F_RDLCK; | 3628 | fl->fl_type = F_RDLCK; |
3633 | fl->fl_pid = 0; | 3629 | fl->fl_pid = 0; |
3634 | } | 3630 | } |
3635 | READ64(clientid); | 3631 | p = xdr_decode_hyper(p, &clientid); |
3636 | namelen = be32_to_cpup(p++); | 3632 | namelen = be32_to_cpup(p++); |
3637 | READ_BUF(namelen); | 3633 | READ_BUF(namelen); |
3638 | return -NFS4ERR_DENIED; | 3634 | return -NFS4ERR_DENIED; |
@@ -3697,7 +3693,7 @@ static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) | |||
3697 | limit_type = be32_to_cpup(p++); | 3693 | limit_type = be32_to_cpup(p++); |
3698 | switch (limit_type) { | 3694 | switch (limit_type) { |
3699 | case 1: | 3695 | case 1: |
3700 | READ64(*maxsize); | 3696 | p = xdr_decode_hyper(p, maxsize); |
3701 | break; | 3697 | break; |
3702 | case 2: | 3698 | case 2: |
3703 | nblocks = be32_to_cpup(p++); | 3699 | nblocks = be32_to_cpup(p++); |
@@ -4090,7 +4086,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | |||
4090 | nfserr = be32_to_cpup(p++); | 4086 | nfserr = be32_to_cpup(p++); |
4091 | if (nfserr == NFS_OK) { | 4087 | if (nfserr == NFS_OK) { |
4092 | READ_BUF(8 + NFS4_VERIFIER_SIZE); | 4088 | READ_BUF(8 + NFS4_VERIFIER_SIZE); |
4093 | READ64(clp->cl_clientid); | 4089 | p = xdr_decode_hyper(p, &clp->cl_clientid); |
4094 | COPYMEM(clp->cl_confirm.data, NFS4_VERIFIER_SIZE); | 4090 | COPYMEM(clp->cl_confirm.data, NFS4_VERIFIER_SIZE); |
4095 | } else if (nfserr == NFSERR_CLID_INUSE) { | 4091 | } else if (nfserr == NFSERR_CLID_INUSE) { |
4096 | uint32_t len; | 4092 | uint32_t len; |
@@ -4151,7 +4147,7 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
4151 | return status; | 4147 | return status; |
4152 | 4148 | ||
4153 | READ_BUF(8); | 4149 | READ_BUF(8); |
4154 | READ64(clp->cl_ex_clid); | 4150 | p = xdr_decode_hyper(p, &clp->cl_ex_clid); |
4155 | READ_BUF(12); | 4151 | READ_BUF(12); |
4156 | clp->cl_seqid = be32_to_cpup(p++); | 4152 | clp->cl_seqid = be32_to_cpup(p++); |
4157 | clp->cl_exchange_flags = be32_to_cpup(p++); | 4153 | clp->cl_exchange_flags = be32_to_cpup(p++); |