From 2fdb332fad541efd34be749e55a07569ce2b4ef4 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Mon, 26 Oct 2015 16:50:09 +1100 Subject: ctdb-daemon: Stop using tevent compatibility definitions Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/ib/ibw_ctdb.c | 15 +++++++++------ ctdb/ib/ibw_ctdb.h | 5 +++-- ctdb/ib/ibwrapper.c | 22 +++++++++++----------- ctdb/ib/ibwrapper.h | 2 +- ctdb/ib/ibwrapper_internal.h | 6 +++--- ctdb/ib/ibwrapper_test.c | 14 ++++++++------ 6 files changed, 35 insertions(+), 29 deletions(-) (limited to 'ctdb/ib') diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c index 438bf69fec0..96b126c4eaa 100644 --- a/ctdb/ib/ibw_ctdb.c +++ b/ctdb/ib/ibw_ctdb.c @@ -54,16 +54,18 @@ int ctdb_ibw_node_connect(struct ctdb_node *node) if (rc) { DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n")); /* try again once a second */ - event_add_timed(node->ctdb->ev, node, timeval_current_ofs(1, 0), - ctdb_ibw_node_connect_event, node); + tevent_add_timer(node->ctdb->ev, node, + timeval_current_ofs(1, 0), + ctdb_ibw_node_connect_event, node); } /* continues at ibw_ctdb.c/IBWC_CONNECTED in good case */ return 0; } -void ctdb_ibw_node_connect_event(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private_data) +void ctdb_ibw_node_connect_event(struct tevent_context *ev, + struct tevent_timer *te, + struct timeval t, void *private_data) { struct ctdb_node *node = talloc_get_type(private_data, struct ctdb_node); @@ -129,8 +131,9 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn) DEBUG(DEBUG_DEBUG, ("IBWC_ERROR, reconnecting...\n")); talloc_free(cn->conn); /* internal queue content is destroyed */ cn->conn = (void *)ibw_conn_new(ictx, node); - event_add_timed(node->ctdb->ev, node, timeval_current_ofs(1, 0), - ctdb_ibw_node_connect_event, node); + tevent_add_timer(node->ctdb->ev, node, + timeval_current_ofs(1, 0), + ctdb_ibw_node_connect_event, node); } } break; default: diff --git a/ctdb/ib/ibw_ctdb.h b/ctdb/ib/ibw_ctdb.h index 98ea102eac8..57f659bc569 100644 --- a/ctdb/ib/ibw_ctdb.h +++ b/ctdb/ib/ibw_ctdb.h @@ -42,8 +42,9 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn); int ctdb_ibw_receive_handler(struct ibw_conn *conn, void *buf, int n); int ctdb_ibw_node_connect(struct ctdb_node *node); -void ctdb_ibw_node_connect_event(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private_data); +void ctdb_ibw_node_connect_event(struct tevent_context *ev, + struct tevent_timer *te, + struct timeval t, void *private_data); int ctdb_flush_cn_queue(struct ctdb_ibw_node *cn); diff --git a/ctdb/ib/ibwrapper.c b/ctdb/ib/ibwrapper.c index 51d39daeba3..523cfacf401 100644 --- a/ctdb/ib/ibwrapper.c +++ b/ctdb/ib/ibwrapper.c @@ -51,8 +51,8 @@ static char ibw_lasterr[IBW_LASTERR_BUFSIZE]; #define IBW_RECV_BUFSIZE 256 #define IBW_RECV_THRESHOLD (1 * 1024 * 1024) -static void ibw_event_handler_verbs(struct event_context *ev, - struct fd_event *fde, uint16_t flags, void *private_data); +static void ibw_event_handler_verbs(struct tevent_context *ev, + struct tevent_fd *fde, uint16_t flags, void *private_data); static int ibw_fill_cq(struct ibw_conn *conn); static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc); static int ibw_wc_send(struct ibw_conn *conn, struct ibv_wc *wc); @@ -263,8 +263,8 @@ static int ibw_setup_cq_qp(struct ibw_conn *conn) } DEBUG(DEBUG_DEBUG, ("created channel %p\n", pconn->verbs_channel)); - pconn->verbs_channel_event = event_add_fd(pctx->ectx, NULL, /* not pconn or conn */ - pconn->verbs_channel->fd, EVENT_FD_READ, ibw_event_handler_verbs, conn); + pconn->verbs_channel_event = tevent_add_fd(pctx->ectx, NULL, /* not pconn or conn */ + pconn->verbs_channel->fd, TEVENT_FD_READ, ibw_event_handler_verbs, conn); pconn->pd = ibv_alloc_pd(pconn->cm_id->verbs); if (!pconn->pd) { @@ -410,8 +410,8 @@ static int ibw_manage_connect(struct ibw_conn *conn) return rc; } -static void ibw_event_handler_cm(struct event_context *ev, - struct fd_event *fde, uint16_t flags, void *private_data) +static void ibw_event_handler_cm(struct tevent_context *ev, + struct tevent_fd *fde, uint16_t flags, void *private_data) { int rc; struct ibw_ctx *ctx = talloc_get_type(private_data, struct ibw_ctx); @@ -581,8 +581,8 @@ error: return; } -static void ibw_event_handler_verbs(struct event_context *ev, - struct fd_event *fde, uint16_t flags, void *private_data) +static void ibw_event_handler_verbs(struct tevent_context *ev, + struct tevent_fd *fde, uint16_t flags, void *private_data) { struct ibw_conn *conn = talloc_get_type(private_data, struct ibw_conn); struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv); @@ -938,7 +938,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr, void *ctx_userdata, ibw_connstate_fn_t ibw_connstate, ibw_receive_fn_t ibw_receive, - struct event_context *ectx) + struct tevent_context *ectx) { struct ibw_ctx *ctx = talloc_zero(NULL, struct ibw_ctx); struct ibw_ctx_priv *pctx; @@ -975,8 +975,8 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr, goto cleanup; } - pctx->cm_channel_event = event_add_fd(pctx->ectx, pctx, - pctx->cm_channel->fd, EVENT_FD_READ, ibw_event_handler_cm, ctx); + pctx->cm_channel_event = tevent_add_fd(pctx->ectx, pctx, + pctx->cm_channel->fd, TEVENT_FD_READ, ibw_event_handler_cm, ctx); #if RDMA_USER_CM_MAX_ABI_VERSION >= 2 rc = rdma_create_id(pctx->cm_channel, &pctx->cm_id, ctx, RDMA_PS_TCP); diff --git a/ctdb/ib/ibwrapper.h b/ctdb/ib/ibwrapper.h index 0b880b3aab7..d5cdc60ba87 100644 --- a/ctdb/ib/ibwrapper.h +++ b/ctdb/ib/ibwrapper.h @@ -106,7 +106,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr, void *ctx_userdata, ibw_connstate_fn_t ibw_connstate, ibw_receive_fn_t ibw_receive, - struct event_context *ectx); + struct tevent_context *ectx); /* * Must be called in states of (IBWS_ERROR, IBWS_READY, IBWS_CONNECT_REQUEST) diff --git a/ctdb/ib/ibwrapper_internal.h b/ctdb/ib/ibwrapper_internal.h index 20aef7fd86b..b8100a8bf73 100644 --- a/ctdb/ib/ibwrapper_internal.h +++ b/ctdb/ib/ibwrapper_internal.h @@ -45,14 +45,14 @@ struct ibw_wr { }; struct ibw_ctx_priv { - struct event_context *ectx; + struct tevent_context *ectx; struct ibw_opts opts; struct rdma_cm_id *cm_id; /* server cm id */ struct rdma_event_channel *cm_channel; - struct fd_event *cm_channel_event; + struct tevent_fd *cm_channel_event; ibw_connstate_fn_t connstate_func; /* see ibw_init */ ibw_receive_fn_t receive_func; /* see ibw_init */ @@ -69,7 +69,7 @@ struct ibw_part { struct ibw_conn_priv { struct ibv_comp_channel *verbs_channel; - struct fd_event *verbs_channel_event; + struct tevent_fd *verbs_channel_event; struct rdma_cm_id *cm_id; /* client's cm id */ struct ibv_pd *pd; diff --git a/ctdb/ib/ibwrapper_test.c b/ctdb/ib/ibwrapper_test.c index a006966d58d..f8cf99604a7 100644 --- a/ctdb/ib/ibwrapper_test.c +++ b/ctdb/ib/ibwrapper_test.c @@ -375,8 +375,9 @@ error: return -1; } -static void ibwtest_timeout_handler(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private_data) +static void ibwtest_timeout_handler(struct tevent_context *ev, + struct tevent_timer *te, + struct timeval t, void *private_data) { struct ibwtest_ctx *tcx = talloc_get_type(private_data, struct ibwtest_ctx); int rc; @@ -605,7 +606,7 @@ int main(int argc, char *argv[]) goto cleanup; } - ev = event_context_init(NULL); + ev = tevent_context_init(NULL); assert(ev); tcx->ibwctx = ibw_init(tcx->attrs, tcx->nattrs, @@ -626,11 +627,12 @@ int main(int argc, char *argv[]) while(!tcx->kill_me && !tcx->error) { if (tcx->nsec) { - event_add_timed(ev, tcx, timeval_current_ofs(0, tcx->nsec), - ibwtest_timeout_handler, tcx); + tevent_add_timer(ev, tcx, + timeval_current_ofs(0, tcx->nsec), + ibwtest_timeout_handler, tcx); } - event_loop_once(ev); + tevent_loop_once(ev); if (tcx->sleep_usec) usleep(tcx->sleep_usec); -- cgit v1.2.1