From 7b82c4beb93375f79b6c06fc86bb31873baa187b Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 7 Mar 2006 21:08:09 +0000 Subject: r13992: change the way ldb_async_wait() works. I think I should change the name of this function to ldb_async_process(), any opinions ? (This used to be commit 3347322d1327cfa975ee9dccd4f2774e6e14fbcb) --- source4/lib/ldb/common/ldb.c | 6 +----- source4/lib/ldb/common/ldb_modules.c | 6 ------ source4/lib/ldb/include/ldb.h | 1 + source4/lib/ldb/include/ldb_private.h | 2 +- source4/lib/ldb/ldb_ildap/ldb_ildap.c | 4 +++- source4/lib/ldb/ldb_ldap/ldb_ldap.c | 6 ++++-- source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 4 +++- source4/lib/ldb/ldb_tdb/ldb_tdb.c | 4 +++- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 4b4cc30de8..b304cf6afc 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -233,11 +233,7 @@ int ldb_transaction_cancel(struct ldb_context *ldb) int ldb_async_wait(struct ldb_context *ldb, struct ldb_async_handle *handle, enum ldb_async_wait_type type) { - struct ldb_module *module; - - FIRST_OP(ldb, async_wait); - - return module->ops->async_wait(module, handle, type); + return handle->module->ops->async_wait(handle, type); } /* diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 2fde859aeb..0cb0041d84 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -342,9 +342,3 @@ int ldb_next_del_trans(struct ldb_module *module) FIND_OP(module, del_transaction); return module->ops->del_transaction(module); } - -int ldb_next_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type) -{ - FIND_OP(module, async_wait); - return module->ops->async_wait(module, handle, type); -} diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 13e69282ca..b3ea17d85d 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -605,6 +605,7 @@ struct ldb_async_handle { int status; enum ldb_async_state state; void *private_data; + struct ldb_module *module; }; struct ldb_search { diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 52ea0f833d..27b6883c3d 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -61,7 +61,7 @@ struct ldb_module_ops { int (*start_transaction)(struct ldb_module *); int (*end_transaction)(struct ldb_module *); int (*del_transaction)(struct ldb_module *); - int (*async_wait)(struct ldb_module *, struct ldb_async_handle *, enum ldb_async_wait_type); + int (*async_wait)(struct ldb_async_handle *, enum ldb_async_wait_type); }; typedef int (*ldb_connect_fn) (struct ldb_context *ldb, const char *url, unsigned int flags, const char *options[]); diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index ab37ab7570..45323b5550 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -341,6 +341,8 @@ static int ildb_request_send(struct ldb_module *module, struct ldap_message *msg return LDB_ERR_OPERATIONS_ERROR; } + h->module = module; + ildb_ac = talloc(h, struct ildb_async_context); if (ildb_ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); @@ -916,7 +918,7 @@ static int ildb_request(struct ldb_module *module, struct ldb_request *req) } } -static int ildb_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int ildb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) { struct ildb_async_context *ac = talloc_get_type(handle->private_data, struct ildb_async_context); diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 307370ee12..8406ab384b 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -76,6 +76,8 @@ static struct ldb_async_handle *init_handle(struct lldb_private *lldb, struct ld return NULL; } + h->module = module; + ac = talloc(h, struct lldb_async_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); @@ -875,10 +877,10 @@ error: return handle->status; } -static int lldb_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int lldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) { struct lldb_async_context *ac = talloc_get_type(handle->private_data, struct lldb_async_context); - struct lldb_private *lldb = talloc_get_type(ac->module->private_data, struct lldb_private); + struct lldb_private *lldb = talloc_get_type(handle->module->private_data, struct lldb_private); struct timeval timeout; LDAPMessage *result; int ret = LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index 883b21e0b5..a8dc8fe3a2 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -70,6 +70,8 @@ static struct ldb_async_handle *init_lsql_handle(struct lsqlite3_private *lsqlit return NULL; } + h->module = module; + ac = talloc(h, struct lsql_async_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); @@ -1969,7 +1971,7 @@ destructor(void *p) return 0; } -static int lsql_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int lsql_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) { return handle->status; } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 5470fccb97..c0e070de69 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -91,6 +91,8 @@ struct ldb_async_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_ return NULL; } + h->module = module; + ac = talloc_zero(h, struct ltdb_async_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); @@ -909,7 +911,7 @@ static int ltdb_del_trans(struct ldb_module *module) return LDB_SUCCESS; } -static int ltdb_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int ltdb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) { return handle->status; } -- cgit