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 /fs/nfsd | |
parent | 0c0c267ba96f606b541ab8e4bcde54e6b3f0198f (diff) | |
download | linux-stable-d05d5744ef67879877dbe2e3d0fb9fcc27ee44e5.tar.gz linux-stable-d05d5744ef67879877dbe2e3d0fb9fcc27ee44e5.tar.bz2 linux-stable-d05d5744ef67879877dbe2e3d0fb9fcc27ee44e5.zip |
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>
Diffstat (limited to 'fs/nfsd')
-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) DECODE_TAIL; } -static void write32(__be32 **p, u32 n) -{ - *(*p)++ = htonl(n); -} - -static void write64(__be32 **p, u64 n) -{ - write32(p, (n >> 32)); - write32(p, (u32)n); -} - -static void write_change(__be32 **p, struct kstat *stat, struct inode *inode) +static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode) { if (IS_I_VERSION(inode)) { - write64(p, inode->i_version); + p = xdr_encode_hyper(p, inode->i_version); } else { - write32(p, stat->ctime.tv_sec); - write32(p, stat->ctime.tv_nsec); + *p++ = cpu_to_be32(stat->ctime.tv_sec); + *p++ = cpu_to_be32(stat->ctime.tv_nsec); } + return p; } -static void write_cinfo(__be32 **p, struct nfsd4_change_info *c) +static __be32 *encode_cinfo(__be32 *p, struct nfsd4_change_info *c) { - write32(p, c->atomic); + *p++ = cpu_to_be32(c->atomic); if (c->change_supported) { - write64(p, c->before_change); - write64(p, c->after_change); + p = xdr_encode_hyper(p, c->before_change); + p = xdr_encode_hyper(p, c->after_change); } else { - write32(p, c->before_ctime_sec); - write32(p, c->before_ctime_nsec); - write32(p, c->after_ctime_sec); - write32(p, c->after_ctime_nsec); + *p++ = cpu_to_be32(c->before_ctime_sec); + *p++ = cpu_to_be32(c->before_ctime_nsec); + *p++ = cpu_to_be32(c->after_ctime_sec); + *p++ = cpu_to_be32(c->after_ctime_nsec); } + return p; } /* 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, p = xdr_reserve_space(xdr, 8); if (!p) goto out_resource; - write_change(&p, &stat, dentry->d_inode); + p = encode_change(p, &stat, dentry->d_inode); } if (bmval0 & FATTR4_WORD0_SIZE) { p = xdr_reserve_space(xdr, 8); @@ -2817,7 +2808,7 @@ nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_ p = xdr_reserve_space(xdr, 32); if (!p) return nfserr_resource; - write_cinfo(&p, &create->cr_cinfo); + p = encode_cinfo(p, &create->cr_cinfo); *p++ = cpu_to_be32(2); *p++ = cpu_to_be32(create->cr_bmval[0]); *p++ = cpu_to_be32(create->cr_bmval[1]); @@ -2940,7 +2931,7 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_li p = xdr_reserve_space(xdr, 20); if (!p) return nfserr_resource; - write_cinfo(&p, &link->li_cinfo); + p = encode_cinfo(p, &link->li_cinfo); } return nfserr; } @@ -2961,7 +2952,7 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op p = xdr_reserve_space(xdr, 40); if (!p) return nfserr_resource; - write_cinfo(&p, &open->op_cinfo); + p = encode_cinfo(p, &open->op_cinfo); *p++ = cpu_to_be32(open->op_rflags); *p++ = cpu_to_be32(2); *p++ = cpu_to_be32(open->op_bmval[0]); @@ -3381,7 +3372,7 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_ p = xdr_reserve_space(xdr, 20); if (!p) return nfserr_resource; - write_cinfo(&p, &remove->rm_cinfo); + p = encode_cinfo(p, &remove->rm_cinfo); } return nfserr; } @@ -3396,8 +3387,8 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_ p = xdr_reserve_space(xdr, 40); if (!p) return nfserr_resource; - write_cinfo(&p, &rename->rn_sinfo); - write_cinfo(&p, &rename->rn_tinfo); + p = encode_cinfo(p, &rename->rn_sinfo); + p = encode_cinfo(p, &rename->rn_tinfo); } return nfserr; } |