ssize_t xdr_to_generic_payload(struct iovec inmsg, void *args, xdrproc_t proc, struct iovec *pendingpayload) { XDR xdr; ssize_t ret = -1; if ((!inmsg.iov_base) || (!args) || (!proc)) return -1; xdrmem_create(&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, XDR_DECODE); if (!PROC(&xdr, args)) { ret = -1; goto ret; } ret = xdr_decoded_length(xdr); if (pendingpayload) { pendingpayload->iov_base = xdr_decoded_remaining_addr(xdr); pendingpayload->iov_len = xdr_decoded_remaining_len(xdr); } ret: return ret; }
ssize_t xdr_serialize_exports (struct iovec outmsg, exports *elist) { XDR xdr; ssize_t ret = -1; if ((!outmsg.iov_base) || (!elist)) return -1; xdrmem_create (&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len, XDR_ENCODE); if (!xdr_exports (&xdr, elist)) goto ret; ret = xdr_decoded_length (xdr); ret: return ret; }
ssize_t xdr_to_generic(struct iovec inmsg, void *args, xdrproc_t proc) { XDR xdr; ssize_t ret = -1; if ((!inmsg.iov_base) || (!args) || (!proc)) return -1; xdrmem_create(&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, XDR_DECODE); if (!PROC(&xdr, args)) { ret = -1; goto ret; } ret = xdr_decoded_length(xdr); ret: return ret; }
ssize_t xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc) { XDR xdr; ssize_t ret = -1; if ((!inmsg.iov_base) || (!args) || (!proc)) return -1; xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, XDR_DECODE); if (!proc (&xdr, args)) { gf_log_callingfn ("xdr", GF_LOG_WARNING, "XDR decoding failed"); ret = -1; goto ret; } ret = xdr_decoded_length (xdr); ret: return ret; }
/* Decode the mount path from the network message in inmsg * into the memory referenced by outpath.iov_base. * The size allocated for outpath.iov_base is outpath.iov_len. * The size of the path extracted from the message is returned. */ ssize_t xdr_to_mountpath (struct iovec outpath, struct iovec inmsg) { XDR xdr; ssize_t ret = -1; char *mntpath = NULL; if ((!outpath.iov_base) || (!inmsg.iov_base)) return -1; xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, XDR_DECODE); mntpath = outpath.iov_base; if (!xdr_dirpath (&xdr, (dirpath *)&mntpath)) { ret = -1; goto ret; } ret = xdr_decoded_length (xdr); ret: return ret; }