* task to translate them into Linux-specific versions which are more
* consistent with the style used in NFSv2/v3...
*/
-#define READ32(x) (x) = ntohl(*p++)
#define READ64(x) do { \
(x) = (u64)ntohl(*p++) << 32; \
(x) |= ntohl(*p++); \
__be32 *p;
READ_BUF(4);
- READ32(*len);
+ *len = be32_to_cpup(p++);
READ_BUF(*len);
*string = (char *)p;
return 0;
__be32 *p;
READ_BUF(8);
- READ32(hdr->status);
- READ32(hdr->taglen);
+ hdr->status = be32_to_cpup(p++);
+ hdr->taglen = be32_to_cpup(p++);
READ_BUF(hdr->taglen + 4);
hdr->tag = (char *)p;
p += XDR_QUADLEN(hdr->taglen);
- READ32(hdr->nops);
+ hdr->nops = be32_to_cpup(p++);
if (unlikely(hdr->nops < 1))
return nfs4_stat_to_errno(hdr->status);
return 0;
int32_t nfserr;
READ_BUF(8);
- READ32(opnum);
+ opnum = be32_to_cpup(p++);
if (opnum != expected) {
dprintk("nfs: Server returned operation"
" %d but we issued a request for %d\n",
opnum, expected);
return -EIO;
}
- READ32(nfserr);
+ nfserr = be32_to_cpup(p++);
if (nfserr != NFS_OK)
return nfs4_stat_to_errno(nfserr);
return 0;
__be32 *p;
READ_BUF(4);
- READ32(bmlen);
+ bmlen = be32_to_cpup(p++);
bitmap[0] = bitmap[1] = 0;
READ_BUF((bmlen << 2));
if (bmlen > 0) {
- READ32(bitmap[0]);
+ bitmap[0] = be32_to_cpup(p++);
if (bmlen > 1)
- READ32(bitmap[1]);
+ bitmap[1] = be32_to_cpup(p++);
}
return 0;
}
__be32 *p;
READ_BUF(4);
- READ32(*attrlen);
+ *attrlen = be32_to_cpup(p++);
*savep = xdr->p;
return 0;
}
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_TYPE)) {
READ_BUF(4);
- READ32(*type);
+ *type = be32_to_cpup(p++);
if (*type < NF4REG || *type > NF4NAMEDATTR) {
dprintk("%s: bad type %d\n", __func__, *type);
return -EIO;
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) {
READ_BUF(4);
- READ32(*res);
+ *res = be32_to_cpup(p++);
bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT;
}
dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true");
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_SYMLINK_SUPPORT)) {
READ_BUF(4);
- READ32(*res);
+ *res = be32_to_cpup(p++);
bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT;
}
dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true");
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_LEASE_TIME)) {
READ_BUF(4);
- READ32(*res);
+ *res = be32_to_cpup(p++);
bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME;
}
dprintk("%s: file size=%u\n", __func__, (unsigned int)*res);
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_ACLSUPPORT)) {
READ_BUF(4);
- READ32(*res);
+ *res = be32_to_cpup(p++);
bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT;
}
dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res);
int status = 0;
READ_BUF(4);
- READ32(n);
+ n = be32_to_cpup(p++);
if (n == 0)
goto root_path;
dprintk("path ");
if (unlikely(status != 0))
goto out;
READ_BUF(4);
- READ32(n);
+ n = be32_to_cpup(p++);
if (n <= 0)
goto out_eio;
res->nlocations = 0;
struct nfs4_fs_location *loc = &res->locations[res->nlocations];
READ_BUF(4);
- READ32(m);
+ m = be32_to_cpup(p++);
loc->nservers = 0;
dprintk("%s: servers ", __func__);
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_MAXLINK)) {
READ_BUF(4);
- READ32(*maxlink);
+ *maxlink = be32_to_cpup(p++);
bitmap[0] &= ~FATTR4_WORD0_MAXLINK;
}
dprintk("%s: maxlink=%u\n", __func__, *maxlink);
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) {
READ_BUF(4);
- READ32(*maxname);
+ *maxname = be32_to_cpup(p++);
bitmap[0] &= ~FATTR4_WORD0_MAXNAME;
}
dprintk("%s: maxname=%u\n", __func__, *maxname);
return -EIO;
if (likely(bitmap[1] & FATTR4_WORD1_MODE)) {
READ_BUF(4);
- READ32(tmp);
+ tmp = be32_to_cpup(p++);
*mode = tmp & ~S_IFMT;
bitmap[1] &= ~FATTR4_WORD1_MODE;
ret = NFS_ATTR_FATTR_MODE;
return -EIO;
if (likely(bitmap[1] & FATTR4_WORD1_NUMLINKS)) {
READ_BUF(4);
- READ32(*nlink);
+ *nlink = be32_to_cpup(p++);
bitmap[1] &= ~FATTR4_WORD1_NUMLINKS;
ret = NFS_ATTR_FATTR_NLINK;
}
return -EIO;
if (likely(bitmap[1] & FATTR4_WORD1_OWNER)) {
READ_BUF(4);
- READ32(len);
+ len = be32_to_cpup(p++);
READ_BUF(len);
if (len < XDR_MAX_NETOBJ) {
if (nfs_map_name_to_uid(clp, (char *)p, len, uid) == 0)
return -EIO;
if (likely(bitmap[1] & FATTR4_WORD1_OWNER_GROUP)) {
READ_BUF(4);
- READ32(len);
+ len = be32_to_cpup(p++);
READ_BUF(len);
if (len < XDR_MAX_NETOBJ) {
if (nfs_map_group_to_gid(clp, (char *)p, len, gid) == 0)
dev_t tmp;
READ_BUF(8);
- READ32(major);
- READ32(minor);
+ major = be32_to_cpup(p++);
+ minor = be32_to_cpup(p++);
tmp = MKDEV(major, minor);
if (MAJOR(tmp) == major && MINOR(tmp) == minor)
*rdev = tmp;
READ_BUF(12);
READ64(sec);
- READ32(nsec);
+ nsec = be32_to_cpup(p++);
time->tv_sec = (time_t)sec;
time->tv_nsec = (long)nsec;
return 0;
__be32 *p;
READ_BUF(20);
- READ32(cinfo->atomic);
+ cinfo->atomic = be32_to_cpup(p++);
READ64(cinfo->before);
READ64(cinfo->after);
return 0;
if (status)
return status;
READ_BUF(8);
- READ32(supp);
- READ32(acc);
+ supp = be32_to_cpup(p++);
+ acc = be32_to_cpup(p++);
access->supported = supp;
access->access = acc;
return 0;
if ((status = decode_change_info(xdr, cinfo)))
return status;
READ_BUF(4);
- READ32(bmlen);
+ bmlen = be32_to_cpup(p++);
READ_BUF(bmlen << 2);
return 0;
}
return status;
READ_BUF(4);
- READ32(len);
+ len = be32_to_cpup(p++);
if (len > NFS4_FHSIZE)
return -EIO;
fh->size = len;
READ_BUF(32);
READ64(offset);
READ64(length);
- READ32(type);
+ type = be32_to_cpup(p++);
if (fl != NULL) {
fl->fl_start = (loff_t)offset;
fl->fl_end = fl->fl_start + (loff_t)length - 1;
fl->fl_pid = 0;
}
READ64(clientid);
- READ32(namelen);
+ namelen = be32_to_cpup(p++);
READ_BUF(namelen);
return -NFS4ERR_DENIED;
}
uint32_t limit_type, nblocks, blocksize;
READ_BUF(12);
- READ32(limit_type);
+ limit_type = be32_to_cpup(p++);
switch (limit_type) {
case 1:
READ64(*maxsize);
break;
case 2:
- READ32(nblocks);
- READ32(blocksize);
+ nblocks = be32_to_cpup(p++);
+ blocksize = be32_to_cpup(p++);
*maxsize = (uint64_t)nblocks * (uint64_t)blocksize;
}
return 0;
uint32_t delegation_type;
READ_BUF(4);
- READ32(delegation_type);
+ delegation_type = be32_to_cpup(p++);
if (delegation_type == NFS4_OPEN_DELEGATE_NONE) {
res->delegation_type = 0;
return 0;
}
READ_BUF(NFS4_STATEID_SIZE+4);
COPYMEM(res->delegation.data, NFS4_STATEID_SIZE);
- READ32(res->do_recall);
+ res->do_recall = be32_to_cpup(p++);
switch (delegation_type) {
case NFS4_OPEN_DELEGATE_READ:
decode_change_info(xdr, &res->cinfo);
READ_BUF(8);
- READ32(res->rflags);
- READ32(bmlen);
+ res->rflags = be32_to_cpup(p++);
+ bmlen = be32_to_cpup(p++);
if (bmlen > 10)
goto xdr_error;
READ_BUF(bmlen << 2);
savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE);
for (i = 0; i < savewords; ++i)
- READ32(res->attrset[i]);
+ res->attrset[i] = be32_to_cpup(p++);
for (; i < NFS4_BITMAP_SIZE; i++)
res->attrset[i] = 0;
if (status)
return status;
READ_BUF(8);
- READ32(eof);
- READ32(count);
+ eof = be32_to_cpup(p++);
+ count = be32_to_cpup(p++);
hdrlen = (u8 *) p - (u8 *) iov->iov_base;
recvd = req->rq_rcv_buf.len - hdrlen;
if (count > recvd) {
/* Convert length of symlink */
READ_BUF(4);
- READ32(len);
+ len = be32_to_cpup(p++);
if (len >= rcvbuf->page_len || len <= 0) {
dprintk("nfs: server returned giant symlink!\n");
return -ENAMETOOLONG;
if (status)
return status;
READ_BUF(4);
- READ32(bmlen);
+ bmlen = be32_to_cpup(p++);
READ_BUF(bmlen << 2);
return 0;
}
int32_t nfserr;
READ_BUF(8);
- READ32(opnum);
+ opnum = be32_to_cpup(p++);
if (opnum != OP_SETCLIENTID) {
dprintk("nfs: decode_setclientid: Server returned operation"
" %d\n", opnum);
return -EIO;
}
- READ32(nfserr);
+ nfserr = be32_to_cpup(p++);
if (nfserr == NFS_OK) {
READ_BUF(8 + NFS4_VERIFIER_SIZE);
READ64(clp->cl_clientid);
/* skip netid string */
READ_BUF(4);
- READ32(len);
+ len = be32_to_cpup(p++);
READ_BUF(len);
/* skip uaddr string */
READ_BUF(4);
- READ32(len);
+ len = be32_to_cpup(p++);
READ_BUF(len);
return -NFSERR_CLID_INUSE;
} else
return status;
READ_BUF(16);
- READ32(res->count);
- READ32(res->verf->committed);
+ res->count = be32_to_cpup(p++);
+ res->verf->committed = be32_to_cpup(p++);
COPYMEM(res->verf->verifier, 8);
return 0;
}
READ_BUF(8);
READ64(clp->cl_ex_clid);
READ_BUF(12);
- READ32(clp->cl_seqid);
- READ32(clp->cl_exchange_flags);
+ clp->cl_seqid = be32_to_cpup(p++);
+ clp->cl_exchange_flags = be32_to_cpup(p++);
/* We ask for SP4_NONE */
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
if (dummy != SP4_NONE)
return -EIO;
/* Throw away Major id */
READ_BUF(4);
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
READ_BUF(dummy);
/* Throw away server_scope */
READ_BUF(4);
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
READ_BUF(dummy);
/* Throw away Implementation id array */
READ_BUF(4);
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
READ_BUF(dummy);
return 0;
u32 nr_attrs;
READ_BUF(28);
- READ32(attrs->headerpadsz);
- READ32(attrs->max_rqst_sz);
- READ32(attrs->max_resp_sz);
- READ32(attrs->max_resp_sz_cached);
- READ32(attrs->max_ops);
- READ32(attrs->max_reqs);
- READ32(nr_attrs);
+ attrs->headerpadsz = be32_to_cpup(p++);
+ attrs->max_rqst_sz = be32_to_cpup(p++);
+ attrs->max_resp_sz = be32_to_cpup(p++);
+ attrs->max_resp_sz_cached = be32_to_cpup(p++);
+ attrs->max_ops = be32_to_cpup(p++);
+ attrs->max_reqs = be32_to_cpup(p++);
+ nr_attrs = be32_to_cpup(p++);
if (unlikely(nr_attrs > 1)) {
printk(KERN_WARNING "%s: Invalid rdma channel attrs count %u\n",
__func__, nr_attrs);
/* seqid, flags */
READ_BUF(8);
- READ32(clp->cl_seqid);
- READ32(session->flags);
+ clp->cl_seqid = be32_to_cpup(p++);
+ session->flags = be32_to_cpup(p++);
/* Channel attributes */
status = decode_chan_attrs(xdr, &session->fc_attrs);
goto out_err;
}
/* seqid */
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
if (dummy != slot->seq_nr) {
dprintk("%s Invalid sequence number\n", __func__);
goto out_err;
}
/* slot id */
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
if (dummy != res->sr_slotid) {
dprintk("%s Invalid slot id\n", __func__);
goto out_err;
}
/* highest slot id - currently not processed */
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
/* target highest slot id - currently not processed */
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
/* result flags - currently not processed */
- READ32(dummy);
+ dummy = be32_to_cpup(p++);
status = 0;
out_err:
res->sr_status = status;