mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
r13823: make async_wait part of the modules ops
This commit is contained in:
parent
0db616ef59
commit
b4202cf030
@ -217,7 +217,7 @@ static int rootdse_init(struct ldb_module *module)
|
||||
|
||||
static const struct ldb_module_ops rootdse_ops = {
|
||||
.name = "rootdse",
|
||||
.init_context = rootdse_init,
|
||||
.init_context = rootdse_init,
|
||||
.request = rootdse_request
|
||||
};
|
||||
|
||||
|
@ -125,7 +125,7 @@ void ldb_reset_err_string(struct ldb_context *ldb)
|
||||
#define FIRST_OP(ldb, op) do { \
|
||||
module = ldb->modules; \
|
||||
while (module && module->ops->op == NULL) module = module->next; \
|
||||
if (module == NULL) return -1; \
|
||||
if (module == NULL) return LDB_ERR_OPERATIONS_ERROR; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
@ -208,10 +208,11 @@ 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)
|
||||
{
|
||||
if (ldb->async_wait != NULL)
|
||||
return ldb->async_wait(handle, type);
|
||||
struct ldb_module *module;
|
||||
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
FIRST_OP(ldb, async_wait);
|
||||
|
||||
return module->ops->async_wait(module, handle, type);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -278,7 +278,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
|
||||
#define FIND_OP(module, op) do { \
|
||||
module = module->next; \
|
||||
while (module && module->ops->op == NULL) module = module->next; \
|
||||
if (module == NULL) return LDB_ERR_OTHER; \
|
||||
if (module == NULL) return LDB_ERR_OPERATIONS_ERROR; \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -324,3 +324,9 @@ 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);
|
||||
}
|
||||
|
@ -61,6 +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);
|
||||
};
|
||||
|
||||
|
||||
@ -106,8 +107,6 @@ struct ldb_context {
|
||||
|
||||
int transaction_active;
|
||||
|
||||
int (*async_wait)(struct ldb_async_handle *, enum ldb_async_wait_type);
|
||||
|
||||
/* a backend supplied highestCommittedUSN function */
|
||||
uint64_t (*sequence_number)(struct ldb_context *);
|
||||
};
|
||||
|
@ -913,7 +913,7 @@ static int ildb_request(struct ldb_module *module, struct ldb_request *req)
|
||||
}
|
||||
}
|
||||
|
||||
static int ildb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
|
||||
static int ildb_async_wait(struct ldb_module *module, 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);
|
||||
|
||||
@ -977,6 +977,7 @@ static const struct ldb_module_ops ildb_ops = {
|
||||
.start_transaction = ildb_start_trans,
|
||||
.end_transaction = ildb_end_trans,
|
||||
.del_transaction = ildb_del_trans,
|
||||
.async_wait = ildb_async_wait,
|
||||
.init_context = ildb_init
|
||||
};
|
||||
|
||||
@ -1051,8 +1052,6 @@ int ildb_connect(struct ldb_context *ldb, const char *url,
|
||||
}
|
||||
}
|
||||
|
||||
ldb->async_wait = &ildb_async_wait;
|
||||
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
|
@ -860,7 +860,7 @@ error:
|
||||
return handle->status;
|
||||
}
|
||||
|
||||
static int lldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
|
||||
static int lldb_async_wait(struct ldb_module *module, 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);
|
||||
@ -1027,6 +1027,7 @@ static const struct ldb_module_ops lldb_ops = {
|
||||
.start_transaction = lldb_start_trans,
|
||||
.end_transaction = lldb_end_trans,
|
||||
.del_transaction = lldb_del_trans,
|
||||
.async_wait = lldb_async_wait
|
||||
};
|
||||
|
||||
|
||||
@ -1084,8 +1085,6 @@ int lldb_connect(struct ldb_context *ldb,
|
||||
ldb->modules->private_data = lldb;
|
||||
ldb->modules->ops = &lldb_ops;
|
||||
|
||||
ldb->async_wait = &lldb_async_wait;
|
||||
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
|
@ -475,7 +475,7 @@ static int ltdb_search_full(struct ldb_async_handle *handle)
|
||||
|
||||
static int ltdb_search_sync_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares)
|
||||
{
|
||||
struct ldb_result *res;
|
||||
struct ldb_result *res = NULL;
|
||||
|
||||
if (!context) {
|
||||
ldb_set_errstring(ldb, talloc_strdup(ldb, "NULL Context in callback"));
|
||||
|
@ -917,7 +917,7 @@ static int ltdb_del_trans(struct ldb_module *module)
|
||||
return LDB_SUCCESS;
|
||||
}
|
||||
|
||||
static int ltdb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
|
||||
static int ltdb_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type)
|
||||
{
|
||||
return handle->status;
|
||||
}
|
||||
@ -1038,7 +1038,8 @@ static const struct ldb_module_ops ltdb_ops = {
|
||||
.request = ltdb_request,
|
||||
.start_transaction = ltdb_start_trans,
|
||||
.end_transaction = ltdb_end_trans,
|
||||
.del_transaction = ltdb_del_trans
|
||||
.del_transaction = ltdb_del_trans,
|
||||
.async_wait = ltdb_async_wait
|
||||
};
|
||||
|
||||
|
||||
@ -1104,7 +1105,5 @@ int ltdb_connect(struct ldb_context *ldb, const char *url,
|
||||
ldb->modules->ops = <db_ops;
|
||||
ldb->sequence_number = ltdb_sequence_number;
|
||||
|
||||
ldb->async_wait = <db_async_wait;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user