diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-03-22 18:48:39 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-30 17:32:16 -0400 |
commit | d05d5744ef67879877dbe2e3d0fb9fcc27ee44e5 (patch) | |
tree | 00d5668c83592bede658c9a648abaa1170e18c85 | |
parent | 0c0c267ba96f606b541ab8e4bcde54e6b3f0198f (diff) |
nfsd4: kill write32, write64
And switch a couple other functions from the encode(&p,...) convention
to the p = encode(p,...) convention mostly used elsewhere.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 3844dbe0cb6e..3e347a1caec4 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1683,39 +1683,30 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1683 | DECODE_TAIL; | 1683 | DECODE_TAIL; |
1684 | } | 1684 | } |
1685 | 1685 | ||
1686 | static void write32(__be32 **p, u32 n) | 1686 | static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode) |
1687 | { | ||
1688 | *(*p)++ = htonl(n); | ||
1689 | } | ||
1690 | |||
1691 | static void write64(__be32 **p, u64 n) | ||
1692 | { | ||
1693 | write32(p, (n >> 32)); | ||
1694 | write32(p, (u32)n); | ||
1695 | } | ||
1696 | |||
1697 | static void write_change(__be32 **p, struct kstat *stat, struct inode *inode) | ||
1698 | { | 1687 | { |
1699 | if (IS_I_VERSION(inode)) { | 1688 | if (IS_I_VERSION(inode)) { |
1700 | write64(p, inode->i_version); | 1689 | p = xdr_encode_hyper(p, inode->i_version); |
1701 | } else { | 1690 | } else { |
1702 | write32(p, stat->ctime.tv_sec); | 1691 | *p++ = cpu_to_be32(stat->ctime.tv_sec); |
1703 | write32(p, stat->ctime.tv_nsec); | 1692 | *p++ = cpu_to_be32(stat->ctime.tv_nsec); |
1704 | } | 1693 | } |
1694 | return p; | ||
1705 | } | 1695 | } |
1706 | 1696 | ||
1707 | static void write_cinfo(__be32 **p, struct nfsd4_change_info *c) | 1697 | static __be32 *encode_cinfo(__be32 *p, struct nfsd4_change_info *c) |
1708 | { | 1698 | { |
1709 | write32(p, c->atomic); | 1699 | *p++ = cpu_to_be32(c->atomic); |
1710 | if (c->change_supported) { | 1700 | if (c->change_supported) { |
1711 | write64(p, c->before_change); | 1701 | p = xdr_encode_hyper(p, c->before_change); |
1712 | write64(p, c->after_change); | 1702 | p = xdr_encode_hyper(p, c->after_change); |
1713 | } else { | 1703 | } else { |
1714 | write32(p, c->before_ctime_sec); | 1704 | *p++ = cpu_to_be32(c->before_ctime_sec); |
1715 | write32(p, c->before_ctime_nsec); | 1705 | *p++ = cpu_to_be32(c->before_ctime_nsec); |
1716 | write32(p, c->after_ctime_sec); | 1706 | *p++ = cpu_to_be32(c->after_ctime_sec); |
1717 | write32(p, c->after_ctime_nsec); | 1707 | *p++ = cpu_to_be32(c->after_ctime_nsec); |
1718 | } | 1708 | } |
1709 | return p; | ||
1719 | } | 1710 | } |
1720 | 1711 | ||
1721 | /* Encode as an array of strings the string given with components | 1712 | /* Encode as an array of strings the string given with components |
@@ -2186,7 +2177,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
2186 | p = xdr_reserve_space(xdr, 8); | 2177 | p = xdr_reserve_space(xdr, 8); |
2187 | if (!p) | 2178 | if (!p) |
2188 | goto out_resource; | 2179 | goto out_resource; |
2189 | write_change(&p, &stat, dentry->d_inode); | 2180 | p = encode_change(p, &stat, dentry->d_inode); |
2190 | } | 2181 | } |
2191 | if (bmval0 & FATTR4_WORD0_SIZE) { | 2182 | if (bmval0 & FATTR4_WORD0_SIZE) { |
2192 | p = xdr_reserve_space(xdr, 8); | 2183 | p = xdr_reserve_space(xdr, 8); |
@@ -2817,7 +2808,7 @@ nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_ | |||
2817 | p = xdr_reserve_space(xdr, 32); | 2808 | p = xdr_reserve_space(xdr, 32); |
2818 | if (!p) | 2809 | if (!p) |
2819 | return nfserr_resource; | 2810 | return nfserr_resource; |
2820 | write_cinfo(&p, &create->cr_cinfo); | 2811 | p = encode_cinfo(p, &create->cr_cinfo); |
2821 | *p++ = cpu_to_be32(2); | 2812 | *p++ = cpu_to_be32(2); |
2822 | *p++ = cpu_to_be32(create->cr_bmval[0]); | 2813 | *p++ = cpu_to_be32(create->cr_bmval[0]); |
2823 | *p++ = cpu_to_be32(create->cr_bmval[1]); | 2814 | *p++ = cpu_to_be32(create->cr_bmval[1]); |
@@ -2940,7 +2931,7 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_li | |||
2940 | p = xdr_reserve_space(xdr, 20); | 2931 | p = xdr_reserve_space(xdr, 20); |
2941 | if (!p) | 2932 | if (!p) |
2942 | return nfserr_resource; | 2933 | return nfserr_resource; |
2943 | write_cinfo(&p, &link->li_cinfo); | 2934 | p = encode_cinfo(p, &link->li_cinfo); |
2944 | } | 2935 | } |
2945 | return nfserr; | 2936 | return nfserr; |
2946 | } | 2937 | } |
@@ -2961,7 +2952,7 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op | |||
2961 | p = xdr_reserve_space(xdr, 40); | 2952 | p = xdr_reserve_space(xdr, 40); |
2962 | if (!p) | 2953 | if (!p) |
2963 | return nfserr_resource; | 2954 | return nfserr_resource; |
2964 | write_cinfo(&p, &open->op_cinfo); | 2955 | p = encode_cinfo(p, &open->op_cinfo); |
2965 | *p++ = cpu_to_be32(open->op_rflags); | 2956 | *p++ = cpu_to_be32(open->op_rflags); |
2966 | *p++ = cpu_to_be32(2); | 2957 | *p++ = cpu_to_be32(2); |
2967 | *p++ = cpu_to_be32(open->op_bmval[0]); | 2958 | *p++ = cpu_to_be32(open->op_bmval[0]); |
@@ -3381,7 +3372,7 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_ | |||
3381 | p = xdr_reserve_space(xdr, 20); | 3372 | p = xdr_reserve_space(xdr, 20); |
3382 | if (!p) | 3373 | if (!p) |
3383 | return nfserr_resource; | 3374 | return nfserr_resource; |
3384 | write_cinfo(&p, &remove->rm_cinfo); | 3375 | p = encode_cinfo(p, &remove->rm_cinfo); |
3385 | } | 3376 | } |
3386 | return nfserr; | 3377 | return nfserr; |
3387 | } | 3378 | } |
@@ -3396,8 +3387,8 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_ | |||
3396 | p = xdr_reserve_space(xdr, 40); | 3387 | p = xdr_reserve_space(xdr, 40); |
3397 | if (!p) | 3388 | if (!p) |
3398 | return nfserr_resource; | 3389 | return nfserr_resource; |
3399 | write_cinfo(&p, &rename->rn_sinfo); | 3390 | p = encode_cinfo(p, &rename->rn_sinfo); |
3400 | write_cinfo(&p, &rename->rn_tinfo); | 3391 | p = encode_cinfo(p, &rename->rn_tinfo); |
3401 | } | 3392 | } |
3402 | return nfserr; | 3393 | return nfserr; |
3403 | } | 3394 | } |