diff options
author | Soumya Koduri <skoduri@redhat.com> | 2015-01-29 12:56:35 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-03-01 21:30:43 -0800 |
commit | 56488efe3c858da7f8a0b66d30a2eface2f6f35e (patch) | |
tree | 836f39fcc91dae2f3e28b70217224db2d10dfbd5 /rpc/rpc-lib/src | |
parent | 32dd227726ce60b2e60b8df61ca174d96a1b8b34 (diff) |
rpcsvc: New rpc routines defined to send callback requests
Change-Id: I7f95682faada16308314bfbf84298b02d1198efa
BUG: 1188184
Signed-off-by: Poornima G <pgurusid@redhat.com>
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: http://review.gluster.org/9534
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.c | 42 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.h | 5 |
2 files changed, 47 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index 2c8eb777db1..67b71ea0e8e 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -985,6 +985,48 @@ out: return request_iob; } +int rpcsvc_request_submit (rpcsvc_t *rpc, rpc_transport_t *trans, + rpcsvc_cbk_program_t *prog, int procnum, + void *req, glusterfs_ctx_t *ctx, + xdrproc_t xdrproc) +{ + int ret = -1; + int count = 0; + struct iovec iov = {0, }; + struct iobuf *iobuf = NULL; + ssize_t xdr_size = 0; + + if (!req) + goto out; + + xdr_size = xdr_sizeof (xdrproc, req); + + iobuf = iobuf_get2 (ctx->iobuf_pool, xdr_size); + if (!iobuf) + goto out; + + iov.iov_base = iobuf->ptr; + iov.iov_len = iobuf_pagesize (iobuf); + + ret = xdr_serialize_generic (iov, req, xdrproc); + if (ret == -1) { + gf_log (THIS->name, GF_LOG_WARNING, + "failed to create XDR payload"); + goto out; + } + iov.iov_len = ret; + count = 1; + + ret = rpcsvc_callback_submit (rpc, trans, prog, procnum, + &iov, count); + +out: + if (iobuf) + iobuf_unref (iobuf); + + return ret; +} + int rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans, rpcsvc_cbk_program_t *prog, int procnum, diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h index 2e6fd93b60a..1bf6b07ee2f 100644 --- a/rpc/rpc-lib/src/rpcsvc.h +++ b/rpc/rpc-lib/src/rpcsvc.h @@ -582,6 +582,11 @@ rpcsvc_auth_unix_auxgids (rpcsvc_request_t *req, int *arrlen); extern char * rpcsvc_volume_allowed (dict_t *options, char *volname); +int rpcsvc_request_submit (rpcsvc_t *rpc, rpc_transport_t *trans, + rpcsvc_cbk_program_t *prog, int procnum, + void *req, glusterfs_ctx_t *ctx, + xdrproc_t xdrproc); + int rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans, rpcsvc_cbk_program_t *prog, int procnum, struct iovec *proghdr, int proghdrcount); |