diff --git a/ctdb/ctdb.h b/ctdb/ctdb.h index 7d2b8235d9f..71f6ea74a74 100644 --- a/ctdb/ctdb.h +++ b/ctdb/ctdb.h @@ -33,11 +33,12 @@ struct ctdb_call { #define CTDB_ERR_INVALID 1 #define CTDB_ERR_NOMEM 2 +struct event_context; /* initialise ctdb subsystem */ -struct ctdb_context *ctdb_init(TALLOC_CTX *mem_ctx); +struct ctdb_context *ctdb_init(struct event_context *ev); /* tell ctdb what address to listen on, in transport specific format diff --git a/ctdb/ctdb_tcp.c b/ctdb/ctdb_tcp.c index 5f5659f2e13..719e4babbb9 100644 --- a/ctdb/ctdb_tcp.c +++ b/ctdb/ctdb_tcp.c @@ -35,11 +35,13 @@ and to simplify the code. */ -struct ctdb_context *ctdb_init(TALLOC_CTX *mem_ctx) +struct ctdb_context *ctdb_init(struct event_context *ev) { struct ctdb_context *ctdb; - ctdb = talloc_zero(mem_ctx, struct ctdb_context); + ctdb = talloc_zero(ev, struct ctdb_context); + ctdb->ev = ev; + return ctdb; } diff --git a/ctdb/ctdb_test.c b/ctdb/ctdb_test.c index df16d1f432c..ce3b7b1ca9e 100644 --- a/ctdb/ctdb_test.c +++ b/ctdb/ctdb_test.c @@ -18,11 +18,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "replace.h" +#include "includes.h" +#include "lib/events/events.h" #include "system/filesys.h" -#include "tdb.h" -#include "talloc.h" -#include "ctdb.h" #include "popt.h" enum my_functions {FUNC_SORT=1, FUNC_FETCH=2}; @@ -88,6 +86,7 @@ int main(int argc, const char *argv[]) int i, ret; TDB_DATA key, data; poptContext pc; + struct event_context *ev; pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST); @@ -112,8 +111,10 @@ int main(int argc, const char *argv[]) exit(1); } + ev = event_context_init(NULL); + /* initialise ctdb */ - ctdb = ctdb_init(NULL); + ctdb = ctdb_init(ev); if (ctdb == NULL) { printf("Failed to init ctdb\n"); exit(1);