本文整理汇总了C++中xdr_serialize_generic函数的典型用法代码示例。如果您正苦于以下问题:C++ xdr_serialize_generic函数的具体用法?C++ xdr_serialize_generic怎么用?C++ xdr_serialize_generic使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdr_serialize_generic函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: quotad_serialize_reply
struct iobuf *
quotad_serialize_reply (rpcsvc_request_t *req, void *arg, struct iovec *outmsg,
xdrproc_t xdrproc)
{
struct iobuf *iob = NULL;
ssize_t retlen = 0;
ssize_t xdr_size = 0;
GF_VALIDATE_OR_GOTO ("server", req, ret);
/* First, get the io buffer into which the reply in arg will
* be serialized.
*/
if (arg && xdrproc) {
xdr_size = xdr_sizeof (xdrproc, arg);
iob = iobuf_get2 (req->svc->ctx->iobuf_pool, xdr_size);
if (!iob) {
gf_log_callingfn (THIS->name, GF_LOG_ERROR,
"Failed to get iobuf");
goto ret;
};
iobuf_to_iovec (iob, outmsg);
/* Use the given serializer to translate the give C structure in arg
* to XDR format which will be written into the buffer in outmsg.
*/
/* retlen is used to received the error since size_t is unsigned and we
* need -1 for error notification during encoding.
*/
retlen = xdr_serialize_generic (*outmsg, arg, xdrproc);
if (retlen == -1) {
/* Failed to Encode 'GlusterFS' msg in RPC is not exactly
failure of RPC return values.. client should get
notified about this, so there are no missing frames */
gf_log_callingfn ("", GF_LOG_ERROR, "Failed to encode message");
req->rpc_err = GARBAGE_ARGS;
retlen = 0;
}
}
outmsg->iov_len = retlen;
ret:
if (retlen == -1) {
iobuf_unref (iob);
iob = NULL;
}
return iob;
}
示例2: lic_submit_request
int
lic_submit_request(void *req, call_frame_t *frame, rpc_clnt_prog_t *prog,
int procnum, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc)
{
int ret = -1;
struct iovec iov = {0};
struct iobuf *iobuf = NULL;
ssize_t xdr_size = 0;
if (req) {
xdr_size = xdr_sizeof(xdrproc, req);
iobuf = iobuf_get2(THIS->ctx->iobuf_pool, xdr_size);
if (!iobuf) {
goto out;
};
iov.iov_base = iobuf->ptr;
iov.iov_len = iobuf_size (iobuf);
/* Create the xdr payload */
ret = xdr_serialize_generic (iov, req, xdrproc);
if (ret == -1)
goto out;
iov.iov_len = ret;
}
lic_await_connected(60);
/* Send the msg */
ret = rpc_clnt_submit (g_rpc, prog, procnum, cbkfn,
&iov, 1,
NULL, 0, NULL, frame, NULL, 0, NULL, 0, NULL);
ret = 0;
out:
if (iobuf)
iobuf_unref (iobuf);
return ret;
}
示例3: xdr_serialize_getattr3res
ssize_t
xdr_serialize_getattr3res (struct iovec outmsg, getattr3res *res)
{
return xdr_serialize_generic (outmsg, (void *)res,
(xdrproc_t)xdr_getattr3res);
}
示例4: xdr_serialize_mountstat3
ssize_t
xdr_serialize_mountstat3 (struct iovec outmsg, mountstat3 *m)
{
return xdr_serialize_generic (outmsg, (void *)m,
(xdrproc_t)xdr_mountstat3);
}
示例5: xdr_serialize_mountlist
ssize_t
xdr_serialize_mountlist (struct iovec outmsg, mountlist *ml)
{
return xdr_serialize_generic (outmsg, (void *)ml,
(xdrproc_t)xdr_mountlist);
}
示例6: xdr_serialize_mountbody
ssize_t
xdr_serialize_mountbody (struct iovec outmsg, mountbody *mb)
{
return xdr_serialize_generic (outmsg, (void *)mb,
(xdrproc_t)xdr_mountbody);
}
示例7: xdr_serialize_setaclreply
ssize_t
xdr_serialize_setaclreply (struct iovec inmsg, setaclreply *res)
{
return xdr_serialize_generic (inmsg, (void *) res,
(xdrproc_t)xdr_setaclreply);
}
示例8: xdr_serialize_mountres3
/* Translate the mountres3 structure in res into XDR format into memory
* referenced by outmsg.iov_base.
* Returns the number of bytes used in encoding into XDR format.
*/
ssize_t
xdr_serialize_mountres3 (struct iovec outmsg, mountres3 *res)
{
return xdr_serialize_generic (outmsg, (void *)res,
(xdrproc_t)xdr_mountres3);
}
示例9: xdr_serialize_nlm4_testargs
ssize_t
xdr_serialize_nlm4_testargs (struct iovec outmsg, nlm4_testargs *args)
{
return xdr_serialize_generic (outmsg, (void*)args,
(xdrproc_t)xdr_nlm4_testargs);
}
示例10: xdr_serialize_nlm4_shareres
ssize_t
xdr_serialize_nlm4_shareres (struct iovec outmsg, nlm4_shareres *res)
{
return xdr_serialize_generic (outmsg, (void *)res,
(xdrproc_t)xdr_nlm4_shareres);
}
示例11: xdr_serialize_nfsstat3
ssize_t
xdr_serialize_nfsstat3 (struct iovec outmsg, nfsstat3 *s)
{
return xdr_serialize_generic (outmsg, (void *)s,
(xdrproc_t)xdr_nfsstat3);
}
示例12: xdr_serialize_pathconf3res
ssize_t
xdr_serialize_pathconf3res (struct iovec outmsg, pathconf3res *res)
{
return xdr_serialize_generic (outmsg, (void *)res,
(xdrproc_t)xdr_pathconf3res);
}
示例13: xdr_serialize_readdirp3res
ssize_t
xdr_serialize_readdirp3res (struct iovec outmsg, readdirp3res *res)
{
return xdr_serialize_generic (outmsg, (void *)res,
(xdrproc_t)xdr_readdirp3res);
}
示例14: xdr_serialize_link3res
ssize_t
xdr_serialize_link3res (struct iovec outmsg, link3res *li)
{
return xdr_serialize_generic (outmsg, (void *)li,
(xdrproc_t)xdr_link3res);
}
示例15: xdr_from_dump_req
ssize_t
xdr_from_dump_req (struct iovec outmsg, void *rsp)
{
return xdr_serialize_generic (outmsg, (void *)rsp,
(xdrproc_t)xdr_gf_dump_req);
}