diff options
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 12 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 7 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.h | 7 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-callback.c | 6 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 3 |
5 files changed, 23 insertions, 12 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 9984b42bb19..be84167e4f0 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -57,10 +57,12 @@ int glusterfs_process_volfp (glusterfs_ctx_t *ctx, FILE *fp); int glusterfs_graph_unknown_options (glusterfs_graph_t *graph); int -mgmt_cbk_spec (void *data) +mgmt_cbk_spec (struct rpc_clnt *rpc, void *mydata, void *data) { glusterfs_ctx_t *ctx = NULL; + xlator_t *this = NULL; + this = mydata; ctx = glusterfs_ctx_get (); gf_log ("mgmt", GF_LOG_INFO, "Volume file changed"); @@ -70,10 +72,11 @@ mgmt_cbk_spec (void *data) int -mgmt_cbk_event (void *data) +mgmt_cbk_event (struct rpc_clnt *rpc, void *mydata, void *data) { return 0; } + struct iobuf * glusterfs_serialize_reply (rpcsvc_request_t *req, void *arg, struct iovec *outmsg, xdrproc_t xdrproc) @@ -1994,9 +1997,10 @@ glusterfs_mgmt_init (glusterfs_ctx_t *ctx) goto out; } - ret = rpcclnt_cbk_program_register (rpc, &mgmt_cbk_prog); + ret = rpcclnt_cbk_program_register (rpc, &mgmt_cbk_prog, THIS); if (ret) { - gf_log (THIS->name, GF_LOG_WARNING, "failed to register callback function"); + gf_log (THIS->name, GF_LOG_WARNING, + "failed to register callback function"); goto out; } diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index ae746251177..5bd8480bdcb 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -737,7 +737,8 @@ rpc_clnt_handle_cbk (struct rpc_clnt *clnt, rpc_transport_pollin_t *msg) if (found && (procnum < program->numactors) && (program->actors[procnum].actor)) { - program->actors[procnum].actor (&progmsg); + program->actors[procnum].actor (clnt, program->mydata, + &progmsg); } out: @@ -1321,7 +1322,7 @@ out: int rpcclnt_cbk_program_register (struct rpc_clnt *clnt, - rpcclnt_cb_program_t *program) + rpcclnt_cb_program_t *program, void *mydata) { int ret = -1; char already_registered = 0; @@ -1361,6 +1362,8 @@ rpcclnt_cbk_program_register (struct rpc_clnt *clnt, memcpy (tmp, program, sizeof (*tmp)); INIT_LIST_HEAD (&tmp->program); + tmp->mydata = mydata; + pthread_mutex_lock (&clnt->lock); { list_add_tail (&tmp->program, &clnt->programs); diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h index e7335e38839..f07ad8d3687 100644 --- a/rpc/rpc-lib/src/rpc-clnt.h +++ b/rpc/rpc-lib/src/rpc-clnt.h @@ -78,7 +78,7 @@ typedef struct rpc_clnt_program { int numproc; } rpc_clnt_prog_t; -typedef int (*rpcclnt_cb_fn) (void *data); +typedef int (*rpcclnt_cb_fn) (struct rpc_clnt *rpc, void *mydata, void *data); /* The descriptor for each procedure/actor that runs * over the RPC service. @@ -106,6 +106,9 @@ typedef struct rpcclnt_cb_program { /* list member to link to list of registered services with rpc_clnt */ struct list_head program; + + /* Needed for passing back in cb_actor */ + void *mydata; } rpcclnt_cb_program_t; @@ -232,7 +235,7 @@ void rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config); * procedure handlers. */ int rpcclnt_cbk_program_register (struct rpc_clnt *svc, - rpcclnt_cb_program_t *program); + rpcclnt_cb_program_t *program, void *mydata); int rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath); diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c index b8bda96ce71..d886862f776 100644 --- a/xlators/protocol/client/src/client-callback.c +++ b/xlators/protocol/client/src/client-callback.c @@ -17,7 +17,7 @@ #include "rpc-clnt.h" int -client_cbk_null (void *data) +client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data) { gf_log (THIS->name, GF_LOG_WARNING, "this function should not be called"); @@ -25,7 +25,7 @@ client_cbk_null (void *data) } int -client_cbk_fetchspec (void *data) +client_cbk_fetchspec (struct rpc_clnt *rpc, void *mydata, void *data) { gf_log (THIS->name, GF_LOG_WARNING, "this function should not be called"); @@ -33,7 +33,7 @@ client_cbk_fetchspec (void *data) } int -client_cbk_ino_flush (void *data) +client_cbk_ino_flush (struct rpc_clnt *rpc, void *mydata, void *data) { gf_log (THIS->name, GF_LOG_WARNING, "this function should not be called"); diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 65df70f0604..77111ec3445 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2278,7 +2278,8 @@ client_init_rpc (xlator_t *this) conf->handshake = &clnt_handshake_prog; conf->dump = &clnt_dump_prog; - ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog); + ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog, + this); if (ret) { gf_log (this->name, GF_LOG_ERROR, "failed to register callback program"); |