* task to translate them into Linux-specific versions which are more
* consistent with the style used in NFSv2/v3...
*/
-#define WRITEMEM(ptr,nbytes) do { \
- p = xdr_encode_opaque_fixed(p, ptr, nbytes); \
-} while (0)
-
#define RESERVE_SPACE(nbytes) do { \
p = xdr_reserve_space(xdr, nbytes); \
BUG_ON(!p); \
BUG_ON(hdr->taglen > NFS4_MAXTAGLEN);
RESERVE_SPACE(12+(XDR_QUADLEN(hdr->taglen)<<2));
*p++ = cpu_to_be32(hdr->taglen);
- WRITEMEM(hdr->tag, hdr->taglen);
+ p = xdr_encode_opaque_fixed(p, hdr->tag, hdr->taglen);
*p++ = cpu_to_be32(hdr->minorversion);
hdr->nops_p = p;
*p++ = cpu_to_be32(hdr->nops);
if (iap->ia_valid & ATTR_UID) {
bmval1 |= FATTR4_WORD1_OWNER;
*p++ = cpu_to_be32(owner_namelen);
- WRITEMEM(owner_name, owner_namelen);
+ p = xdr_encode_opaque_fixed(p, owner_name, owner_namelen);
}
if (iap->ia_valid & ATTR_GID) {
bmval1 |= FATTR4_WORD1_OWNER_GROUP;
*p++ = cpu_to_be32(owner_grouplen);
- WRITEMEM(owner_group, owner_grouplen);
+ p = xdr_encode_opaque_fixed(p, owner_group, owner_grouplen);
}
if (iap->ia_valid & ATTR_ATIME_SET) {
bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET;
RESERVE_SPACE(8+NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(OP_CLOSE);
*p++ = cpu_to_be32(arg->seqid->sequence->counter);
- WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE);
hdr->nops++;
hdr->replen += decode_close_maxsz;
}
RESERVE_SPACE(4 + create->name->len);
*p++ = cpu_to_be32(create->name->len);
- WRITEMEM(create->name->name, create->name->len);
+ p = xdr_encode_opaque_fixed(p, create->name->name, create->name->len);
hdr->nops++;
hdr->replen += decode_create_maxsz;
RESERVE_SPACE(8 + name->len);
*p++ = cpu_to_be32(OP_LINK);
*p++ = cpu_to_be32(name->len);
- WRITEMEM(name->name, name->len);
+ p = xdr_encode_opaque_fixed(p, name->name, name->len);
hdr->nops++;
hdr->replen += decode_link_maxsz;
}
if (args->new_lock_owner){
RESERVE_SPACE(4+NFS4_STATEID_SIZE+32);
*p++ = cpu_to_be32(args->open_seqid->sequence->counter);
- WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, args->open_stateid->data, NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(args->lock_seqid->sequence->counter);
p = xdr_encode_hyper(p, args->lock_owner.clientid);
*p++ = cpu_to_be32(16);
- WRITEMEM("lock id:", 8);
+ p = xdr_encode_opaque_fixed(p, "lock id:", 8);
p = xdr_encode_hyper(p, args->lock_owner.id);
}
else {
RESERVE_SPACE(NFS4_STATEID_SIZE+4);
- WRITEMEM(args->lock_stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, args->lock_stateid->data, NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(args->lock_seqid->sequence->counter);
}
hdr->nops++;
p = xdr_encode_hyper(p, nfs4_lock_length(args->fl));
p = xdr_encode_hyper(p, args->lock_owner.clientid);
*p++ = cpu_to_be32(16);
- WRITEMEM("lock id:", 8);
+ p = xdr_encode_opaque_fixed(p, "lock id:", 8);
p = xdr_encode_hyper(p, args->lock_owner.id);
hdr->nops++;
hdr->replen += decode_lockt_maxsz;
*p++ = cpu_to_be32(OP_LOCKU);
*p++ = cpu_to_be32(nfs4_lock_type(args->fl, 0));
*p++ = cpu_to_be32(args->seqid->sequence->counter);
- WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, args->stateid->data, NFS4_STATEID_SIZE);
p = xdr_encode_hyper(p, args->fl->fl_start);
p = xdr_encode_hyper(p, nfs4_lock_length(args->fl));
hdr->nops++;
RESERVE_SPACE(8 + len);
*p++ = cpu_to_be32(OP_LOOKUP);
*p++ = cpu_to_be32(len);
- WRITEMEM(name->name, len);
+ p = xdr_encode_opaque_fixed(p, name->name, len);
hdr->nops++;
hdr->replen += decode_lookup_maxsz;
}
RESERVE_SPACE(28);
p = xdr_encode_hyper(p, arg->clientid);
*p++ = cpu_to_be32(16);
- WRITEMEM("open id:", 8);
+ p = xdr_encode_opaque_fixed(p, "open id:", 8);
p = xdr_encode_hyper(p, arg->id);
}
RESERVE_SPACE(4+NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(NFS4_OPEN_CLAIM_DELEGATE_CUR);
- WRITEMEM(stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, stateid->data, NFS4_STATEID_SIZE);
encode_string(xdr, name->len, name->name);
}
RESERVE_SPACE(4+NFS4_STATEID_SIZE+4);
*p++ = cpu_to_be32(OP_OPEN_CONFIRM);
- WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(arg->seqid->sequence->counter);
hdr->nops++;
hdr->replen += decode_open_confirm_maxsz;
RESERVE_SPACE(4+NFS4_STATEID_SIZE+4);
*p++ = cpu_to_be32(OP_OPEN_DOWNGRADE);
- WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, arg->stateid->data, NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(arg->seqid->sequence->counter);
encode_share_access(xdr, arg->fmode);
hdr->nops++;
RESERVE_SPACE(8 + len);
*p++ = cpu_to_be32(OP_PUTFH);
*p++ = cpu_to_be32(len);
- WRITEMEM(fh->data, len);
+ p = xdr_encode_opaque_fixed(p, fh->data, len);
hdr->nops++;
hdr->replen += decode_putfh_maxsz;
}
RESERVE_SPACE(NFS4_STATEID_SIZE);
if (ctx->state != NULL) {
nfs4_copy_stateid(&stateid, ctx->state, ctx->lockowner);
- WRITEMEM(stateid.data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, stateid.data, NFS4_STATEID_SIZE);
} else
- WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, zero_stateid.data, NFS4_STATEID_SIZE);
}
static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, struct compound_hdr *hdr)
RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20);
*p++ = cpu_to_be32(OP_READDIR);
p = xdr_encode_hyper(p, readdir->cookie);
- WRITEMEM(readdir->verifier.data, NFS4_VERIFIER_SIZE);
+ p = xdr_encode_opaque_fixed(p, readdir->verifier.data, NFS4_VERIFIER_SIZE);
*p++ = cpu_to_be32(readdir->count >> 1); /* We're not doing readdirplus */
*p++ = cpu_to_be32(readdir->count);
*p++ = cpu_to_be32(2);
RESERVE_SPACE(8 + name->len);
*p++ = cpu_to_be32(OP_REMOVE);
*p++ = cpu_to_be32(name->len);
- WRITEMEM(name->name, name->len);
+ p = xdr_encode_opaque_fixed(p, name->name, name->len);
hdr->nops++;
hdr->replen += decode_remove_maxsz;
}
RESERVE_SPACE(8 + oldname->len);
*p++ = cpu_to_be32(OP_RENAME);
*p++ = cpu_to_be32(oldname->len);
- WRITEMEM(oldname->name, oldname->len);
+ p = xdr_encode_opaque_fixed(p, oldname->name, oldname->len);
RESERVE_SPACE(4 + newname->len);
*p++ = cpu_to_be32(newname->len);
- WRITEMEM(newname->name, newname->len);
+ p = xdr_encode_opaque_fixed(p, newname->name, newname->len);
hdr->nops++;
hdr->replen += decode_rename_maxsz;
}
RESERVE_SPACE(4+NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(OP_SETATTR);
- WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, zero_stateid.data, NFS4_STATEID_SIZE);
RESERVE_SPACE(2*4);
*p++ = cpu_to_be32(1);
*p++ = cpu_to_be32(FATTR4_WORD0_ACL);
RESERVE_SPACE(4+NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(OP_SETATTR);
- WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, arg->stateid.data, NFS4_STATEID_SIZE);
hdr->nops++;
hdr->replen += decode_setattr_maxsz;
encode_attrs(xdr, arg->iap, server);
RESERVE_SPACE(4 + NFS4_VERIFIER_SIZE);
*p++ = cpu_to_be32(OP_SETCLIENTID);
- WRITEMEM(setclientid->sc_verifier->data, NFS4_VERIFIER_SIZE);
+ p = xdr_encode_opaque_fixed(p, setclientid->sc_verifier->data, NFS4_VERIFIER_SIZE);
encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name);
RESERVE_SPACE(4);
RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE);
*p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM);
p = xdr_encode_hyper(p, client_state->cl_clientid);
- WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE);
+ p = xdr_encode_opaque_fixed(p, client_state->cl_confirm.data, NFS4_VERIFIER_SIZE);
hdr->nops++;
hdr->replen += decode_setclientid_confirm_maxsz;
}
RESERVE_SPACE(4+NFS4_STATEID_SIZE);
*p++ = cpu_to_be32(OP_DELEGRETURN);
- WRITEMEM(stateid->data, NFS4_STATEID_SIZE);
+ p = xdr_encode_opaque_fixed(p, stateid->data, NFS4_STATEID_SIZE);
hdr->nops++;
hdr->replen += decode_delegreturn_maxsz;
}
RESERVE_SPACE(4 + sizeof(args->verifier->data));
*p++ = cpu_to_be32(OP_EXCHANGE_ID);
- WRITEMEM(args->verifier->data, sizeof(args->verifier->data));
+ p = xdr_encode_opaque_fixed(p, args->verifier->data, sizeof(args->verifier->data));
encode_string(xdr, args->id_len, args->id);
clp->cl_ipaddr);
RESERVE_SPACE(16 + len);
*p++ = cpu_to_be32(len);
- WRITEMEM(machine_name, len);
+ p = xdr_encode_opaque_fixed(p, machine_name, len);
*p++ = cpu_to_be32(0); /* UID */
*p++ = cpu_to_be32(0); /* GID */
*p++ = cpu_to_be32(0); /* No more gids */
__be32 *p;
RESERVE_SPACE(4 + NFS4_MAX_SESSIONID_LEN);
*p++ = cpu_to_be32(OP_DESTROY_SESSION);
- WRITEMEM(session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
+ p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
hdr->nops++;
hdr->replen += decode_destroy_session_maxsz;
}
slot->seq_nr, args->sa_slotid,
tp->highest_used_slotid, args->sa_cache_this);
RESERVE_SPACE(NFS4_MAX_SESSIONID_LEN + 16);
- WRITEMEM(session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
+ p = xdr_encode_opaque_fixed(p, session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
*p++ = cpu_to_be32(slot->seq_nr);
*p++ = cpu_to_be32(args->sa_slotid);
*p++ = cpu_to_be32(tp->highest_used_slotid);