summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2015-10-26 16:50:09 +1100
committerMartin Schwenke <martins@samba.org>2015-10-30 02:00:27 +0100
commit2fdb332fad541efd34be749e55a07569ce2b4ef4 (patch)
treed84629d392241f089b1d5dc7e025573938e57b3c /ctdb
parent7084cb92e2b30134b2d5c9017a558f9e7b7696fe (diff)
downloadsamba-2fdb332fad541efd34be749e55a07569ce2b4ef4.tar.gz
ctdb-daemon: Stop using tevent compatibility definitions
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/client/ctdb_client.c31
-rw-r--r--ctdb/common/cmdline.c4
-rw-r--r--ctdb/common/cmdline.h2
-rw-r--r--ctdb/common/ctdb_io.c19
-rw-r--r--ctdb/ib/ibw_ctdb.c15
-rw-r--r--ctdb/ib/ibw_ctdb.h5
-rw-r--r--ctdb/ib/ibwrapper.c22
-rw-r--r--ctdb/ib/ibwrapper.h2
-rw-r--r--ctdb/ib/ibwrapper_internal.h6
-rw-r--r--ctdb/ib/ibwrapper_test.c14
-rw-r--r--ctdb/include/ctdb_private.h2
-rw-r--r--ctdb/include/internal/includes.h2
-rw-r--r--ctdb/server/ctdb_banning.c10
-rw-r--r--ctdb/server/ctdb_call.c67
-rw-r--r--ctdb/server/ctdb_control.c11
-rw-r--r--ctdb/server/ctdb_daemon.c52
-rw-r--r--ctdb/server/ctdb_keepalive.c19
-rw-r--r--ctdb/server/ctdb_lock.c2
-rw-r--r--ctdb/server/ctdb_logging.c12
-rw-r--r--ctdb/server/ctdb_ltdb_server.c35
-rw-r--r--ctdb/server/ctdb_monitor.c101
-rw-r--r--ctdb/server/ctdb_persistent.c11
-rw-r--r--ctdb/server/ctdb_recover.c48
-rw-r--r--ctdb/server/ctdb_recoverd.c121
-rw-r--r--ctdb/server/ctdb_server.c5
-rw-r--r--ctdb/server/ctdb_statistics.c12
-rw-r--r--ctdb/server/ctdb_takeover.c102
-rw-r--r--ctdb/server/ctdb_traverse.c11
-rw-r--r--ctdb/server/ctdb_update_record.c21
-rw-r--r--ctdb/server/ctdb_vacuum.c65
-rw-r--r--ctdb/server/ctdbd.c4
-rw-r--r--ctdb/server/eventscript.c26
-rw-r--r--ctdb/tcp/ctdb_tcp.h6
-rw-r--r--ctdb/tcp/tcp_connect.c40
-rw-r--r--ctdb/tcp/tcp_init.c12
-rw-r--r--ctdb/tests/src/ctdb_bench.c30
-rw-r--r--ctdb/tests/src/ctdb_fetch.c15
-rw-r--r--ctdb/tests/src/ctdb_fetch_one.c9
-rw-r--r--ctdb/tests/src/ctdb_fetch_readonly_loop.c9
-rw-r--r--ctdb/tests/src/ctdb_fetch_readonly_once.c6
-rw-r--r--ctdb/tests/src/ctdb_persistent.c18
-rw-r--r--ctdb/tests/src/ctdb_randrec.c6
-rw-r--r--ctdb/tests/src/ctdb_store.c10
-rw-r--r--ctdb/tests/src/ctdb_trackingdb_test.c4
-rw-r--r--ctdb/tests/src/ctdb_transaction.c18
-rw-r--r--ctdb/tests/src/ctdb_traverse.c10
-rw-r--r--ctdb/tests/src/ctdb_update_record.c9
-rw-r--r--ctdb/tests/src/ctdb_update_record_persistent.c10
-rw-r--r--ctdb/tools/ctdb.c28
-rw-r--r--ctdb/utils/pmda/pmda_ctdb.c4
50 files changed, 605 insertions, 498 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index f0fbea40bc2..ff156c9ab53 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -315,7 +315,7 @@ int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call)
}
while (state->state < CTDB_CALL_DONE) {
- event_loop_once(state->ctdb_db->ctdb->ev);
+ tevent_loop_once(state->ctdb_db->ctdb->ev);
}
if (state->state != CTDB_CALL_DONE) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_call_recv failed\n"));
@@ -947,8 +947,9 @@ int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx,
called when a control completes or timesout to invoke the callback
function the user provided
*/
-static void invoke_control_callback(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void invoke_control_callback(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_client_control_state *state;
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
@@ -1012,7 +1013,8 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb,
and call the callback.
*/
if (state->async.fn) {
- event_add_timed(ctdb->ev, state, timeval_zero(), invoke_control_callback, state);
+ tevent_add_timer(ctdb->ev, state, timeval_zero(),
+ invoke_control_callback, state);
}
}
@@ -1028,8 +1030,9 @@ static int ctdb_client_control_destructor(struct ctdb_client_control_state *stat
/* time out handler for ctdb_control */
-static void control_timeout_func(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void control_timeout_func(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
@@ -1043,7 +1046,8 @@ static void control_timeout_func(struct event_context *ev, struct timed_event *t
and call the callback.
*/
if (state->async.fn) {
- event_add_timed(state->ctdb->ev, state, timeval_zero(), invoke_control_callback, state);
+ tevent_add_timer(state->ctdb->ev, state, timeval_zero(),
+ invoke_control_callback, state);
}
}
@@ -1097,7 +1101,8 @@ struct ctdb_client_control_state *ctdb_control_send(struct ctdb_context *ctdb,
/* timeout */
if (timeout && !timeval_is_zero(timeout)) {
- event_add_timed(ctdb->ev, state, *timeout, control_timeout_func, state);
+ tevent_add_timer(ctdb->ev, state, *timeout,
+ control_timeout_func, state);
}
ret = ctdb_client_queue_pkt(ctdb, &(c->hdr));
@@ -1142,7 +1147,7 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
completes.
*/
while (state->state == CTDB_CONTROL_WAIT) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
if (state->state != CTDB_CONTROL_DONE) {
@@ -2293,7 +2298,7 @@ static int ctdb_traverse_ext(struct ctdb_db_context *ctdb_db,
}
while (!state.done) {
- event_loop_once(ctdb_db->ctdb->ev);
+ tevent_loop_once(ctdb_db->ctdb->ev);
}
ret = ctdb_client_remove_message_handler(ctdb_db->ctdb, srvid, &state);
@@ -3304,7 +3309,7 @@ int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
NOTE: In current code the daemon does not fork. This is for testing purposes only
and to simplify the code.
*/
-struct ctdb_context *ctdb_init(struct event_context *ev)
+struct ctdb_context *ctdb_init(struct tevent_context *ev)
{
int ret;
struct ctdb_context *ctdb;
@@ -3507,7 +3512,7 @@ void ctdb_client_async_add(struct client_async_data *data, struct ctdb_client_co
int ctdb_client_async_wait(struct ctdb_context *ctdb, struct client_async_data *data)
{
while (data->count > 0) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
if (data->fail_count != 0) {
if (!data->dont_log_errors) {
@@ -4417,7 +4422,7 @@ int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ...
va_end(ap);
/* get a new event context */
- ctdb->ev = event_context_init(ctdb);
+ ctdb->ev = tevent_context_init(ctdb);
tevent_loop_allow_nesting(ctdb->ev);
/* Connect to main CTDB daemon */
diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c
index b3af7e661ed..e6910116fef 100644
--- a/ctdb/common/cmdline.c
+++ b/ctdb/common/cmdline.c
@@ -49,7 +49,7 @@ static void ctdb_cmdline_callback(poptContext con,
{
switch (opt->val) {
case OPT_EVENTSYSTEM:
- event_set_default_backend(arg);
+ tevent_set_default_backend(arg);
break;
}
}
@@ -68,7 +68,7 @@ struct poptOption popt_ctdb_cmdline[] = {
/*
startup daemon side of ctdb according to command line options
*/
-struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
+struct ctdb_context *ctdb_cmdline_init(struct tevent_context *ev)
{
struct ctdb_context *ctdb;
int ret;
diff --git a/ctdb/common/cmdline.h b/ctdb/common/cmdline.h
index d8847a8bcc1..fd675ed0fd2 100644
--- a/ctdb/common/cmdline.h
+++ b/ctdb/common/cmdline.h
@@ -5,6 +5,6 @@ extern struct poptOption popt_ctdb_cmdline[];
#define POPT_CTDB_CMDLINE { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_ctdb_cmdline, 0, "Common ctdb options:", NULL },
-struct ctdb_context *ctdb_cmdline_init(struct event_context *ev);
+struct ctdb_context *ctdb_cmdline_init(struct tevent_context *ev);
#endif /* CTDB_CMDLINE_H */
diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c
index 2318364439a..a99c56e9079 100644
--- a/ctdb/common/ctdb_io.c
+++ b/ctdb/common/ctdb_io.c
@@ -55,7 +55,7 @@ struct ctdb_queue {
struct ctdb_buffer buffer; /* input buffer */
struct ctdb_queue_pkt *out_queue, *out_queue_tail;
uint32_t out_queue_length;
- struct fd_event *fde;
+ struct tevent_fd *fde;
int fd;
size_t alignment;
void *private_data;
@@ -217,7 +217,7 @@ failed:
/* used when an event triggers a dead queue */
-static void queue_dead(struct event_context *ev, struct tevent_immediate *im,
+static void queue_dead(struct tevent_context *ev, struct tevent_immediate *im,
void *private_data)
{
struct ctdb_queue *queue = talloc_get_type(private_data, struct ctdb_queue);
@@ -266,18 +266,18 @@ static void queue_io_write(struct ctdb_queue *queue)
talloc_free(pkt);
}
- EVENT_FD_NOT_WRITEABLE(queue->fde);
+ TEVENT_FD_NOT_WRITEABLE(queue->fde);
}
/*
called when an incoming connection is readable or writeable
*/
-static void queue_io_handler(struct event_context *ev, struct fd_event *fde,
+static void queue_io_handler(struct tevent_context *ev, struct tevent_fd *fde,
uint16_t flags, void *private_data)
{
struct ctdb_queue *queue = talloc_get_type(private_data, struct ctdb_queue);
- if (flags & EVENT_FD_READ) {
+ if (flags & TEVENT_FD_READ) {
queue_io_read(queue);
} else {
queue_io_write(queue);
@@ -342,7 +342,7 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
pkt->full_length = full_length;
if (queue->out_queue == NULL && queue->fd != -1) {
- EVENT_FD_WRITEABLE(queue->fde);
+ TEVENT_FD_WRITEABLE(queue->fde);
}
DLIST_ADD_END(queue->out_queue, pkt, NULL);
@@ -385,15 +385,16 @@ int ctdb_queue_set_fd(struct ctdb_queue *queue, int fd)
queue->fde = NULL;
if (fd != -1) {
- queue->fde = event_add_fd(queue->ctdb->ev, queue, fd, EVENT_FD_READ,
- queue_io_handler, queue);
+ queue->fde = tevent_add_fd(queue->ctdb->ev, queue, fd,
+ TEVENT_FD_READ,
+ queue_io_handler, queue);
if (queue->fde == NULL) {
return -1;
}
tevent_fd_set_auto_close(queue->fde);
if (queue->out_queue) {
- EVENT_FD_WRITEABLE(queue->fde);
+ TEVENT_FD_WRITEABLE(queue->fde);
}
}
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);
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 18e9a556ca5..15197ed612a 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -541,7 +541,7 @@ struct ctdb_db_context {
struct tdb_context *rottdb; /* ReadOnly tracking TDB */
struct ctdb_registered_call *calls; /* list of registered calls */
uint32_t seqnum;
- struct timed_event *seqnum_update;
+ struct tevent_timer *seqnum_update;
struct ctdb_traverse_local_handle *traverse;
struct ctdb_vacuum_handle *vacuum_handle;
char *unhealthy_reason;
diff --git a/ctdb/include/internal/includes.h b/ctdb/include/internal/includes.h
index 74c11ba05a9..43f02f38a63 100644
--- a/ctdb/include/internal/includes.h
+++ b/ctdb/include/internal/includes.h
@@ -11,8 +11,6 @@
/* Allow use of deprecated function tevent_loop_allow_nesting() */
#define TEVENT_DEPRECATED
-/* Saves ctdb from massive churn. */
-#define TEVENT_COMPAT_DEFINES 1
#include <tevent.h>
#include "lib/util/debug.h"
diff --git a/ctdb/server/ctdb_banning.c b/ctdb/server/ctdb_banning.c
index a86b78b9e09..0623ec4636d 100644
--- a/ctdb/server/ctdb_banning.c
+++ b/ctdb/server/ctdb_banning.c
@@ -26,9 +26,9 @@
#include "../include/ctdb_private.h"
-static void
-ctdb_ban_node_event(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_ban_node_event(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
@@ -130,7 +130,9 @@ int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata)
DEBUG(DEBUG_ERR,("Banning this node for %d seconds\n", bantime->time));
ctdb->nodes[bantime->pnn]->flags |= NODE_FLAGS_BANNED;
- event_add_timed(ctdb->ev, ctdb->banning_ctx, timeval_current_ofs(bantime->time,0), ctdb_ban_node_event, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->banning_ctx,
+ timeval_current_ofs(bantime->time,0),
+ ctdb_ban_node_event, ctdb);
if (!already_banned) {
ctdb_local_node_got_banned(ctdb);
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index cecdce294c4..a919e18948e 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -265,8 +265,9 @@ static void ctdb_call_send_dmaster(struct ctdb_db_context *ctdb_db,
talloc_free(r);
}
-static void ctdb_sticky_pindown_timeout(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_sticky_pindown_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_sticky_record *sr = talloc_get_type(private_data,
struct ctdb_sticky_record);
@@ -307,7 +308,10 @@ ctdb_set_sticky_pindown(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_
DEBUG(DEBUG_ERR,("Failed to allocate pindown context for sticky record\n"));
return -1;
}
- event_add_timed(ctdb->ev, sr->pindown, timeval_current_ofs(ctdb->tunable.sticky_pindown / 1000, (ctdb->tunable.sticky_pindown * 1000) % 1000000), ctdb_sticky_pindown_timeout, sr);
+ tevent_add_timer(ctdb->ev, sr->pindown,
+ timeval_current_ofs(ctdb->tunable.sticky_pindown / 1000,
+ (ctdb->tunable.sticky_pindown * 1000) % 1000000),
+ ctdb_sticky_pindown_timeout, sr);
}
return 0;
@@ -666,7 +670,8 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
}
}
-static void ctdb_sticky_record_timeout(struct event_context *ev, struct timed_event *te,
+static void ctdb_sticky_record_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_sticky_record *sr = talloc_get_type(private_data,
@@ -720,7 +725,9 @@ ctdb_make_record_sticky(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_
trbt_insertarray32_callback(ctdb_db->sticky_records, k[0], &k[0], ctdb_make_sticky_record_callback, sr);
- event_add_timed(ctdb->ev, sr, timeval_current_ofs(ctdb->tunable.sticky_duration, 0), ctdb_sticky_record_timeout, sr);
+ tevent_add_timer(ctdb->ev, sr,
+ timeval_current_ofs(ctdb->tunable.sticky_duration, 0),
+ ctdb_sticky_record_timeout, sr);
talloc_free(tmp_ctx);
return 0;
@@ -736,8 +743,9 @@ struct pinned_down_deferred_call {
struct ctdb_req_header *hdr;
};
-static void pinned_down_requeue(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void pinned_down_requeue(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct pinned_down_requeue_handle *handle = talloc_get_type(private_data, struct pinned_down_requeue_handle);
struct ctdb_context *ctdb = handle->ctdb;
@@ -757,7 +765,8 @@ static int pinned_down_destructor(struct pinned_down_deferred_call *pinned_down)
handle->hdr = pinned_down->hdr;
talloc_steal(handle, handle->hdr);
- event_add_timed(ctdb->ev, handle, timeval_zero(), pinned_down_requeue, handle);
+ tevent_add_timer(ctdb->ev, handle, timeval_zero(),
+ pinned_down_requeue, handle);
return 0;
}
@@ -1405,8 +1414,9 @@ void ctdb_call_resend_all(struct ctdb_context *ctdb)
/*
this allows the caller to setup a async.fn
*/
-static void call_local_trigger(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void call_local_trigger(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_call_state *state = talloc_get_type(private_data, struct ctdb_call_state);
if (state->async.fn) {
@@ -1446,7 +1456,8 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_db_context *ctdb_db,
DEBUG(DEBUG_DEBUG,("ctdb_call_local() failed, ignoring return code %d\n", ret));
}
- event_add_timed(ctdb->ev, state, timeval_zero(), call_local_trigger, state);
+ tevent_add_timer(ctdb->ev, state, timeval_zero(),
+ call_local_trigger, state);
return state;
}
@@ -1521,7 +1532,7 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd
int ctdb_daemon_call_recv(struct ctdb_call_state *state, struct ctdb_call *call)
{
while (state->state < CTDB_CALL_DONE) {
- event_loop_once(state->ctdb_db->ctdb->ev);
+ tevent_loop_once(state->ctdb_db->ctdb->ev);
}
if (state->state != CTDB_CALL_DONE) {
ctdb_set_error(state->ctdb_db->ctdb, "%s", state->errmsg);
@@ -1583,7 +1594,7 @@ struct revokechild_handle {
struct revokechild_handle *next, *prev;
struct ctdb_context *ctdb;
struct ctdb_db_context *ctdb_db;
- struct fd_event *fde;
+ struct tevent_fd *fde;
int status;
int fd[2];
pid_t child;
@@ -1597,8 +1608,9 @@ struct revokechild_requeue_handle {
void *ctx;
};
-static void deferred_call_requeue(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void deferred_call_requeue(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct revokechild_requeue_handle *requeue_handle = talloc_get_type(private_data, struct revokechild_requeue_handle);
@@ -1619,7 +1631,9 @@ static int deferred_call_destructor(struct revokechild_deferred_call *deferred_c
talloc_steal(requeue_handle, requeue_handle->hdr);
/* when revoking, any READONLY requests have 1 second grace to let read/write finish first */
- event_add_timed(ctdb->ev, requeue_handle, timeval_current_ofs(c->flags & CTDB_WANT_READONLY ? 1 : 0, 0), deferred_call_requeue, requeue_handle);
+ tevent_add_timer(ctdb->ev, requeue_handle,
+ timeval_current_ofs(c->flags & CTDB_WANT_READONLY ? 1 : 0, 0),
+ deferred_call_requeue, requeue_handle);
return 0;
}
@@ -1643,8 +1657,9 @@ static int revokechild_destructor(struct revokechild_handle *rc)
return 0;
}
-static void revokechild_handler(struct event_context *ev, struct fd_event *fde,
- uint16_t flags, void *private_data)
+static void revokechild_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *private_data)
{
struct revokechild_handle *rc = talloc_get_type(private_data,
struct revokechild_handle);
@@ -1720,8 +1735,9 @@ static void revoke_send_cb(struct ctdb_context *ctdb, uint32_t pnn, void *privat
}
-static void ctdb_revoke_timeout_handler(struct event_context *ev, struct timed_event *te,
- struct timeval yt, void *private_data)
+static void ctdb_revoke_timeout_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval yt, void *private_data)
{
struct ctdb_revoke_state *state = private_data;
@@ -1743,10 +1759,12 @@ static int ctdb_revoke_all_delegations(struct ctdb_context *ctdb, struct ctdb_db
ctdb_trackingdb_traverse(ctdb, tdata, revoke_send_cb, state);
- event_add_timed(ctdb->ev, state, timeval_current_ofs(ctdb->tunable.control_timeout, 0), ctdb_revoke_timeout_handler, state);
+ tevent_add_timer(ctdb->ev, state,
+ timeval_current_ofs(ctdb->tunable.control_timeout, 0),
+ ctdb_revoke_timeout_handler, state);
while (state->finished == 0) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
if (ctdb_ltdb_lock(ctdb_db, key) != 0) {
@@ -1884,9 +1902,8 @@ child_finished:
/* This is an active revokechild child process */
DLIST_ADD_END(ctdb_db->revokechild_active, rc, NULL);
- rc->fde = event_add_fd(ctdb->ev, rc, rc->fd[0],
- EVENT_FD_READ, revokechild_handler,
- (void *)rc);
+ rc->fde = tevent_add_fd(ctdb->ev, rc, rc->fd[0], TEVENT_FD_READ,
+ revokechild_handler, (void *)rc);
if (rc->fde == NULL) {
DEBUG(DEBUG_ERR,("Failed to set up fd event for revokechild process\n"));
talloc_free(rc);
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 03e19dfc285..eeb810f96ec 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -822,8 +822,9 @@ static int ctdb_control_destructor(struct ctdb_control_state *state)
/*
handle a timeout of a control
*/
-static void ctdb_control_timeout(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_control_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_control_state *state = talloc_get_type(private_data, struct ctdb_control_state);
TALLOC_CTX *tmp_ctx = talloc_new(ev);
@@ -915,9 +916,9 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
}
if (ctdb->tunable.control_timeout) {
- event_add_timed(ctdb->ev, state,
- timeval_current_ofs(ctdb->tunable.control_timeout, 0),
- ctdb_control_timeout, state);
+ tevent_add_timer(ctdb->ev, state,
+ timeval_current_ofs(ctdb->tunable.control_timeout, 0),
+ ctdb_control_timeout, state);
}
talloc_free(c);
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index f7798671abe..d8c2280a426 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -57,7 +57,7 @@ static void print_exit_message(void)
-static void ctdb_time_tick(struct event_context *ev, struct timed_event *te,
+static void ctdb_time_tick(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
@@ -66,9 +66,9 @@ static void ctdb_time_tick(struct event_context *ev, struct timed_event *te,
return;
}
- event_add_timed(ctdb->ev, ctdb,
- timeval_current_ofs(1, 0),
- ctdb_time_tick, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb,
+ timeval_current_ofs(1, 0),
+ ctdb_time_tick, ctdb);
}
/* Used to trigger a dummy event once per second, to make
@@ -76,9 +76,9 @@ static void ctdb_time_tick(struct event_context *ev, struct timed_event *te,
*/
static void ctdb_start_time_tickd(struct ctdb_context *ctdb)
{
- event_add_timed(ctdb->ev, ctdb,
- timeval_current_ofs(1, 0),
- ctdb_time_tick, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb,
+ timeval_current_ofs(1, 0),
+ ctdb_time_tick, ctdb);
}
static void ctdb_start_periodic_events(struct ctdb_context *ctdb)
@@ -418,8 +418,9 @@ struct ctdb_deferred_requeue {
};
/* called from a timer event and starts reprocessing the deferred call.*/
-static void reprocess_deferred_call(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void reprocess_deferred_call(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_deferred_requeue *dfr = (struct ctdb_deferred_requeue *)private_data;
struct ctdb_client *client = dfr->client;
@@ -467,7 +468,8 @@ static int deferred_fetch_queue_destructor(struct ctdb_deferred_fetch_queue *dfq
dfr->dfc = talloc_steal(dfr, dfc);
dfr->client = client;
- event_add_timed(dfc->w->ctdb->ev, client, timeval_zero(), reprocess_deferred_call, dfr);
+ tevent_add_timer(dfc->w->ctdb->ev, client, timeval_zero(),
+ reprocess_deferred_call, dfr);
}
return 0;
@@ -491,8 +493,8 @@ static void *insert_dfq_callback(void *parm, void *data)
free the context and context for all deferred requests to cause them to be
re-inserted into the event system.
*/
-static void dfq_timeout(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void dfq_timeout(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
talloc_free(private_data);
}
@@ -527,7 +529,8 @@ static int setup_deferred_fetch_locks(struct ctdb_db_context *ctdb_db, struct ct
/* if the fetch havent completed in 30 seconds, just tear it all down
and let it try again as the events are reissued */
- event_add_timed(ctdb_db->ctdb->ev, dfq, timeval_current_ofs(30, 0), dfq_timeout, dfq);
+ tevent_add_timer(ctdb_db->ctdb->ev, dfq, timeval_current_ofs(30, 0),
+ dfq_timeout, dfq);
talloc_free(k);
return 0;
@@ -903,8 +906,9 @@ static int ctdb_clientpid_destructor(struct ctdb_client_pid_list *client_pid)
}
-static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde,
- uint16_t flags, void *private_data)
+static void ctdb_accept_client(struct tevent_context *ev,
+ struct tevent_fd *fde, uint16_t flags,
+ void *private_data)
{
struct sockaddr_un addr;
socklen_t len;
@@ -1196,7 +1200,7 @@ static void ctdb_set_my_pnn(struct ctdb_context *ctdb)
int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
{
int res, ret = -1;
- struct fd_event *fde;
+ struct tevent_fd *fde;
/* create a unix domain stream socket to listen to */
res = ux_socket_bind(ctdb);
@@ -1243,7 +1247,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
DEBUG(DEBUG_NOTICE, ("Set real-time scheduler priority\n"));
}
- ctdb->ev = event_context_init(NULL);
+ ctdb->ev = tevent_context_init(NULL);
tevent_loop_allow_nesting(ctdb->ev);
tevent_set_trace_callback(ctdb->ev, ctdb_tevent_trace, ctdb);
ret = ctdb_init_tevent_logging(ctdb);
@@ -1327,9 +1331,8 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
}
/* now start accepting clients, only can do this once frozen */
- fde = event_add_fd(ctdb->ev, ctdb, ctdb->daemon.sd,
- EVENT_FD_READ,
- ctdb_accept_client, ctdb);
+ fde = tevent_add_fd(ctdb->ev, ctdb, ctdb->daemon.sd, TEVENT_FD_READ,
+ ctdb_accept_client, ctdb);
if (fde == NULL) {
ctdb_fatal(ctdb, "Failed to add daemon socket to event loop");
}
@@ -1361,7 +1364,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
lockdown_memory(ctdb->valgrinding);
/* go into a wait loop to allow other nodes to complete */
- event_loop_wait(ctdb->ev);
+ tevent_loop_wait(ctdb->ev);
DEBUG(DEBUG_CRIT,("event_loop_wait() returned. this should not happen\n"));
exit(1);
@@ -1563,8 +1566,8 @@ struct ctdb_local_message {
TDB_DATA data;
};
-static void ctdb_local_message_trigger(struct event_context *ev,
- struct timed_event *te,
+static void ctdb_local_message_trigger(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_local_message *m = talloc_get_type(
@@ -1590,7 +1593,8 @@ static int ctdb_local_message(struct ctdb_context *ctdb, uint64_t srvid, TDB_DAT
}
/* this needs to be done as an event to prevent recursion */
- event_add_timed(ctdb->ev, m, timeval_zero(), ctdb_local_message_trigger, m);
+ tevent_add_timer(ctdb->ev, m, timeval_zero(),
+ ctdb_local_message_trigger, m);
return 0;
}
diff --git a/ctdb/server/ctdb_keepalive.c b/ctdb/server/ctdb_keepalive.c
index 5c95eb0c9b9..c286618c0a3 100644
--- a/ctdb/server/ctdb_keepalive.c
+++ b/ctdb/server/ctdb_keepalive.c
@@ -27,7 +27,8 @@
/*
see if any nodes are dead
*/
-static void ctdb_check_for_dead_nodes(struct event_context *ev, struct timed_event *te,
+static void ctdb_check_for_dead_nodes(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
@@ -77,23 +78,23 @@ static void ctdb_check_for_dead_nodes(struct event_context *ev, struct timed_eve
node->tx_cnt = 0;
}
-
- event_add_timed(ctdb->ev, ctdb->keepalive_ctx,
- timeval_current_ofs(ctdb->tunable.keepalive_interval, 0),
- ctdb_check_for_dead_nodes, ctdb);
+
+ tevent_add_timer(ctdb->ev, ctdb->keepalive_ctx,
+ timeval_current_ofs(ctdb->tunable.keepalive_interval, 0),
+ ctdb_check_for_dead_nodes, ctdb);
}
void ctdb_start_keepalive(struct ctdb_context *ctdb)
{
- struct timed_event *te;
+ struct tevent_timer *te;
ctdb->keepalive_ctx = talloc_new(ctdb);
CTDB_NO_MEMORY_FATAL(ctdb, ctdb->keepalive_ctx);
- te = event_add_timed(ctdb->ev, ctdb->keepalive_ctx,
- timeval_current_ofs(ctdb->tunable.keepalive_interval, 0),
- ctdb_check_for_dead_nodes, ctdb);
+ te = tevent_add_timer(ctdb->ev, ctdb->keepalive_ctx,
+ timeval_current_ofs(ctdb->tunable.keepalive_interval, 0),
+ ctdb_check_for_dead_nodes, ctdb);
CTDB_NO_MEMORY_FATAL(ctdb, te);
DEBUG(DEBUG_NOTICE,("Keepalive monitoring has been started\n"));
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c
index 104ebcd97f4..734327e9cce 100644
--- a/ctdb/server/ctdb_lock.c
+++ b/ctdb/server/ctdb_lock.c
@@ -879,7 +879,7 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
lock_ctx->tfd = tevent_add_fd(ctdb->ev,
lock_ctx,
lock_ctx->fd[0],
- EVENT_FD_READ,
+ TEVENT_FD_READ,
ctdb_lock_handler,
(void *)lock_ctx);
if (lock_ctx->tfd == NULL) {
diff --git a/ctdb/server/ctdb_logging.c b/ctdb/server/ctdb_logging.c
index b2e8a6ec447..7eefe232599 100644
--- a/ctdb/server/ctdb_logging.c
+++ b/ctdb/server/ctdb_logging.c
@@ -118,15 +118,15 @@ static void write_to_log(struct ctdb_log_state *log,
/*
called when log data comes in from a child process
*/
-static void ctdb_child_log_handler(struct event_context *ev,
- struct fd_event *fde,
+static void ctdb_child_log_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *private)
{
struct ctdb_log_state *log = talloc_get_type(private, struct ctdb_log_state);
char *p;
int n;
- if (!(flags & EVENT_FD_READ)) {
+ if (!(flags & TEVENT_FD_READ)) {
return;
}
@@ -236,7 +236,7 @@ struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx,
log->pfd = p[0];
set_close_on_exec(log->pfd);
talloc_set_destructor(log, log_context_destructor);
- fde = tevent_add_fd(ctdb->ev, log, log->pfd, EVENT_FD_READ,
+ fde = tevent_add_fd(ctdb->ev, log, log->pfd, TEVENT_FD_READ,
ctdb_child_log_handler, log);
tevent_fd_set_auto_close(fde);
@@ -293,8 +293,8 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
close(old_stdout);
close(old_stderr);
- fde = event_add_fd(ctdb->ev, log_state, p[0],
- EVENT_FD_READ, ctdb_child_log_handler, log_state);
+ fde = tevent_add_fd(ctdb->ev, log_state, p[0], TEVENT_FD_READ,
+ ctdb_child_log_handler, log_state);
tevent_fd_set_auto_close(fde);
log_state->pfd = p[0];
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index 5e4128bd326..becf80f8b1b 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -1037,7 +1037,9 @@ static int ctdb_deferred_attach_destructor(struct ctdb_deferred_attach_context *
return 0;
}
-static void ctdb_deferred_attach_timeout(struct event_context *ev, struct timed_event *te, struct timeval t, void *private_data)
+static void ctdb_deferred_attach_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_deferred_attach_context *da_ctx = talloc_get_type(private_data, struct ctdb_deferred_attach_context);
struct ctdb_context *ctdb = da_ctx->ctdb;
@@ -1046,7 +1048,9 @@ static void ctdb_deferred_attach_timeout(struct event_context *ev, struct timed_
talloc_free(da_ctx);
}
-static void ctdb_deferred_attach_callback(struct event_context *ev, struct timed_event *te, struct timeval t, void *private_data)
+static void ctdb_deferred_attach_callback(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_deferred_attach_context *da_ctx = talloc_get_type(private_data, struct ctdb_deferred_attach_context);
struct ctdb_context *ctdb = da_ctx->ctdb;
@@ -1065,7 +1069,9 @@ int ctdb_process_deferred_attach(struct ctdb_context *ctdb)
*/
while ((da_ctx = ctdb->deferred_attach) != NULL) {
DLIST_REMOVE(ctdb->deferred_attach, da_ctx);
- event_add_timed(ctdb->ev, da_ctx, timeval_current_ofs(1,0), ctdb_deferred_attach_callback, da_ctx);
+ tevent_add_timer(ctdb->ev, da_ctx,
+ timeval_current_ofs(1,0),
+ ctdb_deferred_attach_callback, da_ctx);
}
return 0;
@@ -1125,7 +1131,9 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
talloc_set_destructor(da_ctx, ctdb_deferred_attach_destructor);
DLIST_ADD(ctdb->deferred_attach, da_ctx);
- event_add_timed(ctdb->ev, da_ctx, timeval_current_ofs(ctdb->tunable.deferred_attach_timeout, 0), ctdb_deferred_attach_timeout, da_ctx);
+ tevent_add_timer(ctdb->ev, da_ctx,
+ timeval_current_ofs(ctdb->tunable.deferred_attach_timeout, 0),
+ ctdb_deferred_attach_timeout, da_ctx);
DEBUG(DEBUG_ERR,("DB Attach to database %s deferred for client with pid:%d since node is in recovery mode.\n", db_name, client->pid));
*async_reply = true;
@@ -1503,7 +1511,8 @@ int32_t ctdb_ltdb_update_seqnum(struct ctdb_context *ctdb, uint32_t db_id, uint3
/*
timer to check for seqnum changes in a ltdb and propogate them
*/
-static void ctdb_ltdb_seqnum_check(struct event_context *ev, struct timed_event *te,
+static void ctdb_ltdb_seqnum_check(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *p)
{
struct ctdb_db_context *ctdb_db = talloc_get_type(p, struct ctdb_db_context);
@@ -1522,9 +1531,10 @@ static void ctdb_ltdb_seqnum_check(struct event_context *ev, struct timed_event
/* setup a new timer */
ctdb_db->seqnum_update =
- event_add_timed(ctdb->ev, ctdb_db,
- timeval_current_ofs(ctdb->tunable.seqnum_interval/1000, (ctdb->tunable.seqnum_interval%1000)*1000),
- ctdb_ltdb_seqnum_check, ctdb_db);
+ tevent_add_timer(ctdb->ev, ctdb_db,
+ timeval_current_ofs(ctdb->tunable.seqnum_interval/1000,
+ (ctdb->tunable.seqnum_interval%1000)*1000),
+ ctdb_ltdb_seqnum_check, ctdb_db);
}
/*
@@ -1540,10 +1550,11 @@ int32_t ctdb_ltdb_enable_seqnum(struct ctdb_context *ctdb, uint32_t db_id)
}
if (ctdb_db->seqnum_update == NULL) {
- ctdb_db->seqnum_update =
- event_add_timed(ctdb->ev, ctdb_db,
- timeval_current_ofs(ctdb->tunable.seqnum_interval/1000, (ctdb->tunable.seqnum_interval%1000)*1000),
- ctdb_ltdb_seqnum_check, ctdb_db);
+ ctdb_db->seqnum_update = tevent_add_timer(
+ ctdb->ev, ctdb_db,
+ timeval_current_ofs(ctdb->tunable.seqnum_interval/1000,
+ (ctdb->tunable.seqnum_interval%1000)*1000),
+ ctdb_ltdb_seqnum_check, ctdb_db);
}
tdb_enable_seqnum(ctdb_db->ltdb->tdb);
diff --git a/ctdb/server/ctdb_monitor.c b/ctdb/server/ctdb_monitor.c
index 493e55a02ae..44c3a7db89e 100644
--- a/ctdb/server/ctdb_monitor.c
+++ b/ctdb/server/ctdb_monitor.c
@@ -30,7 +30,8 @@ struct ctdb_monitor_state {
uint32_t next_interval;
};
-static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
+static void ctdb_check_health(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data);
/*
@@ -164,9 +165,9 @@ after_change_status:
ctdb->monitor->next_interval = ctdb->tunable.monitor_interval;
}
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(next_interval, 0),
- ctdb_check_health, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(next_interval, 0),
+ ctdb_check_health, ctdb);
if (c.old_flags == node->flags) {
return;
@@ -200,7 +201,8 @@ after_change_status:
}
-static void ctdb_run_startup(struct event_context *ev, struct timed_event *te,
+static void ctdb_run_startup(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data);
/*
called when the startup event script finishes
@@ -209,9 +211,9 @@ static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p
{
if (status != 0) {
DEBUG(DEBUG_ERR,("startup event failed\n"));
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(5, 0),
- ctdb_run_startup, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(5, 0),
+ ctdb_run_startup, ctdb);
return;
}
@@ -222,12 +224,13 @@ static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p
ctdb->monitor->monitoring_mode = CTDB_MONITORING_ACTIVE;
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(ctdb->monitor->next_interval, 0),
- ctdb_check_health, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(ctdb->monitor->next_interval, 0),
+ ctdb_check_health, ctdb);
}
-static void ctdb_run_startup(struct event_context *ev, struct timed_event *te,
+static void ctdb_run_startup(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data,
@@ -242,9 +245,9 @@ static void ctdb_run_startup(struct event_context *ev, struct timed_event *te,
if (ctdb->runstate < CTDB_RUNSTATE_STARTUP) {
DEBUG(DEBUG_NOTICE,
("Not yet in startup runstate. Wait one more second\n"));
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(1, 0),
- ctdb_run_startup, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(1, 0),
+ ctdb_run_startup, ctdb);
return;
}
@@ -259,9 +262,9 @@ static void ctdb_run_startup(struct event_context *ev, struct timed_event *te,
if (ret != 0) {
DEBUG(DEBUG_ERR,("Unable to launch startup event script\n"));
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(5, 0),
- ctdb_run_startup, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(5, 0),
+ ctdb_run_startup, ctdb);
}
}
@@ -269,8 +272,9 @@ static void ctdb_run_startup(struct event_context *ev, struct timed_event *te,
wait until we have finished initial recoveries before we start the
monitoring events
*/
-static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_wait_until_recovered(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
int ret;
@@ -288,9 +292,9 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
if (ctdb->vnn_map->generation == INVALID_GENERATION) {
ctdb->db_persistent_startup_generation = INVALID_GENERATION;
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(1, 0),
- ctdb_wait_until_recovered, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(1, 0),
+ ctdb_wait_until_recovered, ctdb);
return;
}
@@ -298,9 +302,9 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
ctdb->db_persistent_startup_generation = INVALID_GENERATION;
DEBUG(DEBUG_NOTICE,(__location__ " in recovery. Wait one more second\n"));
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(1, 0),
- ctdb_wait_until_recovered, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(1, 0),
+ ctdb_wait_until_recovered, ctdb);
return;
}
@@ -310,18 +314,18 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
DEBUG(DEBUG_NOTICE,(__location__ " wait for pending recoveries to end. Wait one more second.\n"));
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(1, 0),
- ctdb_wait_until_recovered, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(1, 0),
+ ctdb_wait_until_recovered, ctdb);
return;
}
if (ctdb->vnn_map->generation == ctdb->db_persistent_startup_generation) {
DEBUG(DEBUG_INFO,(__location__ " skip ctdb_recheck_persistent_health() "
"until the next recovery\n"));
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(1, 0),
- ctdb_wait_until_recovered, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(1, 0),
+ ctdb_wait_until_recovered, ctdb);
return;
}
@@ -335,10 +339,10 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
"failed (%llu of %llu times) - retry later\n",
(unsigned long long)ctdb->db_persistent_check_errors,
(unsigned long long)ctdb->max_persistent_check_errors));
- event_add_timed(ctdb->ev,
- ctdb->monitor->monitor_context,
- timeval_current_ofs(1, 0),
- ctdb_wait_until_recovered, ctdb);
+ tevent_add_timer(ctdb->ev,
+ ctdb->monitor->monitor_context,
+ timeval_current_ofs(1, 0),
+ ctdb_wait_until_recovered, ctdb);
return;
}
DEBUG(DEBUG_ALERT,(__location__
@@ -350,15 +354,16 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
}
ctdb->db_persistent_check_errors = 0;
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current(), ctdb_run_startup, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current(), ctdb_run_startup, ctdb);
}
/*
see if the event scripts think we are healthy
*/
-static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
+static void ctdb_check_health(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
@@ -377,9 +382,9 @@ static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
}
if (skip_monitoring) {
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(ctdb->monitor->next_interval, 0),
- ctdb_check_health, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(ctdb->monitor->next_interval, 0),
+ ctdb_check_health, ctdb);
return;
}
@@ -390,9 +395,9 @@ static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
if (ret != 0) {
DEBUG(DEBUG_ERR,("Unable to launch monitor event script\n"));
ctdb->monitor->next_interval = 5;
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(5, 0),
- ctdb_check_health, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(5, 0),
+ ctdb_check_health, ctdb);
}
}
@@ -442,9 +447,9 @@ void ctdb_wait_for_first_recovery(struct ctdb_context *ctdb)
ctdb->monitor->monitor_context = talloc_new(ctdb->monitor);
CTDB_NO_MEMORY_FATAL(ctdb, ctdb->monitor->monitor_context);
- event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
- timeval_current_ofs(1, 0),
- ctdb_wait_until_recovered, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->monitor->monitor_context,
+ timeval_current_ofs(1, 0),
+ ctdb_wait_until_recovered, ctdb);
}
diff --git a/ctdb/server/ctdb_persistent.c b/ctdb/server/ctdb_persistent.c
index 759421f5a76..20397452ef7 100644
--- a/ctdb/server/ctdb_persistent.c
+++ b/ctdb/server/ctdb_persistent.c
@@ -92,8 +92,9 @@ static void ctdb_persistent_callback(struct ctdb_context *ctdb,
/*
called if persistent store times out
*/
-static void ctdb_persistent_store_timeout(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_persistent_store_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_persistent_state *state = talloc_get_type(private_data, struct ctdb_persistent_state);
@@ -257,9 +258,9 @@ int32_t ctdb_control_trans3_commit(struct ctdb_context *ctdb,
talloc_steal(state, c);
/* but we won't wait forever */
- event_add_timed(ctdb->ev, state,
- timeval_current_ofs(ctdb->tunable.control_timeout, 0),
- ctdb_persistent_store_timeout, state);
+ tevent_add_timer(ctdb->ev, state,
+ timeval_current_ofs(ctdb->tunable.control_timeout, 0),
+ ctdb_persistent_store_timeout, state);
return 0;
}
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index 6ec66ded31f..9738fa88192 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -400,8 +400,8 @@ struct ctdb_set_recmode_state {
struct ctdb_req_control *c;
uint32_t recmode;
int fd[2];
- struct timed_event *te;
- struct fd_event *fde;
+ struct tevent_timer *te;
+ struct tevent_fd *fde;
pid_t child;
struct timeval start_time;
};
@@ -410,8 +410,9 @@ struct ctdb_set_recmode_state {
called if our set_recmode child times out. this would happen if
ctdb_recovery_lock() would block.
*/
-static void ctdb_set_recmode_timeout(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_set_recmode_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_set_recmode_state *state = talloc_get_type(private_data,
struct ctdb_set_recmode_state);
@@ -449,8 +450,9 @@ static int set_recmode_destructor(struct ctdb_set_recmode_state *state)
/* this is called when the client process has completed ctdb_recovery_lock()
and has written data back to us through the pipe.
*/
-static void set_recmode_handler(struct event_context *ev, struct fd_event *fde,
- uint16_t flags, void *private_data)
+static void set_recmode_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *private_data)
{
struct ctdb_set_recmode_state *state= talloc_get_type(private_data,
struct ctdb_set_recmode_state);
@@ -492,8 +494,8 @@ static void set_recmode_handler(struct event_context *ev, struct fd_event *fde,
}
static void
-ctdb_drop_all_ips_event(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+ctdb_drop_all_ips_event(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
@@ -516,7 +518,9 @@ int ctdb_deferred_drop_all_ips(struct ctdb_context *ctdb)
ctdb->release_ips_ctx = talloc_new(ctdb);
CTDB_NO_MEMORY(ctdb, ctdb->release_ips_ctx);
- event_add_timed(ctdb->ev, ctdb->release_ips_ctx, timeval_current_ofs(ctdb->tunable.recovery_drop_all_ips, 0), ctdb_drop_all_ips_event, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->release_ips_ctx,
+ timeval_current_ofs(ctdb->tunable.recovery_drop_all_ips, 0),
+ ctdb_drop_all_ips_event, ctdb);
return 0;
}
@@ -647,13 +651,11 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d for setrecmode\n", state->fd[0]));
- state->te = event_add_timed(ctdb->ev, state, timeval_current_ofs(5, 0),
- ctdb_set_recmode_timeout, state);
+ state->te = tevent_add_timer(ctdb->ev, state, timeval_current_ofs(5, 0),
+ ctdb_set_recmode_timeout, state);
- state->fde = event_add_fd(ctdb->ev, state, state->fd[0],
- EVENT_FD_READ,
- set_recmode_handler,
- (void *)state);
+ state->fde = tevent_add_fd(ctdb->ev, state, state->fd[0], TEVENT_FD_READ,
+ set_recmode_handler, (void *)state);
if (state->fde == NULL) {
talloc_free(state);
@@ -1272,7 +1274,9 @@ int32_t ctdb_control_get_capabilities(struct ctdb_context *ctdb, TDB_DATA *outda
If we havent been pinged for a while we assume the recovery
daemon is inoperable and we restart.
*/
-static void ctdb_recd_ping_timeout(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
+static void ctdb_recd_ping_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *p)
{
struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
uint32_t *count = talloc_get_type(ctdb->recd_ping_count, uint32_t);
@@ -1281,9 +1285,9 @@ static void ctdb_recd_ping_timeout(struct event_context *ev, struct timed_event
if (*count < ctdb->tunable.recd_ping_failcount) {
(*count)++;
- event_add_timed(ctdb->ev, ctdb->recd_ping_count,
- timeval_current_ofs(ctdb->tunable.recd_ping_timeout, 0),
- ctdb_recd_ping_timeout, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->recd_ping_count,
+ timeval_current_ofs(ctdb->tunable.recd_ping_timeout, 0),
+ ctdb_recd_ping_timeout, ctdb);
return;
}
@@ -1301,9 +1305,9 @@ int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb)
CTDB_NO_MEMORY(ctdb, ctdb->recd_ping_count);
if (ctdb->tunable.recd_ping_timeout != 0) {
- event_add_timed(ctdb->ev, ctdb->recd_ping_count,
- timeval_current_ofs(ctdb->tunable.recd_ping_timeout, 0),
- ctdb_recd_ping_timeout, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->recd_ping_count,
+ timeval_current_ofs(ctdb->tunable.recd_ping_timeout, 0),
+ ctdb_recd_ping_timeout, ctdb);
}
return 0;
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 0f30153fc13..5532db67216 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -170,8 +170,8 @@ static void ctdb_op_enable(struct ctdb_op_state *state)
TALLOC_FREE(state->timer);
}
-static void ctdb_op_timeout_handler(struct event_context *ev,
- struct timed_event *te,
+static void ctdb_op_timeout_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval yt, void *p)
{
struct ctdb_op_state *state =
@@ -232,8 +232,8 @@ struct ctdb_recoverd {
bool need_takeover_run;
bool need_recovery;
uint32_t node_flags;
- struct timed_event *send_election_te;
- struct timed_event *election_timeout;
+ struct tevent_timer *send_election_te;
+ struct tevent_timer *election_timeout;
struct srvid_requests *reallocate_requests;
struct ctdb_op_state *takeover_run;
struct ctdb_op_state *recovery;
@@ -245,7 +245,9 @@ struct ctdb_recoverd {
#define CONTROL_TIMEOUT() timeval_current_ofs(ctdb->tunable.recover_timeout, 0)
#define MONITOR_TIMEOUT() timeval_current_ofs(ctdb->tunable.recover_interval, 0)
-static void ctdb_restart_recd(struct event_context *ev, struct timed_event *te, struct timeval t, void *private_data);
+static void ctdb_restart_recd(struct tevent_context *ev,
+ struct tevent_timer *te, struct timeval t,
+ void *private_data);
/*
ban a node for a period of time
@@ -1170,7 +1172,8 @@ static void detach_database_handler(uint64_t srvid, TDB_DATA data,
/*
called when ctdb_wait_timeout should finish
*/
-static void ctdb_wait_handler(struct event_context *ev, struct timed_event *te,
+static void ctdb_wait_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval yt, void *p)
{
uint32_t *timed_out = (uint32_t *)p;
@@ -1184,16 +1187,18 @@ static void ctdb_wait_timeout(struct ctdb_context *ctdb, double secs)
{
uint32_t timed_out = 0;
time_t usecs = (secs - (time_t)secs) * 1000000;
- event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(secs, usecs), ctdb_wait_handler, &timed_out);
+ tevent_add_timer(ctdb->ev, ctdb, timeval_current_ofs(secs, usecs),
+ ctdb_wait_handler, &timed_out);
while (!timed_out) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
}
/*
called when an election times out (ends)
*/
-static void ctdb_election_timeout(struct event_context *ev, struct timed_event *te,
+static void ctdb_election_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *p)
{
struct ctdb_recoverd *rec = talloc_get_type(p, struct ctdb_recoverd);
@@ -1212,7 +1217,7 @@ static void ctdb_wait_election(struct ctdb_recoverd *rec)
{
struct ctdb_context *ctdb = rec->ctdb;
while (rec->election_timeout) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
}
@@ -2499,7 +2504,9 @@ static void unban_all_nodes(struct ctdb_context *ctdb)
/*
we think we are winning the election - send a broadcast election request
*/
-static void election_send_request(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
+static void election_send_request(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *p)
{
struct ctdb_recoverd *rec = talloc_get_type(p, struct ctdb_recoverd);
int ret;
@@ -2573,8 +2580,8 @@ static void reload_nodes_handler(uint64_t srvid, TDB_DATA data,
}
-static void ctdb_rebalance_timeout(struct event_context *ev,
- struct timed_event *te,
+static void ctdb_rebalance_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *p)
{
struct ctdb_recoverd *rec = talloc_get_type(p, struct ctdb_recoverd);
@@ -2648,9 +2655,9 @@ static void recd_node_rebalance_handler(uint64_t srvid, TDB_DATA data,
*/
deferred_rebalance = ctdb->tunable.deferred_rebalance_on_node_add;
if (deferred_rebalance != 0) {
- event_add_timed(ctdb->ev, rec->force_rebalance_nodes,
- timeval_current_ofs(deferred_rebalance, 0),
- ctdb_rebalance_timeout, rec);
+ tevent_add_timer(ctdb->ev, rec->force_rebalance_nodes,
+ timeval_current_ofs(deferred_rebalance, 0),
+ ctdb_rebalance_timeout, rec);
}
}
@@ -2839,11 +2846,12 @@ static void election_handler(uint64_t srvid, TDB_DATA data, void *private_data)
/* we got an election packet - update the timeout for the election */
talloc_free(rec->election_timeout);
- rec->election_timeout = event_add_timed(ctdb->ev, ctdb,
- fast_start ?
- timeval_current_ofs(0, 500000) :
- timeval_current_ofs(ctdb->tunable.election_timeout, 0),
- ctdb_election_timeout, rec);
+ rec->election_timeout = tevent_add_timer(
+ ctdb->ev, ctdb,
+ fast_start ?
+ timeval_current_ofs(0, 500000) :
+ timeval_current_ofs(ctdb->tunable.election_timeout, 0),
+ ctdb_election_timeout, rec);
/* someone called an election. check their election data
and if we disagree and we would rather be the elected node,
@@ -2851,9 +2859,10 @@ static void election_handler(uint64_t srvid, TDB_DATA data, void *private_data)
*/
if (ctdb_election_win(rec, em)) {
if (!rec->send_election_te) {
- rec->send_election_te = event_add_timed(ctdb->ev, rec,
- timeval_current_ofs(0, 500000),
- election_send_request, rec);
+ rec->send_election_te = tevent_add_timer(
+ ctdb->ev, rec,
+ timeval_current_ofs(0, 500000),
+ election_send_request, rec);
}
/*unban_all_nodes(ctdb);*/
return;
@@ -2900,11 +2909,12 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
}
talloc_free(rec->election_timeout);
- rec->election_timeout = event_add_timed(ctdb->ev, ctdb,
- fast_start ?
- timeval_current_ofs(0, 500000) :
- timeval_current_ofs(ctdb->tunable.election_timeout, 0),
- ctdb_election_timeout, rec);
+ rec->election_timeout = tevent_add_timer(
+ ctdb->ev, ctdb,
+ fast_start ?
+ timeval_current_ofs(0, 500000) :
+ timeval_current_ofs(ctdb->tunable.election_timeout, 0),
+ ctdb_election_timeout, rec);
ret = send_election_request(rec, pnn);
if (ret!=0) {
@@ -3128,7 +3138,7 @@ static enum monitor_result verify_recmode(struct ctdb_context *ctdb, struct ctdb
or until all nodes we expect a response from has replied
*/
while (rmdata->count > 0) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
status = rmdata->status;
@@ -3223,7 +3233,7 @@ static enum monitor_result verify_recmaster(struct ctdb_recoverd *rec, struct ct
or until all nodes we expect a response from has replied
*/
while (rmdata->count > 0) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
status = rmdata->status;
@@ -4200,7 +4210,8 @@ static void monitor_cluster(struct ctdb_context *ctdb)
/*
event handler for when the main ctdbd dies
*/
-static void ctdb_recoverd_parent(struct event_context *ev, struct fd_event *fde,
+static void ctdb_recoverd_parent(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *private_data)
{
DEBUG(DEBUG_ALERT,("recovery daemon parent died - exiting\n"));
@@ -4210,29 +4221,30 @@ static void ctdb_recoverd_parent(struct event_context *ev, struct fd_event *fde,
/*
called regularly to verify that the recovery daemon is still running
*/
-static void ctdb_check_recd(struct event_context *ev, struct timed_event *te,
- struct timeval yt, void *p)
+static void ctdb_check_recd(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval yt, void *p)
{
struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
if (ctdb_kill(ctdb, ctdb->recoverd_pid, 0) != 0) {
DEBUG(DEBUG_ERR,("Recovery daemon (pid:%d) is no longer running. Trying to restart recovery daemon.\n", (int)ctdb->recoverd_pid));
- event_add_timed(ctdb->ev, ctdb, timeval_zero(),
- ctdb_restart_recd, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb, timeval_zero(),
+ ctdb_restart_recd, ctdb);
return;
}
- event_add_timed(ctdb->ev, ctdb->recd_ctx,
- timeval_current_ofs(30, 0),
- ctdb_check_recd, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->recd_ctx,
+ timeval_current_ofs(30, 0),
+ ctdb_check_recd, ctdb);
}
-static void recd_sig_child_handler(struct event_context *ev,
- struct signal_event *se, int signum, int count,
- void *dont_care,
- void *private_data)
+static void recd_sig_child_handler(struct tevent_context *ev,
+ struct tevent_signal *se, int signum,
+ int count, void *dont_care,
+ void *private_data)
{
// struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
int status;
@@ -4258,7 +4270,7 @@ static void recd_sig_child_handler(struct event_context *ev,
int ctdb_start_recoverd(struct ctdb_context *ctdb)
{
int fd[2];
- struct signal_event *se;
+ struct tevent_signal *se;
struct tevent_fd *fde;
if (pipe(fd) != 0) {
@@ -4276,9 +4288,9 @@ int ctdb_start_recoverd(struct ctdb_context *ctdb)
CTDB_NO_MEMORY(ctdb, ctdb->recd_ctx);
close(fd[0]);
- event_add_timed(ctdb->ev, ctdb->recd_ctx,
- timeval_current_ofs(30, 0),
- ctdb_check_recd, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->recd_ctx,
+ timeval_current_ofs(30, 0),
+ ctdb_check_recd, ctdb);
return 0;
}
@@ -4294,15 +4306,13 @@ int ctdb_start_recoverd(struct ctdb_context *ctdb)
DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d to recovery daemon\n", fd[0]));
- fde = event_add_fd(ctdb->ev, ctdb, fd[0], EVENT_FD_READ,
- ctdb_recoverd_parent, &fd[0]);
+ fde = tevent_add_fd(ctdb->ev, ctdb, fd[0], TEVENT_FD_READ,
+ ctdb_recoverd_parent, &fd[0]);
tevent_fd_set_auto_close(fde);
/* set up a handler to pick up sigchld */
- se = event_add_signal(ctdb->ev, ctdb,
- SIGCHLD, 0,
- recd_sig_child_handler,
- ctdb);
+ se = tevent_add_signal(ctdb->ev, ctdb, SIGCHLD, 0,
+ recd_sig_child_handler, ctdb);
if (se == NULL) {
DEBUG(DEBUG_CRIT,("Failed to set up signal handler for SIGCHLD in recovery daemon\n"));
exit(1);
@@ -4330,8 +4340,9 @@ void ctdb_stop_recoverd(struct ctdb_context *ctdb)
TALLOC_FREE(ctdb->recd_ping_count);
}
-static void ctdb_restart_recd(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_restart_recd(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index 75aec16f767..2f4a1d3e0ca 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -335,7 +335,8 @@ struct queue_next {
/*
triggered when a deferred packet is due
*/
-static void queue_next_trigger(struct event_context *ev, struct timed_event *te,
+static void queue_next_trigger(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct queue_next *q = talloc_get_type(private_data, struct queue_next);
@@ -365,7 +366,7 @@ static void ctdb_defer_packet(struct ctdb_context *ctdb, struct ctdb_req_header
/* use this to put packets directly into our recv function */
ctdb_input_pkt(q->ctdb, q->hdr);
#else
- event_add_timed(ctdb->ev, q, timeval_zero(), queue_next_trigger, q);
+ tevent_add_timer(ctdb->ev, q, timeval_zero(), queue_next_trigger, q);
#endif
}
diff --git a/ctdb/server/ctdb_statistics.c b/ctdb/server/ctdb_statistics.c
index 96aad783237..cb245d60806 100644
--- a/ctdb/server/ctdb_statistics.c
+++ b/ctdb/server/ctdb_statistics.c
@@ -21,7 +21,8 @@
#include <string.h>
#include "../include/ctdb_private.h"
-static void ctdb_statistics_update(struct event_context *ev, struct timed_event *te,
+static void ctdb_statistics_update(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *p)
{
struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
@@ -34,8 +35,9 @@ static void ctdb_statistics_update(struct event_context *ev, struct timed_event
bzero(&ctdb->statistics_current, sizeof(struct ctdb_statistics));
ctdb->statistics_current.statistics_start_time = timeval_current();
-
- event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(ctdb->tunable.stat_history_interval, 0), ctdb_statistics_update, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb,
+ timeval_current_ofs(ctdb->tunable.stat_history_interval, 0),
+ ctdb_statistics_update, ctdb);
}
int ctdb_statistics_init(struct ctdb_context *ctdb)
@@ -48,7 +50,9 @@ int ctdb_statistics_init(struct ctdb_context *ctdb)
bzero(ctdb->statistics_history, sizeof(ctdb->statistics_history));
- event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(ctdb->tunable.stat_history_interval, 0), ctdb_statistics_update, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb,
+ timeval_current_ofs(ctdb->tunable.stat_history_interval, 0),
+ ctdb_statistics_update, ctdb);
return 0;
}
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index d1330f1ff37..4535ee2b073 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -305,7 +305,8 @@ struct ctdb_client_ip {
/*
send a gratuitous arp
*/
-static void ctdb_control_send_arp(struct event_context *ev, struct timed_event *te,
+static void ctdb_control_send_arp(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_takeover_arp *arp = talloc_get_type(private_data,
@@ -348,9 +349,9 @@ static void ctdb_control_send_arp(struct event_context *ev, struct timed_event *
return;
}
- event_add_timed(arp->ctdb->ev, arp->vnn->takeover_ctx,
- timeval_current_ofs(CTDB_ARP_INTERVAL, 100000),
- ctdb_control_send_arp, arp);
+ tevent_add_timer(arp->ctdb->ev, arp->vnn->takeover_ctx,
+ timeval_current_ofs(CTDB_ARP_INTERVAL, 100000),
+ ctdb_control_send_arp, arp);
}
static int32_t ctdb_announce_vnn_iface(struct ctdb_context *ctdb,
@@ -385,8 +386,8 @@ static int32_t ctdb_announce_vnn_iface(struct ctdb_context *ctdb,
vnn->tcp_update_needed = true;
}
- event_add_timed(arp->ctdb->ev, vnn->takeover_ctx,
- timeval_zero(), ctdb_control_send_arp, arp);
+ tevent_add_timer(arp->ctdb->ev, vnn->takeover_ctx,
+ timeval_zero(), ctdb_control_send_arp, arp);
return 0;
}
@@ -3396,7 +3397,7 @@ struct ctdb_kill_tcp {
struct ctdb_vnn *vnn;
struct ctdb_context *ctdb;
int capture_fd;
- struct fd_event *fde;
+ struct tevent_fd *fde;
trbt_tree_t *connections;
void *private_data;
};
@@ -3463,7 +3464,8 @@ static uint32_t *killtcp_key(ctdb_sock_addr *src, ctdb_sock_addr *dst)
/*
called when we get a read event on the raw socket
*/
-static void capture_tcp_handler(struct event_context *ev, struct fd_event *fde,
+static void capture_tcp_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *private_data)
{
struct ctdb_kill_tcp *killtcp = talloc_get_type(private_data, struct ctdb_kill_tcp);
@@ -3471,7 +3473,7 @@ static void capture_tcp_handler(struct event_context *ev, struct fd_event *fde,
ctdb_sock_addr src, dst;
uint32_t ack_seq, seq;
- if (!(flags & EVENT_FD_READ)) {
+ if (!(flags & TEVENT_FD_READ)) {
return;
}
@@ -3535,7 +3537,8 @@ static int tickle_connection_traverse(void *param, void *data)
/*
called every second until all sentenced connections have been reset
*/
-static void ctdb_tickle_sentenced_connections(struct event_context *ev, struct timed_event *te,
+static void ctdb_tickle_sentenced_connections(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_kill_tcp *killtcp = talloc_get_type(private_data, struct ctdb_kill_tcp);
@@ -3558,8 +3561,9 @@ static void ctdb_tickle_sentenced_connections(struct event_context *ev, struct t
/* try tickling them again in a seconds time
*/
- event_add_timed(killtcp->ctdb->ev, killtcp, timeval_current_ofs(1, 0),
- ctdb_tickle_sentenced_connections, killtcp);
+ tevent_add_timer(killtcp->ctdb->ev, killtcp,
+ timeval_current_ofs(1, 0),
+ ctdb_tickle_sentenced_connections, killtcp);
}
/*
@@ -3685,16 +3689,17 @@ static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
if (killtcp->fde == NULL) {
- killtcp->fde = event_add_fd(ctdb->ev, killtcp, killtcp->capture_fd,
- EVENT_FD_READ,
- capture_tcp_handler, killtcp);
+ killtcp->fde = tevent_add_fd(ctdb->ev, killtcp,
+ killtcp->capture_fd,
+ TEVENT_FD_READ,
+ capture_tcp_handler, killtcp);
tevent_fd_set_auto_close(killtcp->fde);
/* We also need to set up some events to tickle all these connections
until they are all reset
*/
- event_add_timed(ctdb->ev, killtcp, timeval_current_ofs(1, 0),
- ctdb_tickle_sentenced_connections, killtcp);
+ tevent_add_timer(ctdb->ev, killtcp, timeval_current_ofs(1, 0),
+ ctdb_tickle_sentenced_connections, killtcp);
}
/* tickle him once now */
@@ -3876,9 +3881,9 @@ static int ctdb_send_set_tcp_tickles_for_ip(struct ctdb_context *ctdb,
/*
perform tickle updates if required
*/
-static void ctdb_update_tcp_tickles(struct event_context *ev,
- struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_update_tcp_tickles(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
int ret;
@@ -3909,11 +3914,10 @@ static void ctdb_update_tcp_tickles(struct event_context *ev,
}
}
- event_add_timed(ctdb->ev, ctdb->tickle_update_context,
- timeval_current_ofs(ctdb->tunable.tickle_update_interval, 0),
- ctdb_update_tcp_tickles, ctdb);
-}
-
+ tevent_add_timer(ctdb->ev, ctdb->tickle_update_context,
+ timeval_current_ofs(ctdb->tunable.tickle_update_interval, 0),
+ ctdb_update_tcp_tickles, ctdb);
+}
/*
start periodic update of tcp tickles
@@ -3922,9 +3926,9 @@ void ctdb_start_tcp_tickle_update(struct ctdb_context *ctdb)
{
ctdb->tickle_update_context = talloc_new(ctdb);
- event_add_timed(ctdb->ev, ctdb->tickle_update_context,
- timeval_current_ofs(ctdb->tunable.tickle_update_interval, 0),
- ctdb_update_tcp_tickles, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb->tickle_update_context,
+ timeval_current_ofs(ctdb->tunable.tickle_update_interval, 0),
+ ctdb_update_tcp_tickles, ctdb);
}
@@ -3940,8 +3944,9 @@ struct control_gratious_arp {
/*
send a control_gratuitous arp
*/
-static void send_gratious_arp(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void send_gratious_arp(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
int ret;
struct control_gratious_arp *arp = talloc_get_type(private_data,
@@ -3960,9 +3965,9 @@ static void send_gratious_arp(struct event_context *ev, struct timed_event *te,
return;
}
- event_add_timed(arp->ctdb->ev, arp,
- timeval_current_ofs(CTDB_ARP_INTERVAL, 0),
- send_gratious_arp, arp);
+ tevent_add_timer(arp->ctdb->ev, arp,
+ timeval_current_ofs(CTDB_ARP_INTERVAL, 0),
+ send_gratious_arp, arp);
}
@@ -4001,9 +4006,9 @@ int32_t ctdb_control_send_gratious_arp(struct ctdb_context *ctdb, TDB_DATA indat
arp->iface = talloc_strdup(arp, gratious_arp->iface);
CTDB_NO_MEMORY(ctdb, arp->iface);
arp->count = 0;
-
- event_add_timed(arp->ctdb->ev, arp,
- timeval_zero(), send_gratious_arp, arp);
+
+ tevent_add_timer(arp->ctdb->ev, arp,
+ timeval_zero(), send_gratious_arp, arp);
return 0;
}
@@ -4287,7 +4292,7 @@ struct ctdb_reloadips_handle {
int status;
int fd[2];
pid_t child;
- struct fd_event *fde;
+ struct tevent_fd *fde;
};
static int ctdb_reloadips_destructor(struct ctdb_reloadips_handle *h)
@@ -4303,17 +4308,18 @@ static int ctdb_reloadips_destructor(struct ctdb_reloadips_handle *h)
return 0;
}
-static void ctdb_reloadips_timeout_event(struct event_context *ev,
- struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_reloadips_timeout_event(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_reloadips_handle *h = talloc_get_type(private_data, struct ctdb_reloadips_handle);
talloc_free(h);
-}
+}
-static void ctdb_reloadips_child_handler(struct event_context *ev, struct fd_event *fde,
- uint16_t flags, void *private_data)
+static void ctdb_reloadips_child_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *private_data)
{
struct ctdb_reloadips_handle *h = talloc_get_type(private_data, struct ctdb_reloadips_handle);
@@ -4573,14 +4579,12 @@ int32_t ctdb_control_reload_public_ips(struct ctdb_context *ctdb, struct ctdb_re
talloc_set_destructor(h, ctdb_reloadips_destructor);
- h->fde = event_add_fd(ctdb->ev, h, h->fd[0],
- EVENT_FD_READ, ctdb_reloadips_child_handler,
- (void *)h);
+ h->fde = tevent_add_fd(ctdb->ev, h, h->fd[0], TEVENT_FD_READ,
+ ctdb_reloadips_child_handler, (void *)h);
tevent_fd_set_auto_close(h->fde);
- event_add_timed(ctdb->ev, h,
- timeval_current_ofs(120, 0),
- ctdb_reloadips_timeout_event, h);
+ tevent_add_timer(ctdb->ev, h, timeval_current_ofs(120, 0),
+ ctdb_reloadips_timeout_event, h);
/* we reply later */
*async_reply = true;
diff --git a/ctdb/server/ctdb_traverse.c b/ctdb/server/ctdb_traverse.c
index 3b7eae80a6c..1f1562b2e35 100644
--- a/ctdb/server/ctdb_traverse.c
+++ b/ctdb/server/ctdb_traverse.c
@@ -260,7 +260,7 @@ static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_con
DLIST_ADD(ctdb_db->traverse, h);
- h->fde = tevent_add_fd(ctdb_db->ctdb->ev, h, h->fd[0], EVENT_FD_READ,
+ h->fde = tevent_add_fd(ctdb_db->ctdb->ev, h, h->fd[0], TEVENT_FD_READ,
ctdb_traverse_child_handler, h);
if (h->fde == NULL) {
close(h->fd[0]);
@@ -310,7 +310,8 @@ struct ctdb_traverse_all_ext {
};
/* called when a traverse times out */
-static void ctdb_traverse_all_timeout(struct event_context *ev, struct timed_event *te,
+static void ctdb_traverse_all_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_traverse_all_handle *state = talloc_get_type(private_data, struct ctdb_traverse_all_handle);
@@ -438,9 +439,9 @@ static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_
ctdb_db->db_name, state->reqid));
/* timeout the traverse */
- event_add_timed(ctdb->ev, state,
- timeval_current_ofs(ctdb->tunable.traverse_timeout, 0),
- ctdb_traverse_all_timeout, state);
+ tevent_add_timer(ctdb->ev, state,
+ timeval_current_ofs(ctdb->tunable.traverse_timeout, 0),
+ ctdb_traverse_all_timeout, state);
return state;
}
diff --git a/ctdb/server/ctdb_update_record.c b/ctdb/server/ctdb_update_record.c
index 3b5ea689730..398cdbaa350 100644
--- a/ctdb/server/ctdb_update_record.c
+++ b/ctdb/server/ctdb_update_record.c
@@ -140,7 +140,8 @@ static void ctdb_persistent_write_callback(int status, void *private_data)
/*
called if our lockwait child times out
*/
-static void ctdb_persistent_lock_timeout(struct event_context *ev, struct timed_event *te,
+static void ctdb_persistent_lock_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_persistent_write_state *state = talloc_get_type(private_data,
@@ -152,7 +153,7 @@ static void ctdb_persistent_lock_timeout(struct event_context *ev, struct timed_
struct childwrite_handle {
struct ctdb_context *ctdb;
struct ctdb_db_context *ctdb_db;
- struct fd_event *fde;
+ struct tevent_fd *fde;
int fd[2];
pid_t child;
void *private_data;
@@ -170,8 +171,9 @@ static int childwrite_destructor(struct childwrite_handle *h)
/* called when the child process has finished writing the record to the
database
*/
-static void childwrite_handler(struct event_context *ev, struct fd_event *fde,
- uint16_t flags, void *private_data)
+static void childwrite_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *private_data)
{
struct childwrite_handle *h = talloc_get_type(private_data,
struct childwrite_handle);
@@ -275,9 +277,9 @@ static struct childwrite_handle *ctdb_childwrite(
DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d for ctdb_childwrite\n", result->fd[0]));
- result->fde = event_add_fd(ctdb_db->ctdb->ev, result, result->fd[0],
- EVENT_FD_READ, childwrite_handler,
- (void *)result);
+ result->fde = tevent_add_fd(ctdb_db->ctdb->ev, result, result->fd[0],
+ TEVENT_FD_READ, childwrite_handler,
+ (void *)result);
if (result->fde == NULL) {
talloc_free(result);
CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_childwrite_calls);
@@ -348,8 +350,9 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
talloc_steal(state, c);
/* but we won't wait forever */
- event_add_timed(ctdb->ev, state, timeval_current_ofs(ctdb->tunable.control_timeout, 0),
- ctdb_persistent_lock_timeout, state);
+ tevent_add_timer(ctdb->ev, state,
+ timeval_current_ofs(ctdb->tunable.control_timeout, 0),
+ ctdb_persistent_lock_timeout, state);
return 0;
}
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c
index 39eed0b74e5..49bc7ff7159 100644
--- a/ctdb/server/ctdb_vacuum.c
+++ b/ctdb/server/ctdb_vacuum.c
@@ -203,7 +203,8 @@ static int add_record_to_vacuum_fetch_list(struct vacuum_data *vdata,
}
-static void ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
+static void ctdb_vacuum_event(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *private_data);
static int vacuum_record_parser(TDB_DATA key, TDB_DATA data, void *private_data)
@@ -1369,9 +1370,9 @@ static int vacuum_child_destructor(struct ctdb_vacuum_child_context *child_ctx)
DLIST_REMOVE(ctdb->vacuumers, child_ctx);
- event_add_timed(ctdb->ev, child_ctx->vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
- ctdb_vacuum_event, child_ctx->vacuum_handle);
+ tevent_add_timer(ctdb->ev, child_ctx->vacuum_handle,
+ timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
+ ctdb_vacuum_event, child_ctx->vacuum_handle);
return 0;
}
@@ -1379,8 +1380,9 @@ static int vacuum_child_destructor(struct ctdb_vacuum_child_context *child_ctx)
/*
* this event is generated when a vacuum child process times out
*/
-static void vacuum_child_timeout(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void vacuum_child_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_vacuum_child_context *child_ctx = talloc_get_type(private_data, struct ctdb_vacuum_child_context);
@@ -1395,8 +1397,9 @@ static void vacuum_child_timeout(struct event_context *ev, struct timed_event *t
/*
* this event is generated when a vacuum child process has completed
*/
-static void vacuum_child_handler(struct event_context *ev, struct fd_event *fde,
- uint16_t flags, void *private_data)
+static void vacuum_child_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *private_data)
{
struct ctdb_vacuum_child_context *child_ctx = talloc_get_type(private_data, struct ctdb_vacuum_child_context);
char c = 0;
@@ -1419,9 +1422,9 @@ static void vacuum_child_handler(struct event_context *ev, struct fd_event *fde,
/*
* this event is called every time we need to start a new vacuum process
*/
-static void
-ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void ctdb_vacuum_event(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_vacuum_handle *vacuum_handle = talloc_get_type(private_data, struct ctdb_vacuum_handle);
struct ctdb_db_context *ctdb_db = vacuum_handle->ctdb_db;
@@ -1438,9 +1441,9 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
: ctdb->freeze_mode[ctdb_db->priority] == CTDB_FREEZE_PENDING
? "freeze pending"
: "frozen"));
- event_add_timed(ctdb->ev, vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
- ctdb_vacuum_event, vacuum_handle);
+ tevent_add_timer(ctdb->ev, vacuum_handle,
+ timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
+ ctdb_vacuum_event, vacuum_handle);
return;
}
@@ -1449,9 +1452,9 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
* new vacuuming event to stagger vacuuming events.
*/
if (ctdb->vacuumers != NULL) {
- event_add_timed(ctdb->ev, vacuum_handle,
- timeval_current_ofs(0, 500*1000),
- ctdb_vacuum_event, vacuum_handle);
+ tevent_add_timer(ctdb->ev, vacuum_handle,
+ timeval_current_ofs(0, 500*1000),
+ ctdb_vacuum_event, vacuum_handle);
return;
}
@@ -1466,9 +1469,9 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
if (ret != 0) {
talloc_free(child_ctx);
DEBUG(DEBUG_ERR, ("Failed to create pipe for vacuum child process.\n"));
- event_add_timed(ctdb->ev, vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
- ctdb_vacuum_event, vacuum_handle);
+ tevent_add_timer(ctdb->ev, vacuum_handle,
+ timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
+ ctdb_vacuum_event, vacuum_handle);
return;
}
@@ -1482,9 +1485,9 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
close(child_ctx->fd[1]);
talloc_free(child_ctx);
DEBUG(DEBUG_ERR, ("Failed to fork vacuum child process.\n"));
- event_add_timed(ctdb->ev, vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
- ctdb_vacuum_event, vacuum_handle);
+ tevent_add_timer(ctdb->ev, vacuum_handle,
+ timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
+ ctdb_vacuum_event, vacuum_handle);
return;
}
@@ -1532,14 +1535,14 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
"in parent context. Shutting down\n");
}
- event_add_timed(ctdb->ev, child_ctx,
- timeval_current_ofs(ctdb->tunable.vacuum_max_run_time, 0),
- vacuum_child_timeout, child_ctx);
+ tevent_add_timer(ctdb->ev, child_ctx,
+ timeval_current_ofs(ctdb->tunable.vacuum_max_run_time, 0),
+ vacuum_child_timeout, child_ctx);
DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d to child vacuum process\n", child_ctx->fd[0]));
- fde = event_add_fd(ctdb->ev, child_ctx, child_ctx->fd[0],
- EVENT_FD_READ, vacuum_child_handler, child_ctx);
+ fde = tevent_add_fd(ctdb->ev, child_ctx, child_ctx->fd[0],
+ TEVENT_FD_READ, vacuum_child_handler, child_ctx);
tevent_fd_set_auto_close(fde);
vacuum_handle->child_ctx = child_ctx;
@@ -1574,9 +1577,9 @@ int ctdb_vacuum_init(struct ctdb_db_context *ctdb_db)
ctdb_db->vacuum_handle->ctdb_db = ctdb_db;
ctdb_db->vacuum_handle->fast_path_count = 0;
- event_add_timed(ctdb_db->ctdb->ev, ctdb_db->vacuum_handle,
- timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
- ctdb_vacuum_event, ctdb_db->vacuum_handle);
+ tevent_add_timer(ctdb_db->ctdb->ev, ctdb_db->vacuum_handle,
+ timeval_current_ofs(get_vacuum_interval(ctdb_db), 0),
+ ctdb_vacuum_event, ctdb_db->vacuum_handle);
return 0;
}
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index 55db1fc3454..ff6d181f095 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -141,7 +141,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -165,7 +165,7 @@ int main(int argc, const char *argv[])
fault_setup();
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
tevent_loop_allow_nesting(ev);
ctdb = ctdb_cmdline_init(ev);
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index b1b77cd1cdd..27ec91f7bb8 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -28,7 +28,9 @@
#include "lib/util/dlinklist.h"
#include "common/system.h"
-static void ctdb_event_script_timeout(struct event_context *ev, struct timed_event *te, struct timeval t, void *p);
+static void ctdb_event_script_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *p);
/* This is attached to the event script state. */
struct event_script_callback {
@@ -269,7 +271,8 @@ failed:
}
-static void ctdb_event_script_handler(struct event_context *ev, struct fd_event *fde,
+static void ctdb_event_script_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *p);
static char helper_prog[PATH_MAX+1] = "";
@@ -325,8 +328,8 @@ static int fork_child_for_script(struct ctdb_context *ctdb,
set_close_on_exec(state->fd[0]);
/* Set ourselves up to be called when that's done. */
- fde = event_add_fd(ctdb->ev, state, state->fd[0], EVENT_FD_READ,
- ctdb_event_script_handler, state);
+ fde = tevent_add_fd(ctdb->ev, state, state->fd[0], TEVENT_FD_READ,
+ ctdb_event_script_handler, state);
tevent_fd_set_auto_close(fde);
return 0;
@@ -359,7 +362,8 @@ static int script_status(struct ctdb_scripts_wire *scripts)
}
/* called when child is finished */
-static void ctdb_event_script_handler(struct event_context *ev, struct fd_event *fde,
+static void ctdb_event_script_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *p)
{
struct ctdb_event_script_state *state =
@@ -509,7 +513,7 @@ static void ctdb_run_debug_hung_script(struct ctdb_context *ctdb, struct debug_h
return;
}
- tfd = tevent_add_fd(ctdb->ev, state, fd[0], EVENT_FD_READ,
+ tfd = tevent_add_fd(ctdb->ev, state, fd[0], TEVENT_FD_READ,
debug_hung_script_done, state);
if (tfd == NULL) {
talloc_free(ttimer);
@@ -520,7 +524,8 @@ static void ctdb_run_debug_hung_script(struct ctdb_context *ctdb, struct debug_h
}
/* called when child times out */
-static void ctdb_event_script_timeout(struct event_context *ev, struct timed_event *te,
+static void ctdb_event_script_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *p)
{
struct ctdb_event_script_state *state = talloc_get_type(p, struct ctdb_event_script_state);
@@ -812,7 +817,10 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
}
if (!timeval_is_zero(&state->timeout)) {
- event_add_timed(ctdb->ev, state, timeval_current_ofs(state->timeout.tv_sec, state->timeout.tv_usec), ctdb_event_script_timeout, state);
+ tevent_add_timer(ctdb->ev, state,
+ timeval_current_ofs(state->timeout.tv_sec,
+ state->timeout.tv_usec),
+ ctdb_event_script_timeout, state);
} else {
DEBUG(DEBUG_ERR, (__location__ " eventscript %s %s called with no timeout\n",
ctdb_eventscript_call_names[state->call],
@@ -882,7 +890,7 @@ int ctdb_event_script_args(struct ctdb_context *ctdb, enum ctdb_eventscript_call
return ret;
}
- while (status.done == false && event_loop_once(ctdb->ev) == 0) /* noop */;
+ while (status.done == false && tevent_loop_once(ctdb->ev) == 0) /* noop */;
if (status.status == -ETIME) {
DEBUG(DEBUG_ERR, (__location__ " eventscript for '%s' timedout."
diff --git a/ctdb/tcp/ctdb_tcp.h b/ctdb/tcp/ctdb_tcp.h
index 5b6b6516b70..0a998c94da4 100644
--- a/ctdb/tcp/ctdb_tcp.h
+++ b/ctdb/tcp/ctdb_tcp.h
@@ -41,15 +41,15 @@ struct ctdb_incoming {
struct ctdb_tcp_node {
int fd;
struct ctdb_queue *out_queue;
- struct fd_event *connect_fde;
- struct timed_event *connect_te;
+ struct tevent_fd *connect_fde;
+ struct tevent_timer *connect_te;
};
/* prototypes internal to tcp transport */
int ctdb_tcp_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length);
int ctdb_tcp_listen(struct ctdb_context *ctdb);
-void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
+void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data);
void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args);
void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data);
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index 5935bf44665..d79b581ec93 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -61,15 +61,16 @@ void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data)
}
ctdb_tcp_stop_connection(node);
- tnode->connect_te = event_add_timed(node->ctdb->ev, tnode,
- timeval_current_ofs(3, 0),
- ctdb_tcp_node_connect, node);
+ tnode->connect_te = tevent_add_timer(node->ctdb->ev, tnode,
+ timeval_current_ofs(3, 0),
+ ctdb_tcp_node_connect, node);
}
/*
called when socket becomes writeable on connect
*/
-static void ctdb_node_connect_write(struct event_context *ev, struct fd_event *fde,
+static void ctdb_node_connect_write(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *private_data)
{
struct ctdb_node *node = talloc_get_type(private_data,
@@ -87,7 +88,7 @@ static void ctdb_node_connect_write(struct event_context *ev, struct fd_event *f
if (getsockopt(tnode->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0 ||
error != 0) {
ctdb_tcp_stop_connection(node);
- tnode->connect_te = event_add_timed(ctdb->ev, tnode,
+ tnode->connect_te = tevent_add_timer(ctdb->ev, tnode,
timeval_current_ofs(1, 0),
ctdb_tcp_node_connect, node);
return;
@@ -115,7 +116,7 @@ static void ctdb_node_connect_write(struct event_context *ev, struct fd_event *f
/*
called when we should try and establish a tcp connection to a node
*/
-void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
+void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct ctdb_node *node = talloc_get_type(private_data,
@@ -183,22 +184,23 @@ void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
if (connect(tnode->fd, (struct sockaddr *)&sock_out, sockout_size) != 0 &&
errno != EINPROGRESS) {
ctdb_tcp_stop_connection(node);
- tnode->connect_te = event_add_timed(ctdb->ev, tnode,
- timeval_current_ofs(1, 0),
- ctdb_tcp_node_connect, node);
+ tnode->connect_te = tevent_add_timer(ctdb->ev, tnode,
+ timeval_current_ofs(1, 0),
+ ctdb_tcp_node_connect, node);
return;
}
/* non-blocking connect - wait for write event */
- tnode->connect_fde = event_add_fd(node->ctdb->ev, tnode, tnode->fd,
- EVENT_FD_WRITE|EVENT_FD_READ,
- ctdb_node_connect_write, node);
+ tnode->connect_fde = tevent_add_fd(node->ctdb->ev, tnode, tnode->fd,
+ TEVENT_FD_WRITE|TEVENT_FD_READ,
+ ctdb_node_connect_write, node);
/* don't give it long to connect - retry in one second. This ensures
that we find a node is up quickly (tcp normally backs off a syn reply
delay by quite a lot) */
- tnode->connect_te = event_add_timed(ctdb->ev, tnode, timeval_current_ofs(1, 0),
- ctdb_tcp_node_connect, node);
+ tnode->connect_te = tevent_add_timer(ctdb->ev, tnode,
+ timeval_current_ofs(1, 0),
+ ctdb_tcp_node_connect, node);
}
/*
@@ -206,7 +208,7 @@ void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
currently makes no attempt to check if the connection is really from a ctdb
node in our cluster
*/
-static void ctdb_listen_event(struct event_context *ev, struct fd_event *fde,
+static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
uint16_t flags, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
@@ -371,8 +373,8 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
goto failed;
}
- fde = event_add_fd(ctdb->ev, ctcp, ctcp->listen_fd, EVENT_FD_READ,
- ctdb_listen_event, ctdb);
+ fde = tevent_add_fd(ctdb->ev, ctcp, ctcp->listen_fd, TEVENT_FD_READ,
+ ctdb_listen_event, ctdb);
tevent_fd_set_auto_close(fde);
close(lock_fd);
@@ -444,8 +446,8 @@ int ctdb_tcp_listen(struct ctdb_context *ctdb)
goto failed;
}
- fde = event_add_fd(ctdb->ev, ctcp, ctcp->listen_fd, EVENT_FD_READ,
- ctdb_listen_event, ctdb);
+ fde = tevent_add_fd(ctdb->ev, ctcp, ctcp->listen_fd, TEVENT_FD_READ,
+ ctdb_listen_event, ctdb);
tevent_fd_set_auto_close(fde);
return 0;
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c
index dba3be33947..9619975887b 100644
--- a/ctdb/tcp/tcp_init.c
+++ b/ctdb/tcp/tcp_init.c
@@ -93,9 +93,10 @@ static int ctdb_tcp_connect_node(struct ctdb_node *node)
/* startup connection to the other server - will happen on
next event loop */
if (!ctdb_same_address(ctdb->address, &node->address)) {
- tnode->connect_te = event_add_timed(ctdb->ev, tnode,
- timeval_zero(),
- ctdb_tcp_node_connect, node);
+ tnode->connect_te = tevent_add_timer(ctdb->ev, tnode,
+ timeval_zero(),
+ ctdb_tcp_node_connect,
+ node);
}
return 0;
@@ -114,8 +115,9 @@ static void ctdb_tcp_restart(struct ctdb_node *node)
ctdb_tcp_stop_connection(node);
- tnode->connect_te = event_add_timed(node->ctdb->ev, tnode, timeval_zero(),
- ctdb_tcp_node_connect, node);
+ tnode->connect_te = tevent_add_timer(node->ctdb->ev, tnode,
+ timeval_zero(),
+ ctdb_tcp_node_connect, node);
}
diff --git a/ctdb/tests/src/ctdb_bench.c b/ctdb/tests/src/ctdb_bench.c
index 09cb8abb61d..bc0a7cc2880 100644
--- a/ctdb/tests/src/ctdb_bench.c
+++ b/ctdb/tests/src/ctdb_bench.c
@@ -121,7 +121,7 @@ static void send_start_messages(struct ctdb_context *ctdb, int incr)
ctdb_client_send_message(ctdb, dest, 0, data);
}
-static void each_second(struct event_context *ev, struct timed_event *te,
+static void each_second(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct bench_data *bdata = talloc_get_type_abort(
@@ -141,18 +141,18 @@ static void each_second(struct event_context *ev, struct timed_event *te,
// printf("no messages recevied, try again to kickstart the ring in reverse direction...\n");
send_start_messages(bdata->ctdb, -1);
}
- event_add_timed(bdata->ev, bdata, timeval_current_ofs(1, 0),
- each_second, bdata);
+ tevent_add_timer(bdata->ev, bdata, timeval_current_ofs(1, 0),
+ each_second, bdata);
}
-static void dummy_event(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void dummy_event(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct bench_data *bdata = talloc_get_type_abort(
private_data, struct bench_data);
- event_add_timed(bdata->ev, bdata, timeval_current_ofs(1, 0),
- dummy_event, bdata);
+ tevent_add_timer(bdata->ev, bdata, timeval_current_ofs(1, 0),
+ dummy_event, bdata);
}
/*
@@ -163,11 +163,11 @@ static void bench_ring(struct bench_data *bdata)
int pnn = ctdb_get_pnn(bdata->ctdb);
if (pnn == 0) {
- event_add_timed(bdata->ev, bdata, timeval_current_ofs(1, 0),
- each_second, bdata);
+ tevent_add_timer(bdata->ev, bdata, timeval_current_ofs(1, 0),
+ each_second, bdata);
} else {
- event_add_timed(bdata->ev, bdata, timeval_current_ofs(1, 0),
- dummy_event, bdata);
+ tevent_add_timer(bdata->ev, bdata, timeval_current_ofs(1, 0),
+ dummy_event, bdata);
}
start_timer();
@@ -178,7 +178,7 @@ static void bench_ring(struct bench_data *bdata)
bdata->msg_plus, bdata->msg_minus);
fflush(stdout);
}
- event_loop_once(bdata->ev);
+ tevent_loop_once(bdata->ev);
}
printf("Ring: %.2f msgs/sec (+ve=%d -ve=%d)\n",
@@ -207,7 +207,7 @@ int main(int argc, const char *argv[])
int extra_argc = 0;
int ret;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
struct bench_data *bdata;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -233,7 +233,7 @@ int main(int argc, const char *argv[])
exit(1);
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
/* initialise ctdb */
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
@@ -274,7 +274,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
bench_ring(bdata);
diff --git a/ctdb/tests/src/ctdb_fetch.c b/ctdb/tests/src/ctdb_fetch.c
index 2b11bad2a2f..5567af3e764 100644
--- a/ctdb/tests/src/ctdb_fetch.c
+++ b/ctdb/tests/src/ctdb_fetch.c
@@ -129,7 +129,8 @@ static void message_handler(uint64_t srvid, TDB_DATA data, void *private_data)
/*
* timeout handler - noop
*/
-static void timeout_handler(struct event_context *ev, struct timed_event *timer,
+static void timeout_handler(struct tevent_context *ev,
+ struct tevent_timer *timer,
struct timeval curtime, void *private_data)
{
return;
@@ -153,15 +154,15 @@ static void bench_fetch(struct bench_data *bdata)
}
start_timer();
- event_add_timed(bdata->ev, bdata, timeval_current_ofs(timelimit,0),
- timeout_handler, NULL);
+ tevent_add_timer(bdata->ev, bdata, timeval_current_ofs(timelimit,0),
+ timeout_handler, NULL);
while (end_timer() < timelimit) {
if (pnn == 0 && bdata->msg_count % 100 == 0 && end_timer() > 0) {
printf("Fetch: %.2f msgs/sec\r", bdata->msg_count/end_timer());
fflush(stdout);
}
- if (event_loop_once(bdata->ev) != 0) {
+ if (tevent_loop_once(bdata->ev) != 0) {
printf("Event loop failed!\n");
break;
}
@@ -200,7 +201,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
TDB_DATA key, data;
struct ctdb_record_handle *h;
int cluster_ready=0;
@@ -231,7 +232,7 @@ int main(int argc, const char *argv[])
exit(1);
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
tevent_loop_allow_nesting(ev);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
@@ -268,7 +269,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
/* This test has a race condition. If CTDB receives the message from previous
diff --git a/ctdb/tests/src/ctdb_fetch_one.c b/ctdb/tests/src/ctdb_fetch_one.c
index ba0e183fe57..b704a6bc27c 100644
--- a/ctdb/tests/src/ctdb_fetch_one.c
+++ b/ctdb/tests/src/ctdb_fetch_one.c
@@ -49,7 +49,8 @@ static void alarm_handler(int sig)
/*
Just try locking/unlocking the same record over and over
*/
-static void bench_fetch_one_loop(struct ctdb_context *ctdb, struct event_context *ev)
+static void bench_fetch_one_loop(struct ctdb_context *ctdb,
+ struct tevent_context *ev)
{
TDB_DATA key, data;
@@ -91,7 +92,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -111,7 +112,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
@@ -133,7 +134,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
signal(SIGALRM, alarm_handler);
diff --git a/ctdb/tests/src/ctdb_fetch_readonly_loop.c b/ctdb/tests/src/ctdb_fetch_readonly_loop.c
index bd171f5a3c0..fdd5007fd86 100644
--- a/ctdb/tests/src/ctdb_fetch_readonly_loop.c
+++ b/ctdb/tests/src/ctdb_fetch_readonly_loop.c
@@ -33,7 +33,8 @@ static int count;
/*
Just try locking/unlocking a single record once
*/
-static void fetch_lock_once(struct ctdb_context *ctdb, struct event_context *ev)
+static void fetch_lock_once(struct ctdb_context *ctdb,
+ struct tevent_context *ev)
{
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
TDB_DATA key, data;
@@ -84,7 +85,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -104,7 +105,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(5, 0));
if (ctdb == NULL) {
@@ -134,7 +135,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
while (1) {
diff --git a/ctdb/tests/src/ctdb_fetch_readonly_once.c b/ctdb/tests/src/ctdb_fetch_readonly_once.c
index 5dc64e0e063..3b364f34096 100644
--- a/ctdb/tests/src/ctdb_fetch_readonly_once.c
+++ b/ctdb/tests/src/ctdb_fetch_readonly_once.c
@@ -52,7 +52,7 @@ int main(int argc, const char *argv[])
{
struct ctdb_context *ctdb;
struct ctdb_db_context *ctdb_db;
- struct event_context *ev;
+ struct tevent_context *ev;
TDB_DATA key;
@@ -84,7 +84,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
if (ctdb == NULL) {
@@ -108,7 +108,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
fetch_readonly_once(ctdb, ctdb_db, key);
diff --git a/ctdb/tests/src/ctdb_persistent.c b/ctdb/tests/src/ctdb_persistent.c
index 0bf92b345e8..99bd54c1a52 100644
--- a/ctdb/tests/src/ctdb_persistent.c
+++ b/ctdb/tests/src/ctdb_persistent.c
@@ -48,8 +48,8 @@ static TDB_DATA old_data;
static int success = true;
-static void each_second(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void each_second(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
int i;
@@ -63,7 +63,7 @@ static void each_second(struct event_context *ev, struct timed_event *te,
}
printf("\n");
- event_add_timed(ev, ctdb, timeval_current_ofs(1, 0), each_second, ctdb);
+ tevent_add_timer(ev, ctdb, timeval_current_ofs(1, 0), each_second, ctdb);
}
static void check_counters(struct ctdb_context *ctdb, TDB_DATA data)
@@ -101,7 +101,8 @@ static void check_counters(struct ctdb_context *ctdb, TDB_DATA data)
-static void test_store_records(struct ctdb_context *ctdb, struct event_context *ev)
+static void test_store_records(struct ctdb_context *ctdb,
+ struct tevent_context *ev)
{
TDB_DATA key;
struct ctdb_db_context *ctdb_db;
@@ -195,7 +196,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
setlinebuf(stdout);
@@ -217,7 +218,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
if (ctdb == NULL) {
@@ -244,14 +245,15 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
pnn = ctdb_get_pnn(ctdb);
printf("Starting test on node %u. running for %u seconds\n", pnn, timelimit);
if (pnn == 0) {
- event_add_timed(ev, ctdb, timeval_current_ofs(1, 0), each_second, ctdb);
+ tevent_add_timer(ev, ctdb, timeval_current_ofs(1, 0),
+ each_second, ctdb);
}
test_store_records(ctdb, ev);
diff --git a/ctdb/tests/src/ctdb_randrec.c b/ctdb/tests/src/ctdb_randrec.c
index 60d233bed81..0813295e084 100644
--- a/ctdb/tests/src/ctdb_randrec.c
+++ b/ctdb/tests/src/ctdb_randrec.c
@@ -45,7 +45,7 @@ static int num_records = 10;
static int delete_pct = 75;
static int base_rec;
-static void store_records(struct ctdb_context *ctdb, struct event_context *ev)
+static void store_records(struct ctdb_context *ctdb, struct tevent_context *ev)
{
TDB_DATA key, data;
struct ctdb_db_context *ctdb_db;
@@ -158,7 +158,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -178,7 +178,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
diff --git a/ctdb/tests/src/ctdb_store.c b/ctdb/tests/src/ctdb_store.c
index 69203434d6e..b0a7abb75e6 100644
--- a/ctdb/tests/src/ctdb_store.c
+++ b/ctdb/tests/src/ctdb_store.c
@@ -29,7 +29,7 @@
static int num_records = 10;
static int base_rec;
-static void store_records(struct ctdb_context *ctdb, struct event_context *ev)
+static void store_records(struct ctdb_context *ctdb, struct tevent_context *ev)
{
TDB_DATA key, data;
struct ctdb_db_context *ctdb_db;
@@ -37,7 +37,7 @@ static void store_records(struct ctdb_context *ctdb, struct event_context *ev)
int ret;
struct ctdb_record_handle *h;
uint32_t i;
-
+
ctdb_db = ctdb_db_handle(ctdb, "test.tdb");
printf("creating %d records\n", num_records);
@@ -111,7 +111,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -133,7 +133,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
@@ -154,7 +154,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
store_records(ctdb, ev);
diff --git a/ctdb/tests/src/ctdb_trackingdb_test.c b/ctdb/tests/src/ctdb_trackingdb_test.c
index 18bc174382f..1d0cf8b5ca4 100644
--- a/ctdb/tests/src/ctdb_trackingdb_test.c
+++ b/ctdb/tests/src/ctdb_trackingdb_test.c
@@ -102,7 +102,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -122,7 +122,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(5, 0));
if (ctdb == NULL) {
diff --git a/ctdb/tests/src/ctdb_transaction.c b/ctdb/tests/src/ctdb_transaction.c
index 78a63f1f126..53d0e3d812e 100644
--- a/ctdb/tests/src/ctdb_transaction.c
+++ b/ctdb/tests/src/ctdb_transaction.c
@@ -64,14 +64,14 @@ static void print_counters(void)
printf("\n");
}
-static void each_second(struct event_context *ev, struct timed_event *te,
- struct timeval t, void *private_data)
+static void each_second(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
print_counters();
- event_add_timed(ev, ctdb, timeval_current_ofs(1, 0), each_second, ctdb);
+ tevent_add_timer(ev, ctdb, timeval_current_ofs(1, 0), each_second, ctdb);
}
static void check_counters(struct ctdb_context *ctdb, TDB_DATA data)
@@ -114,7 +114,8 @@ static void do_sleep(unsigned int sec)
if (verbose) printf("\n");
}
-static void test_store_records(struct ctdb_context *ctdb, struct event_context *ev)
+static void test_store_records(struct ctdb_context *ctdb,
+ struct tevent_context *ev)
{
TDB_DATA key;
struct ctdb_db_context *ctdb_db;
@@ -223,7 +224,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
if (verbose) {
setbuf(stdout, (char *)NULL); /* don't buffer */
@@ -249,7 +250,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
if (ctdb == NULL) {
@@ -276,14 +277,15 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
pnn = ctdb_get_pnn(ctdb);
printf("Starting test on node %u. running for %u seconds. sleep delay: %u seconds.\n", pnn, timelimit, delay);
if (!verbose && (pnn == 0)) {
- event_add_timed(ev, ctdb, timeval_current_ofs(1, 0), each_second, ctdb);
+ tevent_add_timer(ev, ctdb, timeval_current_ofs(1, 0),
+ each_second, ctdb);
}
test_store_records(ctdb, ev);
diff --git a/ctdb/tests/src/ctdb_traverse.c b/ctdb/tests/src/ctdb_traverse.c
index 8ca76a3dd9e..37556dfc093 100644
--- a/ctdb/tests/src/ctdb_traverse.c
+++ b/ctdb/tests/src/ctdb_traverse.c
@@ -36,7 +36,9 @@ static int traverse_callback(TDB_DATA key, TDB_DATA data, void *private_data)
return 0;
}
-static void traverse_loop(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, struct event_context *ev)
+static void traverse_loop(struct ctdb_context *ctdb,
+ struct ctdb_db_context *ctdb_db,
+ struct tevent_context *ev)
{
uint32_t count;
@@ -64,7 +66,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -86,7 +88,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
if (ctdb == NULL) {
@@ -105,7 +107,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
while (1) {
diff --git a/ctdb/tests/src/ctdb_update_record.c b/ctdb/tests/src/ctdb_update_record.c
index 78d983bccc3..f582c4c27e4 100644
--- a/ctdb/tests/src/ctdb_update_record.c
+++ b/ctdb/tests/src/ctdb_update_record.c
@@ -32,7 +32,8 @@ static struct ctdb_db_context *ctdb_db;
/*
Just try locking/unlocking a single record once
*/
-static void fetch_lock_once(struct ctdb_context *ctdb, struct event_context *ev, uint32_t generation)
+static void fetch_lock_once(struct ctdb_context *ctdb,
+ struct tevent_context *ev, uint32_t generation)
{
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
TDB_DATA key, data;
@@ -104,7 +105,7 @@ int main(int argc, const char *argv[])
const char **extra_argv;
int extra_argc = 0;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
struct ctdb_vnn_map *vnnmap=NULL;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -125,7 +126,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(5, 0));
if (ctdb == NULL) {
@@ -144,7 +145,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
diff --git a/ctdb/tests/src/ctdb_update_record_persistent.c b/ctdb/tests/src/ctdb_update_record_persistent.c
index d73636ea1c7..4781895bc71 100644
--- a/ctdb/tests/src/ctdb_update_record_persistent.c
+++ b/ctdb/tests/src/ctdb_update_record_persistent.c
@@ -26,7 +26,9 @@
#include "ctdb_private.h"
-static void update_once(struct ctdb_context *ctdb, struct event_context *ev, struct ctdb_db_context *ctdb_db, char *record, char *value)
+static void update_once(struct ctdb_context *ctdb, struct tevent_context *ev,
+ struct ctdb_db_context *ctdb_db, char *record,
+ char *value)
{
TDB_DATA key, data, olddata;
struct ctdb_ltdb_header header;
@@ -61,7 +63,7 @@ int main(int argc, const char *argv[])
char *record = NULL;
char *value = NULL;
struct ctdb_db_context *ctdb_db;
- struct event_context *ev;
+ struct tevent_context *ev;
struct poptOption popt_options[] = {
POPT_AUTOHELP
@@ -95,7 +97,7 @@ int main(int argc, const char *argv[])
while (extra_argv[extra_argc]) extra_argc++;
}
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(5, 0));
if (ctdb == NULL) {
@@ -129,7 +131,7 @@ int main(int argc, const char *argv[])
uint32_t recmode=1;
ctdb_ctrl_getrecmode(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
if (recmode == 0) break;
- event_loop_once(ev);
+ tevent_loop_once(ev);
}
update_once(ctdb, ev, ctdb_db, record, value);
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index b4aa05045bf..0447878dc36 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -2174,13 +2174,14 @@ control_get_all_public_ips(struct ctdb_context *ctdb, TALLOC_CTX *tmp_ctx, struc
}
-static void ctdb_every_second(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
+static void ctdb_every_second(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *p)
{
struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
- event_add_timed(ctdb->ev, ctdb,
- timeval_current_ofs(1, 0),
- ctdb_every_second, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb, timeval_current_ofs(1, 0),
+ ctdb_every_second, ctdb);
}
struct srvid_reply_handler_data {
@@ -2252,9 +2253,8 @@ static int srvid_broadcast(struct ctdb_context *ctdb,
ZERO_STRUCT(request);
/* Time ticks to enable timeouts to be processed */
- event_add_timed(ctdb->ev, ctdb,
- timeval_current_ofs(1, 0),
- ctdb_every_second, ctdb);
+ tevent_add_timer(ctdb->ev, ctdb, timeval_current_ofs(1, 0),
+ ctdb_every_second, ctdb);
pnn = ctdb_get_pnn(ctdb);
reply_srvid = getpid();
@@ -2324,7 +2324,7 @@ again:
tv = timeval_current();
/* This loop terminates the reply is received */
while (timeval_elapsed(&tv) < 5.0 && !reply_data.done) {
- event_loop_once(ctdb->ev);
+ tevent_loop_once(ctdb->ev);
}
if (!reply_data.done) {
@@ -6073,8 +6073,8 @@ static int control_rddumpmemory(struct ctdb_context *ctdb, int argc, const char
}
/* this loop will terminate when we have received the reply */
- while (1) {
- event_loop_once(ctdb->ev);
+ while (1) {
+ tevent_loop_once(ctdb->ev);
}
return 0;
@@ -6136,8 +6136,8 @@ static int control_msglisten(struct ctdb_context *ctdb, int argc, const char **a
ctdb_client_set_message_handler(ctdb, srvid, msglisten_handler, NULL);
printf("Listening for messages on srvid:%d\n", (int)srvid);
- while (1) {
- event_loop_once(ctdb->ev);
+ while (1) {
+ tevent_loop_once(ctdb->ev);
}
return 0;
@@ -6631,7 +6631,7 @@ int main(int argc, const char *argv[])
int extra_argc = 0;
int ret=-1, i;
poptContext pc;
- struct event_context *ev;
+ struct tevent_context *ev;
const char *control;
setlinebuf(stdout);
@@ -6699,7 +6699,7 @@ int main(int argc, const char *argv[])
/* Default value for CTDB_BASE - don't override */
setenv("CTDB_BASE", CTDB_ETCDIR, 0);
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
if (!ev) {
DEBUG(DEBUG_ERR, ("Failed to initialize event system\n"));
exit(1);
diff --git a/ctdb/utils/pmda/pmda_ctdb.c b/ctdb/utils/pmda/pmda_ctdb.c
index f1a90c48b86..ca897b16c21 100644
--- a/ctdb/utils/pmda/pmda_ctdb.c
+++ b/ctdb/utils/pmda/pmda_ctdb.c
@@ -159,7 +159,7 @@ static pmdaMetric metrictab[] = {
PMDA_PMUNITS(0,0,0,0,0,0) }, },
};
-static struct event_context *ev;
+static struct tevent_context *ev;
static struct ctdb_context *ctdb;
static struct ctdb_statistics *stats;
@@ -183,7 +183,7 @@ pmda_ctdb_daemon_connect(void)
int ret;
struct sockaddr_un addr;
- ev = event_context_init(NULL);
+ ev = tevent_context_init(NULL);
if (ev == NULL) {
fprintf(stderr, "Failed to init event ctx\n");
return -1;