r13992: change the way ldb_async_wait() works.
authorSimo Sorce <idra@samba.org>
Tue, 7 Mar 2006 21:08:09 +0000 (21:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:52:34 +0000 (13:52 -0500)
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
source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/include/ldb.h
source4/lib/ldb/include/ldb_private.h
source4/lib/ldb/ldb_ildap/ldb_ildap.c
source4/lib/ldb/ldb_ldap/ldb_ldap.c
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
source4/lib/ldb/ldb_tdb/ldb_tdb.c

index 4b4cc30de85fd4b6f0d616092670d80bd4a8b181..b304cf6afca12870c53a5790bf66fb7299ec12d7 100644 (file)
@@ -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);
 }
 
 /*
index 2fde859aeb06de9ea0528aa761bb074bfd939561..0cb0041d8489a74550ff8e1fb76a43195f84537a 100644 (file)
@@ -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);
-}
index 13e69282cada252fc6d5765c90f1000463bfc0d5..b3ea17d85d501443284cda3872653837e3c980e1 100644 (file)
@@ -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 {
index 52ea0f833d59fbbf92462ea23e820ec149bf2fec..27b6883c3d6ff11a5433f9c89821e0a050a79af4 100644 (file)
@@ -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[]);
index ab37ab757049b895ad80fc9d3056c21fb9cf4063..45323b5550468694d4cca29e98fd3c619cab2309 100644 (file)
@@ -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);
 
index 307370ee1203755066a614b3a7de98244f4a91c2..8406ab384beb9faafdd2f02ea8f91d678e260a15 100644 (file)
@@ -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;
index 883b21e0b50f6f373b1857cf1724b21274eaeffb..a8dc8fe3a2e00d05d07634fdc8285f972d7da83d 100644 (file)
@@ -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;
 }
index 5470fccb97c80d1239d91a2e33dde840107551e4..c0e070de694855c1ba9abb0b87965e32a8b1c1df 100644 (file)
@@ -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;
 }