本文整理汇总了C++中xdr_reserve_space函数的典型用法代码示例。如果您正苦于以下问题:C++ xdr_reserve_space函数的具体用法?C++ xdr_reserve_space怎么用?C++ xdr_reserve_space使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdr_reserve_space函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encode_attr_bitmap
static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep)
{
uint32_t bm[2];
uint32_t *p;
bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0);
bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1);
if (bm[1] != 0) {
p = xdr_reserve_space(xdr, 16);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
*p++ = htonl(2);
*p++ = bm[0];
*p++ = bm[1];
} else if (bm[0] != 0) {
p = xdr_reserve_space(xdr, 12);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
*p++ = htonl(1);
*p++ = bm[0];
} else {
p = xdr_reserve_space(xdr, 8);
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
*p++ = htonl(0);
}
*savep = p;
return 0;
}
示例2: gssx_enc_cb
static int gssx_enc_cb(struct xdr_stream *xdr, struct gssx_cb *cb)
{
__be32 *p;
int err;
/* cb->initiator_addrtype */
p = xdr_reserve_space(xdr, 8);
if (!p)
return -ENOSPC;
p = xdr_encode_hyper(p, cb->initiator_addrtype);
/* cb->initiator_address */
err = gssx_enc_buffer(xdr, &cb->initiator_address);
if (err)
return err;
/* cb->acceptor_addrtype */
p = xdr_reserve_space(xdr, 8);
if (!p)
return -ENOSPC;
p = xdr_encode_hyper(p, cb->acceptor_addrtype);
/* cb->acceptor_address */
err = gssx_enc_buffer(xdr, &cb->acceptor_address);
if (err)
return err;
/* cb->application_data */
err = gssx_enc_buffer(xdr, &cb->application_data);
return err;
}
示例3: encode_sattrguard3
static void encode_sattrguard3(struct xdr_stream *xdr,
const struct nfs3_sattrargs *args)
{
__be32 *p;
if (args->guard) {
p = xdr_reserve_space(xdr, 4 + 8);
*p++ = xdr_one;
xdr_encode_nfstime3(p, &args->guardtime);
} else {
p = xdr_reserve_space(xdr, 4);
*p = xdr_zero;
}
}
示例4: unx_marshal
/*
* Marshal credentials.
* Maybe we should keep a cached credential for performance reasons.
*/
static int
unx_marshal(struct rpc_task *task, struct xdr_stream *xdr)
{
struct rpc_clnt *clnt = task->tk_client;
struct rpc_cred *cred = task->tk_rqstp->rq_cred;
__be32 *p, *cred_len, *gidarr_len;
int i;
struct group_info *gi = cred->cr_cred->group_info;
/* Credential */
p = xdr_reserve_space(xdr, 3 * sizeof(*p));
if (!p)
goto marshal_failed;
*p++ = rpc_auth_unix;
cred_len = p++;
*p++ = xdr_zero; /* stamp */
if (xdr_stream_encode_opaque(xdr, clnt->cl_nodename,
clnt->cl_nodelen) < 0)
goto marshal_failed;
p = xdr_reserve_space(xdr, 3 * sizeof(*p));
if (!p)
goto marshal_failed;
*p++ = cpu_to_be32(from_kuid(&init_user_ns, cred->cr_cred->fsuid));
*p++ = cpu_to_be32(from_kgid(&init_user_ns, cred->cr_cred->fsgid));
gidarr_len = p++;
if (gi)
for (i = 0; i < UNX_NGROUPS && i < gi->ngroups; i++)
*p++ = cpu_to_be32(from_kgid(&init_user_ns,
gi->gid[i]));
*gidarr_len = cpu_to_be32(p - gidarr_len - 1);
*cred_len = cpu_to_be32((p - cred_len - 1) << 2);
p = xdr_reserve_space(xdr, (p - gidarr_len - 1) << 2);
if (!p)
goto marshal_failed;
/* Verifier */
p = xdr_reserve_space(xdr, 2 * sizeof(*p));
if (!p)
goto marshal_failed;
*p++ = rpc_auth_null;
*p = xdr_zero;
return 0;
marshal_failed:
return -EMSGSIZE;
}
示例5: encode_compound_hdr_res
static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr)
{
unsigned status;
hdr->status = xdr_reserve_space(xdr, 4);
if (unlikely(hdr->status == NULL))
return htonl(NFS4ERR_RESOURCE);
status = encode_string(xdr, hdr->taglen, hdr->tag);
if (unlikely(status != 0))
return status;
hdr->nops = xdr_reserve_space(xdr, 4);
if (unlikely(hdr->nops == NULL))
return htonl(NFS4ERR_RESOURCE);
return 0;
}
示例6: nfs3_xdr_enc_setacl3args
static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs3_setaclargs *args)
{
unsigned int base;
int error;
encode_nfs_fh3(xdr, NFS_FH(args->inode));
encode_uint32(xdr, args->mask);
base = req->rq_slen;
if (args->npages != 0)
xdr_write_pages(xdr, args->pages, 0, args->len);
else
xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE);
error = nfsacl_encode(xdr->buf, base, args->inode,
(args->mask & NFS_ACL) ?
args->acl_access : NULL, 1, 0);
BUG_ON(error < 0);
error = nfsacl_encode(xdr->buf, base + error, args->inode,
(args->mask & NFS_DFACL) ?
args->acl_default : NULL, 1,
NFS_ACL_DEFAULT);
BUG_ON(error < 0);
}
示例7: encode_sattr3
static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr)
{
u32 nbytes;
__be32 *p;
nbytes = 6 * 4;
if (attr->ia_valid & ATTR_MODE)
nbytes += 4;
if (attr->ia_valid & ATTR_UID)
nbytes += 4;
if (attr->ia_valid & ATTR_GID)
nbytes += 4;
if (attr->ia_valid & ATTR_SIZE)
nbytes += 8;
if (attr->ia_valid & ATTR_ATIME_SET)
nbytes += 8;
if (attr->ia_valid & ATTR_MTIME_SET)
nbytes += 8;
p = xdr_reserve_space(xdr, nbytes);
if (attr->ia_valid & ATTR_MODE) {
*p++ = xdr_one;
*p++ = cpu_to_be32(attr->ia_mode & S_IALLUGO);
} else
*p++ = xdr_zero;
if (attr->ia_valid & ATTR_UID) {
*p++ = xdr_one;
*p++ = cpu_to_be32(attr->ia_uid);
} else
*p++ = xdr_zero;
if (attr->ia_valid & ATTR_GID) {
*p++ = xdr_one;
*p++ = cpu_to_be32(attr->ia_gid);
} else
*p++ = xdr_zero;
if (attr->ia_valid & ATTR_SIZE) {
*p++ = xdr_one;
p = xdr_encode_hyper(p, (u64)attr->ia_size);
} else
*p++ = xdr_zero;
if (attr->ia_valid & ATTR_ATIME_SET) {
*p++ = xdr_two;
p = xdr_encode_nfstime3(p, &attr->ia_atime);
} else if (attr->ia_valid & ATTR_ATIME) {
*p++ = xdr_one;
} else
*p++ = xdr_zero;
if (attr->ia_valid & ATTR_MTIME_SET) {
*p++ = xdr_two;
xdr_encode_nfstime3(p, &attr->ia_mtime);
} else if (attr->ia_valid & ATTR_MTIME) {
*p = xdr_one;
} else
*p = xdr_zero;
}
示例8: encode_createverf3
static void encode_createverf3(struct xdr_stream *xdr, const __be32 *verifier)
{
__be32 *p;
p = xdr_reserve_space(xdr, NFS3_CREATEVERFSIZE);
memcpy(p, verifier, NFS3_CREATEVERFSIZE);
}
示例9: encode_cb_sequence_res
static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp,
struct xdr_stream *xdr,
const struct cb_sequenceres *res)
{
__be32 *p;
__be32 status = res->csr_status;
if (unlikely(status != 0))
goto out;
status = encode_sessionid(xdr, &res->csr_sessionid);
if (status)
goto out;
p = xdr_reserve_space(xdr, 4 * sizeof(uint32_t));
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
*p++ = htonl(res->csr_sequenceid);
*p++ = htonl(res->csr_slotid);
*p++ = htonl(res->csr_highestslotid);
*p++ = htonl(res->csr_target_highestslotid);
out:
dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
return status;
}
示例10: encode_bool
static void encode_bool(struct xdr_stream *xdr, const int value)
{
__be32 *p;
p = xdr_reserve_space(xdr, 4);
*p = value ? xdr_one : xdr_zero;
}
示例11: encode_cb_sequence_res
static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp,
struct xdr_stream *xdr,
const void *resp)
{
const struct cb_sequenceres *res = resp;
__be32 *p;
__be32 status = res->csr_status;
if (unlikely(status != 0))
return status;
status = encode_sessionid(xdr, &res->csr_sessionid);
if (status)
return status;
p = xdr_reserve_space(xdr, 4 * sizeof(uint32_t));
if (unlikely(p == NULL))
return htonl(NFS4ERR_RESOURCE);
*p++ = htonl(res->csr_sequenceid);
*p++ = htonl(res->csr_slotid);
*p++ = htonl(res->csr_highestslotid);
*p++ = htonl(res->csr_target_highestslotid);
return 0;
}
示例12: encode_fhandle
/*
* 2.3.3. fhandle
*
* typedef opaque fhandle[FHSIZE];
*/
static void encode_fhandle(struct xdr_stream *xdr, const struct nfs_fh *fh)
{
__be32 *p;
p = xdr_reserve_space(xdr, NFS2_FHSIZE);
memcpy(p, fh->data, NFS2_FHSIZE);
}
示例13: encode_int32
static void encode_int32(struct xdr_stream *xdr, const s32 value)
{
__be32 *p;
p = xdr_reserve_space(xdr, 4);
*p = cpu_to_be32(value);
}
示例14: encode_path
/*
* 2.3.8. path
*
* typedef string path<MAXPATHLEN>;
*/
static void encode_path(struct xdr_stream *xdr, struct page **pages, u32 length)
{
__be32 *p;
p = xdr_reserve_space(xdr, 4);
*p = cpu_to_be32(length);
xdr_write_pages(xdr, pages, 0, length);
}
示例15: encode_specdata3
static void encode_specdata3(struct xdr_stream *xdr, const dev_t rdev)
{
__be32 *p;
p = xdr_reserve_space(xdr, 8);
*p++ = cpu_to_be32(MAJOR(rdev));
*p = cpu_to_be32(MINOR(rdev));
}