From d965ff05c9923c8a0e440e905d0d9fe662cc5db0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 21 Jan 2009 09:16:45 +0100 Subject: s4:ldb: remove dependency to samba4's events wrapper metze --- source4/lib/ldb/common/ldb.c | 13 ++++++++++--- source4/lib/ldb/config.mk | 20 ++++++++++---------- source4/lib/ldb/include/ldb_includes.h | 4 ++-- source4/lib/ldb/ldb_ildap/ldb_ildap.c | 12 ++++++------ source4/lib/ldb/ldb_tdb/ldb_tdb.c | 4 ++-- source4/lib/ldb/pyldb.c | 2 +- source4/lib/ldb/python.mk | 10 +++++----- 7 files changed, 36 insertions(+), 29 deletions(-) diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 4443362448..fe55d1499a 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -48,7 +48,7 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx) /* FIXME: Hack a new event context so that CMD line utilities work * until we have them all converted */ if (ev_ctx == NULL) { - ev_ctx = event_context_init(talloc_autofree_context()); + ev_ctx = tevent_context_init(talloc_autofree_context()); } ret = ldb_setup_wellknown_attributes(ldb); @@ -394,6 +394,7 @@ static int ldb_autotransaction_request(struct ldb_context *ldb, int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type) { struct tevent_context *ev; + int ret; if (!handle) { return LDB_ERR_UNAVAILABLE; @@ -410,7 +411,10 @@ int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type) switch (type) { case LDB_WAIT_NONE: - event_loop_once(ev); + ret = tevent_loop_once(ev); + if (ret != 0) { + return LDB_ERR_OPERATIONS_ERROR; + } if (handle->state == LDB_ASYNC_DONE || handle->status != LDB_SUCCESS) { return handle->status; @@ -419,7 +423,10 @@ int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type) case LDB_WAIT_ALL: while (handle->state != LDB_ASYNC_DONE) { - event_loop_once(ev); + ret = tevent_loop_once(ev); + if (ret != 0) { + return LDB_ERR_OPERATIONS_ERROR; + } if (handle->status != LDB_SUCCESS) { return handle->status; } diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index fe3b71d1d5..6fcf3943d0 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -1,7 +1,7 @@ ################################################ # Start MODULE ldb_asq [MODULE::ldb_asq] -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT CFLAGS = -I$(ldbsrcdir)/include INIT_FUNCTION = LDB_MODULE(asq) SUBSYSTEM = LIBLDB @@ -13,7 +13,7 @@ ldb_asq_OBJ_FILES = $(ldbsrcdir)/modules/asq.o ################################################ # Start MODULE ldb_server_sort [MODULE::ldb_server_sort] -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT CFLAGS = -I$(ldbsrcdir)/include INIT_FUNCTION = LDB_MODULE(server_sort) SUBSYSTEM = LIBLDB @@ -27,7 +27,7 @@ ldb_server_sort_OBJ_FILES = $(ldbsrcdir)/modules/sort.o [MODULE::ldb_paged_results] INIT_FUNCTION = LDB_MODULE(paged_results) CFLAGS = -I$(ldbsrcdir)/include -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT SUBSYSTEM = LIBLDB # End MODULE ldb_paged_results ################################################ @@ -39,7 +39,7 @@ ldb_paged_results_OBJ_FILES = $(ldbsrcdir)/modules/paged_results.o [MODULE::ldb_paged_searches] INIT_FUNCTION = LDB_MODULE(paged_searches) CFLAGS = -I$(ldbsrcdir)/include -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT SUBSYSTEM = LIBLDB # End MODULE ldb_paged_results ################################################ @@ -51,7 +51,7 @@ ldb_paged_searches_OBJ_FILES = $(ldbsrcdir)/modules/paged_searches.o [MODULE::ldb_operational] SUBSYSTEM = LIBLDB CFLAGS = -I$(ldbsrcdir)/include -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT INIT_FUNCTION = LDB_MODULE(operational) # End MODULE ldb_operational ################################################ @@ -63,7 +63,7 @@ ldb_operational_OBJ_FILES = $(ldbsrcdir)/modules/operational.o [MODULE::ldb_rdn_name] SUBSYSTEM = LIBLDB CFLAGS = -I$(ldbsrcdir)/include -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT INIT_FUNCTION = LDB_MODULE(rdn_name) # End MODULE ldb_rdn_name ################################################ @@ -79,7 +79,7 @@ $(ldb_map_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/ldb_map [MODULE::ldb_skel] SUBSYSTEM = LIBLDB CFLAGS = -I$(ldbsrcdir)/include -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT INIT_FUNCTION = LDB_MODULE(skel) # End MODULE ldb_skel ################################################ @@ -91,7 +91,7 @@ ldb_skel_OBJ_FILES = $(ldbsrcdir)/modules/skel.o [MODULE::ldb_sqlite3] SUBSYSTEM = LIBLDB CFLAGS = -I$(ldbsrcdir)/include -PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBEVENTS +PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTEVENT INIT_FUNCTION = LDB_BACKEND(sqlite3) # End MODULE ldb_sqlite3 ################################################ @@ -104,7 +104,7 @@ ldb_sqlite3_OBJ_FILES = $(ldbsrcdir)/ldb_sqlite3/ldb_sqlite3.o SUBSYSTEM = LIBLDB CFLAGS = -I$(ldbsrcdir)/include -I$(ldbsrcdir)/ldb_tdb PRIVATE_DEPENDENCIES = \ - LIBTDB LIBTALLOC LIBEVENTS + LIBTDB LIBTALLOC LIBTEVENT INIT_FUNCTION = LDB_BACKEND(tdb) # End MODULE ldb_tdb ################################################ @@ -117,7 +117,7 @@ ldb_tdb_OBJ_FILES = $(addprefix $(ldbsrcdir)/ldb_tdb/, ldb_tdb.o ldb_search.o ld [LIBRARY::LIBLDB] CFLAGS = -I$(ldbsrcdir)/include PUBLIC_DEPENDENCIES = \ - LIBTALLOC LIBEVENTS + LIBTALLOC LIBTEVENT PRIVATE_DEPENDENCIES = \ SOCKET_WRAPPER diff --git a/source4/lib/ldb/include/ldb_includes.h b/source4/lib/ldb/include/ldb_includes.h index 29c7b2dc5a..8356404409 100644 --- a/source4/lib/ldb/include/ldb_includes.h +++ b/source4/lib/ldb/include/ldb_includes.h @@ -19,8 +19,8 @@ #include "replace.h" #include "system/filesys.h" #include "system/time.h" -#include "talloc.h" -#include "events.h" +#include +#include #include "ldb.h" #include "ldb_errors.h" #include "ldb_private.h" diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index 9e31bc62bb..791cc75dc1 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -389,9 +389,9 @@ static int ildb_request_send(struct ildb_context *ac, struct ldap_message *msg) talloc_free(req->time_event); req->time_event = NULL; if (ac->req->timeout) { - req->time_event = event_add_timed(ac->ildb->event_ctx, ac, - timeval_current_ofs(ac->req->timeout, 0), - ildb_request_timeout, ac); + req->time_event = tevent_add_timer(ac->ildb->event_ctx, ac, + timeval_current_ofs(ac->req->timeout, 0), + ildb_request_timeout, ac); } req->async.fn = ildb_callback; @@ -683,9 +683,9 @@ static int ildb_handle_request(struct ldb_module *module, struct ldb_request *re if (ildb_dn_is_special(req)) { - te = event_add_timed(ac->ildb->event_ctx, - ac, timeval_zero(), - ildb_auto_done_callback, ac); + te = tevent_add_timer(ac->ildb->event_ctx, + ac, timeval_zero(), + ildb_auto_done_callback, ac); if (NULL == te) { return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 76469e356b..9528f5a662 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -1122,13 +1122,13 @@ static int ltdb_handle_request(struct ldb_module *module, tv.tv_sec = 0; tv.tv_usec = 0; - te = event_add_timed(ev, ac, tv, ltdb_callback, ac); + te = tevent_add_timer(ev, ac, tv, ltdb_callback, ac); if (NULL == te) { return LDB_ERR_OPERATIONS_ERROR; } tv.tv_sec = req->starttime + req->timeout; - ac->timeout_event = event_add_timed(ev, ac, tv, ltdb_timeout, ac); + ac->timeout_event = tevent_add_timer(ev, ac, tv, ltdb_timeout, ac); if (NULL == ac->timeout_event) { return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 89ef7aeddf..9e98363c6f 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -525,7 +525,7 @@ static PyObject *py_ldb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs { PyLdbObject *ret; struct ldb_context *ldb; - ldb = ldb_init(NULL, event_context_init(NULL)); + ldb = ldb_init(NULL, NULL); if (ldb == NULL) { PyErr_NoMemory(); return NULL; diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index a672c079a2..6e73b7e33d 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -1,8 +1,8 @@ -[PYTHON::swig_ldb] +[PYTHON::pyldb] LIBRARY_REALNAME = ldb.$(SHLIBEXT) -PUBLIC_DEPENDENCIES = LIBLDB LIBEVENTS PYTALLOC +PUBLIC_DEPENDENCIES = LIBLDB PYTALLOC -swig_ldb_OBJ_FILES = $(ldbsrcdir)/pyldb.o -$(swig_ldb_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include +pyldb_OBJ_FILES = $(ldbsrcdir)/pyldb.o +$(pyldb_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include -$(swig_ldb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_CAST_QUAL) +$(pyldb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_CAST_QUAL) -- cgit