diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-20 01:54:32 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-20 01:54:32 +0100 |
commit | 16109a40c0abd8c30a5eb9bf9ef692bfae9dfc7d (patch) | |
tree | da2137e95caa013da750e23758ed68f49f5b1cc5 /source4/lib | |
parent | 71bc5acead0e16473273eb8741373e865b6d2c44 (diff) | |
download | samba-16109a40c0abd8c30a5eb9bf9ef692bfae9dfc7d.tar.gz samba-16109a40c0abd8c30a5eb9bf9ef692bfae9dfc7d.tar.bz2 samba-16109a40c0abd8c30a5eb9bf9ef692bfae9dfc7d.zip |
Use struct-based rather than function-based initialization for ldb modules everywhere.
(This used to be commit 85c96a325867f7bcdb412ebc53f8a47dbf7cd89b)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map.c | 38 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map.h | 17 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map_private.h | 7 | ||||
-rw-r--r-- | source4/lib/ldb/modules/asq.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/modules/operational.c | 7 | ||||
-rw-r--r-- | source4/lib/ldb/modules/paged_results.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/modules/paged_searches.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/modules/rdn_name.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/modules/skel.c | 7 | ||||
-rw-r--r-- | source4/lib/ldb/modules/sort.c | 7 |
10 files changed, 22 insertions, 93 deletions
diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index 9582f36130..9c189feb11 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -1186,7 +1186,7 @@ static int map_wait_all(struct ldb_handle *handle) } /* Wait for pending requests to finish. */ -static int map_wait(struct ldb_handle *handle, enum ldb_wait_type type) +int map_wait(struct ldb_handle *handle, enum ldb_wait_type type) { if (type == LDB_WAIT_ALL) { return map_wait_all(handle); @@ -1199,16 +1199,6 @@ static int map_wait(struct ldb_handle *handle, enum ldb_wait_type type) /* Module initialization * ===================== */ -/* Provided module operations */ -static const struct ldb_module_ops map_ops = { - .name = "ldb_map", - .add = map_add, - .modify = map_modify, - .del = map_delete, - .rename = map_rename, - .search = map_search, - .wait = map_wait, -}; /* Builtin mappings for DNs and objectClasses */ static const struct ldb_map_attribute builtin_attribute_maps[] = { @@ -1344,12 +1334,6 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data return LDB_SUCCESS; } -/* Copy the list of provided module operations. */ -_PUBLIC_ struct ldb_module_ops ldb_map_get_ops(void) -{ - return map_ops; -} - /* Initialize global private data. */ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs, const struct ldb_map_objectclass *ocls, @@ -1393,23 +1377,3 @@ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attrib return LDB_SUCCESS; } - -/* Usage note for initialization of this module: - * - * ldb_map is meant to be used from a different module that sets up - * the mappings and gets registered in ldb. - * - * 'ldb_map_init' initializes the private data of this module and - * stores the attribute and objectClass maps in there. It also looks - * up the '@MAP' special DN so requests can be redirected to the - * remote partition. - * - * This function should be called from the 'init_context' op of the - * module using ldb_map. - * - * 'ldb_map_get_ops' returns a copy of ldb_maps module operations. - * - * It should be called from the initialize function of the using - * module, which should then override the 'init_context' op with a - * function making the appropriate calls to 'ldb_map_init'. - */ diff --git a/source4/lib/ldb/ldb_map/ldb_map.h b/source4/lib/ldb/ldb_map/ldb_map.h index ef4da4e654..e40bb9cd7e 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.h +++ b/source4/lib/ldb/ldb_map/ldb_map.h @@ -155,8 +155,19 @@ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attr const char *add_objectclass, const char *name); -/* get copy of map_ops */ -struct ldb_module_ops -ldb_map_get_ops(void); +int map_add(struct ldb_module *module, struct ldb_request *req); +int map_search(struct ldb_module *module, struct ldb_request *req); +int map_rename(struct ldb_module *module, struct ldb_request *req); +int map_delete(struct ldb_module *module, struct ldb_request *req); +int map_modify(struct ldb_module *module, struct ldb_request *req); +int map_wait(struct ldb_handle *handle, enum ldb_wait_type type); + +#define LDB_MAP_OPS \ + .add = map_add, \ + .modify = map_modify, \ + .del = map_delete, \ + .rename = map_rename, \ + .search = map_search, \ + .wait = map_wait, #endif /* __LDB_MAP_H__ */ diff --git a/source4/lib/ldb/ldb_map/ldb_map_private.h b/source4/lib/ldb/ldb_map/ldb_map_private.h index 2c35097069..58a9f2704e 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_private.h +++ b/source4/lib/ldb/ldb_map/ldb_map_private.h @@ -98,20 +98,13 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, /* The following definitions come from lib/ldb/modules/ldb_map_inbound.c */ int map_add_do_remote(struct ldb_handle *handle); int map_add_do_local(struct ldb_handle *handle); -int map_add(struct ldb_module *module, struct ldb_request *req); int map_modify_do_remote(struct ldb_handle *handle); int map_modify_do_local(struct ldb_handle *handle); -int map_modify(struct ldb_module *module, struct ldb_request *req); int map_delete_do_remote(struct ldb_handle *handle); int map_delete_do_local(struct ldb_handle *handle); -int map_delete(struct ldb_module *module, struct ldb_request *req); int map_rename_do_remote(struct ldb_handle *handle); int map_rename_do_fixup(struct ldb_handle *handle); int map_rename_do_local(struct ldb_handle *handle); -int map_rename(struct ldb_module *module, struct ldb_request *req); - -/* The following definitions come from lib/ldb/modules/ldb_map_outbound.c */ -int map_search(struct ldb_module *module, struct ldb_request *req); diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c index b6a8594166..eb27263b16 100644 --- a/source4/lib/ldb/modules/asq.c +++ b/source4/lib/ldb/modules/asq.c @@ -473,15 +473,9 @@ static int asq_init(struct ldb_module *module) return ldb_next_init(module); } - -static const struct ldb_module_ops asq_ops = { +const struct ldb_module_ops ldb_asq_module_ops = { .name = "asq", .search = asq_search, .wait = asq_wait, .init_context = asq_init }; - -int ldb_asq_init(void) -{ - return ldb_register_module(&asq_ops); -} diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index 45f23aa0c1..7dc4ae08c3 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -304,13 +304,8 @@ static int operational_init(struct ldb_module *ctx) return ldb_next_init(ctx); } -static const struct ldb_module_ops operational_ops = { +const struct ldb_module_ops ldb_operational_module_ops = { .name = "operational", .search = operational_search, .init_context = operational_init }; - -int ldb_operational_init(void) -{ - return ldb_register_module(&operational_ops); -} diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index ee1bbe0335..b62b1f92cb 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -549,15 +549,9 @@ static int paged_request_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops paged_ops = { +const struct ldb_module_ops ldb_paged_results_module_ops = { .name = "paged_results", .search = paged_search, .wait = paged_wait, .init_context = paged_request_init }; - -int ldb_paged_results_init(void) -{ - return ldb_register_module(&paged_ops); -} - diff --git a/source4/lib/ldb/modules/paged_searches.c b/source4/lib/ldb/modules/paged_searches.c index fd580a3c4a..88ebd13921 100644 --- a/source4/lib/ldb/modules/paged_searches.c +++ b/source4/lib/ldb/modules/paged_searches.c @@ -455,15 +455,9 @@ static int ps_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops ps_ops = { +const struct ldb_module_ops ldb_pages_searches_module_ops = { .name = "paged_searches", .search = ps_search, .wait = ps_wait, .init_context = ps_init }; - -int ldb_paged_searches_init(void) -{ - return ldb_register_module(&ps_ops); -} - diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index 1a0ddbb3c4..c4de8e8da8 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -326,15 +326,9 @@ static int rdn_name_wait(struct ldb_handle *handle, enum ldb_wait_type type) return rdn_name_wait_once(handle); } -static const struct ldb_module_ops rdn_name_ops = { +const struct ldb_module_ops ldb_rdn_name_module_ops = { .name = "rdn_name", .add = rdn_name_add, .rename = rdn_name_rename, .wait = rdn_name_wait }; - - -int ldb_rdn_name_init(void) -{ - return ldb_register_module(&rdn_name_ops); -} diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c index 5400c502f1..0cd29ac4b7 100644 --- a/source4/lib/ldb/modules/skel.c +++ b/source4/lib/ldb/modules/skel.c @@ -116,7 +116,7 @@ static int skel_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops skel_ops = { +const struct ldb_module_ops ldb_skel_module_ops = { .name = "skel", .init_context = skel_init, .search = skel_search, @@ -129,8 +129,3 @@ static const struct ldb_module_ops skel_ops = { .end_transaction = skel_end_trans, .del_transaction = skel_del_trans, }; - -int ldb_skel_init(void) -{ - return ldb_register_module(&skel_ops); -} diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c index 89b9a4fb19..746befa559 100644 --- a/source4/lib/ldb/modules/sort.c +++ b/source4/lib/ldb/modules/sort.c @@ -450,14 +450,9 @@ static int server_sort_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops server_sort_ops = { +const struct ldb_module_ops ldb_server_sort_module_ops = { .name = "server_sort", .search = server_sort_search, .wait = server_sort_wait, .init_context = server_sort_init }; - -int ldb_sort_init(void) -{ - return ldb_register_module(&server_sort_ops); -} |