From be8e91d9cadf0886bf5ce4816dff4073d903965d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2010 14:59:28 +1100 Subject: s4-ldb: convert the rest of the ldb modules to the new style --- source4/lib/ldb/ldb_tdb/ldb_tdb.c | 8 ++++---- source4/lib/ldb/modules/asq.c | 7 ++++++- source4/lib/ldb/modules/paged_results.c | 7 ++++++- source4/lib/ldb/modules/paged_searches.c | 7 ++++++- source4/lib/ldb/modules/rdn_name.c | 7 ++++++- source4/lib/ldb/modules/skel.c | 7 ++++++- source4/lib/ldb/modules/sort.c | 7 ++++++- source4/lib/ldb/tests/sample_module.c | 7 ++++++- source4/lib/ldb/wscript | 31 ++++++++++++++++++++----------- 9 files changed, 66 insertions(+), 22 deletions(-) (limited to 'source4') diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 25ec1b0bf2..90eb209ec5 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -1447,7 +1447,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url, return LDB_SUCCESS; } -_PRIVATE_ const struct ldb_backend_ops ldb_tdb_backend_ops = { - .name = "tdb", - .connect_fn = ltdb_connect, -}; +int ldb_tdb_init(const char *version) +{ + return ldb_register_backend("tdb", ltdb_connect); +} diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c index 6d1e88b67b..45a733bd13 100644 --- a/source4/lib/ldb/modules/asq.c +++ b/source4/lib/ldb/modules/asq.c @@ -400,8 +400,13 @@ static int asq_init(struct ldb_module *module) return ldb_next_init(module); } -const struct ldb_module_ops ldb_asq_module_ops = { +static const struct ldb_module_ops ldb_asq_module_ops = { .name = "asq", .search = asq_search, .init_context = asq_init }; + +int ldb_asq_init(const char *ldb_version) +{ + return ldb_register_module(&ldb_asq_module_ops); +} diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index 25b7532612..f61dd9698d 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -423,8 +423,13 @@ static int paged_request_init(struct ldb_module *module) return ldb_next_init(module); } -const struct ldb_module_ops ldb_paged_results_module_ops = { +static const struct ldb_module_ops ldb_paged_results_module_ops = { .name = "paged_results", .search = paged_search, .init_context = paged_request_init }; + +int ldb_paged_results_init(const char *version) +{ + return ldb_register_module(&ldb_paged_results_module_ops); +} diff --git a/source4/lib/ldb/modules/paged_searches.c b/source4/lib/ldb/modules/paged_searches.c index bd2ea0942e..becab83bcf 100644 --- a/source4/lib/ldb/modules/paged_searches.c +++ b/source4/lib/ldb/modules/paged_searches.c @@ -371,8 +371,13 @@ static int ps_init(struct ldb_module *module) return ldb_next_init(module); } -_PUBLIC_ const struct ldb_module_ops ldb_paged_searches_module_ops = { +static const struct ldb_module_ops ldb_paged_searches_module_ops = { .name = "paged_searches", .search = ps_search, .init_context = ps_init }; + +int ldb_paged_searches_init(const char *version) +{ + return ldb_register_module(&ldb_paged_searches_module_ops); +} diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index a0867c0f51..caff9f59e2 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -377,9 +377,14 @@ static int rdn_name_modify(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, req); } -const struct ldb_module_ops ldb_rdn_name_module_ops = { +static const struct ldb_module_ops ldb_rdn_name_module_ops = { .name = "rdn_name", .add = rdn_name_add, .modify = rdn_name_modify, .rename = rdn_name_rename }; + +int ldb_rdn_name_init(const char *version) +{ + return ldb_register_module(&ldb_rdn_name_module_ops); +} diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c index 248f9b346b..5dee735c60 100644 --- a/source4/lib/ldb/modules/skel.c +++ b/source4/lib/ldb/modules/skel.c @@ -123,7 +123,7 @@ static int skel_init(struct ldb_module *module) return ldb_next_init(module); } -const struct ldb_module_ops ldb_skel_module_ops = { +static const struct ldb_module_ops ldb_skel_module_ops = { .name = "skel", .init_context = skel_init, .search = skel_search, @@ -136,3 +136,8 @@ const struct ldb_module_ops ldb_skel_module_ops = { .end_transaction = skel_end_trans, .del_transaction = skel_del_trans, }; + +int ldb_skel_init(const char *version) +{ + return ldb_register_module(&ldb_skel_module_ops); +} diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c index f7c381f163..fd30c90505 100644 --- a/source4/lib/ldb/modules/sort.c +++ b/source4/lib/ldb/modules/sort.c @@ -344,8 +344,13 @@ static int server_sort_init(struct ldb_module *module) return ldb_next_init(module); } -const struct ldb_module_ops ldb_server_sort_module_ops = { +static const struct ldb_module_ops ldb_server_sort_module_ops = { .name = "server_sort", .search = server_sort_search, .init_context = server_sort_init }; + +int ldb_server_sort_init(const char *version) +{ + return ldb_register_module(&ldb_server_sort_module_ops); +} diff --git a/source4/lib/ldb/tests/sample_module.c b/source4/lib/ldb/tests/sample_module.c index 5269b8f017..d93c6de440 100644 --- a/source4/lib/ldb/tests/sample_module.c +++ b/source4/lib/ldb/tests/sample_module.c @@ -54,9 +54,14 @@ int sample_modify(struct ldb_module *mod, struct ldb_request *req) } -const struct ldb_module_ops ldb_sample_module_ops = { +static struct ldb_module_ops ldb_sample_module_ops = { .name = "sample", .add = sample_add, .del = sample_modify, .modify = sample_modify, }; + +int ldb_sample_init(const char *version) +{ + return ldb_register_module(&ldb_sample_module_ops); +} diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript index 600f3001ab..ebd653c9af 100644 --- a/source4/lib/ldb/wscript +++ b/source4/lib/ldb/wscript @@ -97,9 +97,9 @@ def build(bld): bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c', init_function='ldb_ldap_init', module_init_name='ldb_init_module', - deps='talloc lber ldap', + deps='talloc lber ldap ldb', enabled=bld.env.ENABLE_LDAP_BACKEND, - internal_module=False, + internal_module=True, subsystem='ldb') # we're not currently linking against the ldap libs, but ldb.pc.in @@ -158,50 +158,58 @@ def build(bld): bld.SAMBA_MODULE('ldb_paged_results', 'modules/paged_results.c', - init_function='LDB_MODULE(paged_results)', + init_function='ldb_paged_results_init', + module_init_name='ldb_init_module', deps='ldb', subsystem='ldb') bld.SAMBA_MODULE('ldb_asq', 'modules/asq.c', - init_function='LDB_MODULE(asq)', + init_function='ldb_asq_init', + module_init_name='ldb_init_module', deps='ldb', subsystem='ldb') bld.SAMBA_MODULE('ldb_server_sort', 'modules/sort.c', - init_function='LDB_MODULE(server_sort)', + init_function='ldb_server_sort_init', + module_init_name='ldb_init_module', deps='ldb', subsystem='ldb') bld.SAMBA_MODULE('ldb_paged_searches', 'modules/paged_searches.c', - init_function='LDB_MODULE(paged_searches)', + init_function='ldb_paged_searches_init', + module_init_name='ldb_init_module', enabled = s4_build, deps='ldb', subsystem='ldb') bld.SAMBA_MODULE('ldb_rdn_name', 'modules/rdn_name.c', - init_function='LDB_MODULE(rdn_name)', + init_function='ldb_rdn_name_init', + module_init_name='ldb_init_module', deps='ldb', subsystem='ldb') bld.SAMBA_MODULE('ldb_sample', 'tests/sample_module.c', - init_function='LDB_MODULE(sample)', + init_function='ldb_sample_init', + module_init_name='ldb_init_module', deps='ldb', subsystem='ldb') bld.SAMBA_MODULE('ldb_skel', 'modules/skel.c', - init_function='LDB_MODULE(skel)', + init_function='ldb_skel_init', + module_init_name='ldb_init_module', deps='ldb', subsystem='ldb') bld.SAMBA_MODULE('ldb_sqlite3', 'sqlite3/ldb_sqlite3.c', - init_function='LDB_BACKEND(sqlite3)', + init_function='ldb_sqlite3_init', + module_init_name='ldb_init_module', enabled=False, deps='ldb', subsystem='ldb') @@ -210,7 +218,8 @@ def build(bld): bld.SUBDIR('ldb_tdb', '''ldb_tdb.c ldb_pack.c ldb_search.c ldb_index.c ldb_cache.c ldb_tdb_wrap.c'''), - init_function='LDB_BACKEND(tdb)', + init_function='ldb_tdb_init', + module_init_name='ldb_init_module', deps='tdb ldb', subsystem='ldb') -- cgit