{
__be32 *p;
- p = xdr_reserve_space(xdr, 4 + len);
- BUG_ON(p == NULL);
+ p = reserve_space(xdr, 4 + len);
xdr_encode_opaque(p, str, len);
}
hdr->replen = RPC_REPHDRSIZE + auth->au_rslack + 3 + hdr->taglen;
BUG_ON(hdr->taglen > NFS4_MAXTAGLEN);
- p = reserve_space(xdr, 4 + hdr->taglen + 8);
- p = xdr_encode_opaque(p, hdr->tag, hdr->taglen);
+ encode_string(xdr, hdr->taglen, hdr->tag);
+ p = reserve_space(xdr, 8);
*p++ = cpu_to_be32(hdr->minorversion);
hdr->nops_p = p;
*p = cpu_to_be32(hdr->nops);
{
__be32 *p;
- p = reserve_space(xdr, 8 + name->len);
- *p++ = cpu_to_be32(OP_LINK);
- xdr_encode_opaque(p, name->name, name->len);
+ p = reserve_space(xdr, 4);
+ *p = cpu_to_be32(OP_LINK);
+ encode_string(xdr, name->len, name->name);
hdr->nops++;
hdr->replen += decode_link_maxsz;
}
static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr)
{
- int len = name->len;
__be32 *p;
- p = reserve_space(xdr, 8 + len);
- *p++ = cpu_to_be32(OP_LOOKUP);
- xdr_encode_opaque(p, name->name, len);
+ p = reserve_space(xdr, 4);
+ *p = cpu_to_be32(OP_LOOKUP);
+ encode_string(xdr, name->len, name->name);
hdr->nops++;
hdr->replen += decode_lookup_maxsz;
}
static void
encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh, struct compound_hdr *hdr)
{
- int len = fh->size;
__be32 *p;
- p = reserve_space(xdr, 8 + len);
- *p++ = cpu_to_be32(OP_PUTFH);
- xdr_encode_opaque(p, fh->data, len);
+ p = reserve_space(xdr, 4);
+ *p = cpu_to_be32(OP_PUTFH);
+ encode_string(xdr, fh->size, fh->data);
hdr->nops++;
hdr->replen += decode_putfh_maxsz;
}
{
__be32 *p;
- p = reserve_space(xdr, 8 + name->len);
- *p++ = cpu_to_be32(OP_REMOVE);
- xdr_encode_opaque(p, name->name, name->len);
+ p = reserve_space(xdr, 4);
+ *p = cpu_to_be32(OP_REMOVE);
+ encode_string(xdr, name->len, name->name);
hdr->nops++;
hdr->replen += decode_remove_maxsz;
}
static void encode_secinfo(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr)
{
- int len = name->len;
__be32 *p;
- p = reserve_space(xdr, 8 + len);
- *p++ = cpu_to_be32(OP_SECINFO);
- xdr_encode_opaque(p, name->name, len);
+ p = reserve_space(xdr, 4);
+ *p = cpu_to_be32(OP_SECINFO);
+ encode_string(xdr, name->len, name->name);
hdr->nops++;
hdr->replen += decode_secinfo_maxsz;
}