Use struct-based rather than function-based initialization for ldb modules everywhere.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 20 Feb 2008 00:54:32 +0000 (01:54 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 20 Feb 2008 00:54:32 +0000 (01:54 +0100)
(This used to be commit 85c96a325867f7bcdb412ebc53f8a47dbf7cd89b)

38 files changed:
source4/dsdb/samdb/ldb_modules/anr.c
source4/dsdb/samdb/ldb_modules/dsdb_cache.c
source4/dsdb/samdb/ldb_modules/extended_dn.c
source4/dsdb/samdb/ldb_modules/instancetype.c
source4/dsdb/samdb/ldb_modules/kludge_acl.c
source4/dsdb/samdb/ldb_modules/linked_attributes.c
source4/dsdb/samdb/ldb_modules/local_password.c
source4/dsdb/samdb/ldb_modules/naming_fsmo.c
source4/dsdb/samdb/ldb_modules/normalise.c
source4/dsdb/samdb/ldb_modules/objectclass.c
source4/dsdb/samdb/ldb_modules/objectguid.c
source4/dsdb/samdb/ldb_modules/partition.c
source4/dsdb/samdb/ldb_modules/password_hash.c
source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
source4/dsdb/samdb/ldb_modules/proxy.c
source4/dsdb/samdb/ldb_modules/ranged_results.c
source4/dsdb/samdb/ldb_modules/repl_meta_data.c
source4/dsdb/samdb/ldb_modules/rootdse.c
source4/dsdb/samdb/ldb_modules/samba3sam.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/dsdb/samdb/ldb_modules/schema.c
source4/dsdb/samdb/ldb_modules/schema_fsmo.c
source4/dsdb/samdb/ldb_modules/show_deleted.c
source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
source4/dsdb/samdb/ldb_modules/subtree_delete.c
source4/dsdb/samdb/ldb_modules/subtree_rename.c
source4/dsdb/samdb/ldb_modules/update_keytab.c
source4/lib/ldb/ldb_map/ldb_map.c
source4/lib/ldb/ldb_map/ldb_map.h
source4/lib/ldb/ldb_map/ldb_map_private.h
source4/lib/ldb/modules/asq.c
source4/lib/ldb/modules/operational.c
source4/lib/ldb/modules/paged_results.c
source4/lib/ldb/modules/paged_searches.c
source4/lib/ldb/modules/rdn_name.c
source4/lib/ldb/modules/skel.c
source4/lib/ldb/modules/sort.c
source4/nbt_server/wins/wins_ldb.c

index 908d9b088c8b3540b321dce6792e5737ce16f9e9..dd730c9b01834064d3c926f4f21b0dd635912a5e 100644 (file)
@@ -295,13 +295,7 @@ static int anr_search(struct ldb_module *module, struct ldb_request *req)
        return ldb_next_request(module, req);
 }
 
-static const struct ldb_module_ops anr_ops = {
+const struct ldb_module_ops ldb_anr_module_ops = {
        .name              = "anr",
        .search = anr_search
 };
-
-int ldb_anr_init(void)
-{
-       return ldb_register_module(&anr_ops);
-}
-
index 4ca8bbf4637e22b4688aecf28b05e845eb5f6460..e73803ab38a1b40539c3c54dea0c9bfc31d60103 100644 (file)
@@ -36,12 +36,7 @@ static int dsdb_cache_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops dsdb_cache_ops = {
+const struct ldb_module_ops ldb_dsdb_cache_module_ops = {
        .name           = "dsdb_cache",
        .init_context   = dsdb_cache_init
 };
-
-int dsdb_cache_module_init(void)
-{
-       return ldb_register_module(&dsdb_cache_ops);
-}
index 802f86570bb34555e0ed7883852c056d851c2a93..85b99800e95cb9e1ee4ac026a095a0088359440f 100644 (file)
@@ -362,13 +362,8 @@ static int extended_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops extended_dn_ops = {
+const struct ldb_module_ops ldb_extended_dn_module_ops = {
        .name              = "extended_dn",
        .search            = extended_search,
        .init_context      = extended_init
 };
-
-int ldb_extended_dn_init(void)
-{
-       return ldb_register_module(&extended_dn_ops);
-}
index 65df294e90e00f88f2b56a8b5c38b52ac79c19f7..c0f88525038b57effba2e3e30d7992023f409d83 100644 (file)
@@ -118,13 +118,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
        return ret;
 }
 
-static const struct ldb_module_ops instancetype_ops = {
+const struct ldb_module_ops ldb_instancetype_module_ops = {
        .name          = "instancetype",
        .add           = instancetype_add,
 };
-
-
-int ldb_instancetype_init(void)
-{
-       return ldb_register_module(&instancetype_ops);
-}
index ea33548b919bcfad154c08296129531d004a8da3..6395ebe2ed7866912a6144c8e164b30c1f1a2ee7 100644 (file)
@@ -471,7 +471,7 @@ done:
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops kludge_acl_ops = {
+const struct ldb_module_ops ldb_kludge_acl_module_ops = {
        .name              = "kludge_acl",
        .search            = kludge_acl_search,
        .add               = kludge_acl_change,
@@ -481,8 +481,3 @@ static const struct ldb_module_ops kludge_acl_ops = {
        .extended          = kludge_acl_change,
        .init_context      = kludge_acl_init
 };
-
-int ldb_kludge_acl_init(void)
-{
-       return ldb_register_module(&kludge_acl_ops);
-}
index b3fdffe5669f6c88cb02eb8f408bba2958ed947d..d6e9d3da4fd935ae049bd26a77cd88b11743dd2e 100644 (file)
@@ -915,7 +915,7 @@ static int linked_attributes_wait(struct ldb_handle *handle, enum ldb_wait_type
        }
 }
 
-static const struct ldb_module_ops linked_attributes_ops = {
+const struct ldb_module_ops ldb_linked_attributes_module_ops = {
        .name              = "linked_attributes",
        .add               = linked_attributes_add,
        .modify            = linked_attributes_modify,
@@ -923,8 +923,3 @@ static const struct ldb_module_ops linked_attributes_ops = {
        .rename            = linked_attributes_rename,
        .wait              = linked_attributes_wait,
 };
-
-int ldb_linked_attributes_init(void)
-{
-       return ldb_register_module(&linked_attributes_ops);
-}
index 350434df51733a768e8eebaec41a3eb95f18baa1..f34acd534950796e7baf2f34810ff9768c57db4f 100644 (file)
@@ -843,16 +843,10 @@ static int local_password_wait(struct ldb_handle *handle, enum ldb_wait_type typ
        }
 }
 
-static const struct ldb_module_ops local_password_ops = {
+const struct ldb_module_ops ldb_local_password_module_ops = {
        .name          = "local_password",
        .add           = local_password_add,
        .modify        = local_password_modify,
        .search        = local_password_search,
        .wait          = local_password_wait
 };
-
-
-int local_password_module_init(void)
-{
-       return ldb_register_module(&local_password_ops);
-}
index d6b6a242875681cf54f0fe26045c9c7352daf625..94bef197e9ffd6f2035c28484f593d6c25069122 100644 (file)
@@ -117,12 +117,7 @@ static int naming_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops naming_fsmo_ops = {
+const struct ldb_module_ops ldb_naming_fsmo_module_ops = {
        .name           = "naming_fsmo",
        .init_context   = naming_fsmo_init
 };
-
-int naming_fsmo_module_init(void)
-{
-       return ldb_register_module(&naming_fsmo_ops);
-}
index 7e3b63a145079c14d5aa88227ccf03f2751fe72c..2a713a52ffc740aa4b568f3402563ba0f1064b94 100644 (file)
@@ -156,12 +156,7 @@ static int normalise_search(struct ldb_module *module, struct ldb_request *req)
 }
 
 
-static const struct ldb_module_ops normalise_ops = {
+const struct ldb_module_ops ldb_normalise_module_ops = {
        .name              = "normalise",
        .search            = normalise_search,
 };
-
-int ldb_normalise_init(void)
-{
-       return ldb_register_module(&normalise_ops);
-}
index 737475ca78b24693bcfb7fd82e6a01b5a7fd9e40..98eeed7cdee5a662678b189908fbb86195d4afd8 100644 (file)
@@ -1153,16 +1153,10 @@ static int objectclass_wait(struct ldb_handle *handle, enum ldb_wait_type type)
        }
 }
 
-static const struct ldb_module_ops objectclass_ops = {
+const struct ldb_module_ops ldb_objectclass_module_ops = {
        .name              = "objectclass",
        .add           = objectclass_add,
        .modify        = objectclass_modify,
        .rename        = objectclass_rename,
        .wait          = objectclass_wait
 };
-
-int ldb_objectclass_init(void)
-{
-       return ldb_register_module(&objectclass_ops);
-}
-
index bf57f5c21ba6194ba685244f06b0e1bc6c9c2f08..99dc46bc1fab58e448420ea26c1716bc52c24494 100644 (file)
@@ -247,14 +247,8 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req)
        return ret;
 }
 
-static const struct ldb_module_ops objectguid_ops = {
+const struct ldb_module_ops ldb_objectguid_module_ops = {
        .name          = "objectguid",
        .add           = objectguid_add,
        .modify        = objectguid_modify,
 };
-
-
-int objectguid_module_init(void)
-{
-       return ldb_register_module(&objectguid_ops);
-}
index 61b64441a749ac817d3e593719d9099b52341a94..62dd0da8a1c2bb96e8dd99a9d55f95dcf2a07539 100644 (file)
@@ -1030,7 +1030,7 @@ static int partition_wait(struct ldb_handle *handle, enum ldb_wait_type type)
        }
 }
 
-static const struct ldb_module_ops partition_ops = {
+const struct ldb_module_ops ldb_partition_module_ops = {
        .name              = "partition",
        .init_context      = partition_init,
        .search            = partition_search,
@@ -1045,8 +1045,3 @@ static const struct ldb_module_ops partition_ops = {
        .del_transaction   = partition_del_trans,
        .wait              = partition_wait
 };
-
-int ldb_partition_init(void)
-{
-       return ldb_register_module(&partition_ops);
-}
index 57c053d961829ce678d41a99e394f44e21e36211..380045c1cf04a11f31789bc6002a5c7513c797ed 100644 (file)
@@ -2044,15 +2044,9 @@ static int password_hash_wait(struct ldb_handle *handle, enum ldb_wait_type type
        }
 }
 
-static const struct ldb_module_ops password_hash_ops = {
+const struct ldb_module_ops ldb_password_hash_module_ops = {
        .name          = "password_hash",
        .add           = password_hash_add,
        .modify        = password_hash_modify,
        .wait          = password_hash_wait
 };
-
-
-int password_hash_module_init(void)
-{
-       return ldb_register_module(&password_hash_ops);
-}
index 0f3293ed1db7a58309e2a436d27466e9b00562a4..270e79ecd8eb2a1f39ac4c54d28efb4a1ea76179 100644 (file)
@@ -115,12 +115,7 @@ static int pdc_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops pdc_fsmo_ops = {
+const struct ldb_module_ops ldb_pdc_fsmo_module_ops = {
        .name           = "pdc_fsmo",
        .init_context   = pdc_fsmo_init
 };
-
-int pdc_fsmo_module_init(void)
-{
-       return ldb_register_module(&pdc_fsmo_ops);
-}
index 37ee7f9fce82cdb4b3ff21138c614f065e6dee22..a7704ef41378bcee6485ffcc242689174d27c926 100644 (file)
@@ -331,12 +331,7 @@ static int proxy_request(struct ldb_module *module, struct ldb_request *req)
        }
 }
 
-static const struct ldb_module_ops proxy_ops = {
+const struct ldb_module_ops ldb_proxy_module_ops = {
        .name           = "proxy",
        .request        = proxy_request
 };
-
-int proxy_module_init(void)
-{
-       return ldb_register_module(&proxy_ops);
-}
index c527afc6db30a9e8094825ed19964d19d056d92d..c6ebea1044e8ecd5597837e38a85ecdafd5cd012 100644 (file)
@@ -201,12 +201,7 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req)
        return ldb_next_request(module, req);
 }
 
-static const struct ldb_module_ops rr_ops = {
+const struct ldb_module_ops ldb_ranged_results_module_ops = {
        .name              = "ranged_results",
        .search            = rr_search,
 };
-
-int ldb_ranged_results_init(void)
-{
-       return ldb_register_module(&rr_ops);
-}
index 441dbc95983a9167079140c2949352ecc552a3ba..9184a8c0b2b858d00843c93e5817ee519c608344 100644 (file)
@@ -1579,15 +1579,10 @@ static int replmd_wait(struct ldb_handle *handle, enum ldb_wait_type type)
        }
 }
 
-static const struct ldb_module_ops replmd_ops = {
+const struct ldb_module_ops ldb_repl_meta_data_module_ops = {
        .name          = "repl_meta_data",
        .add           = replmd_add,
        .modify        = replmd_modify,
        .extended      = replmd_extended,
        .wait          = replmd_wait
 };
-
-int repl_meta_data_module_init(void)
-{
-       return ldb_register_module(&replmd_ops);
-}
index 02f43d7076ac15e7c3806583d2d31dfd73a4f71c..80173084ecb71acae05935697df075a63c4c304f 100644 (file)
@@ -386,15 +386,9 @@ static int rootdse_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops rootdse_ops = {
+const struct ldb_module_ops ldb_rootdse_module_ops = {
        .name                   = "rootdse",
        .init_context           = rootdse_init,
        .search                 = rootdse_search,
        .request                = rootdse_request
 };
-
-int rootdse_module_init(void)
-{
-       return ldb_register_module(&rootdse_ops);
-}
-
index 3a666b5380fd1be42f35043a6fecc65a3cdc8035..4b1d4329329e5e835de3e0501293256a5456d48c 100644 (file)
@@ -925,21 +925,8 @@ static int samba3sam_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static struct ldb_module_ops samba3sam_ops = {
+const struct ldb_module_ops ldb_samba3sam_module_ops = {
+       LDB_MAP_OPS
        .name              = "samba3sam",
        .init_context      = samba3sam_init,
 };
-
-/* the init function */
-int ldb_samba3sam_module_init(void)
-{
-       struct ldb_module_ops ops = ldb_map_get_ops();
-       samba3sam_ops.add       = ops.add;
-       samba3sam_ops.modify    = ops.modify;
-       samba3sam_ops.del       = ops.del;
-       samba3sam_ops.rename    = ops.rename;
-       samba3sam_ops.search    = ops.search;
-       samba3sam_ops.wait      = ops.wait;
-
-       return ldb_register_module(&samba3sam_ops);
-}
index baf419c750def7db6486ab1c11c45a2ad819a7cc..44776f595641d04b65847e41d549890c2e63f0f8 100644 (file)
@@ -750,14 +750,8 @@ static int samldb_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops samldb_ops = {
+const struct ldb_module_ops ldb_samldb_module_ops = {
        .name          = "samldb",
        .init_context  = samldb_init,
        .add           = samldb_add,
 };
-
-
-int samldb_module_init(void)
-{
-       return ldb_register_module(&samldb_ops);
-}
index 525193ac8c05e45d9ccd50efdc7903b7d296112d..b6eb5ffb84eccced1f50ec788da91caa0d7edf7a 100644 (file)
@@ -1221,7 +1221,7 @@ static int schema_init(struct ldb_module *module)
        return LDB_SUCCESS;
 }
 
-static const struct ldb_module_ops schema_ops = {
+const struct ldb_module_ops ldb_schema_module_ops = {
        .name          = "schema",
        .init_context  = schema_init,
        .add           = schema_add,
@@ -1230,8 +1230,3 @@ static const struct ldb_module_ops schema_ops = {
        .rename        = schema_rename,
        .wait          = schema_wait
 };
-
-int ldb_schema_init(void)
-{
-       return ldb_register_module(&schema_ops);
-}
index f9dd131fd4f8327ab323aa0f2c57fb22913a0c12..9c877475273ed79b21ed83b8fb04335ec6e40bb2 100644 (file)
@@ -255,12 +255,7 @@ static int schema_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops schema_fsmo_ops = {
+const struct ldb_module_ops ldb_schema_fsmo_module_ops = {
        .name           = "schema_fsmo",
        .init_context   = schema_fsmo_init
 };
-
-int schema_fsmo_module_init(void)
-{
-       return ldb_register_module(&schema_fsmo_ops);
-}
index 19fa63fb6e92bbfc100fb7e460deab8eba7efd79..5e6b967b477fb56432e5f50089429a91c7079c91 100644 (file)
@@ -194,13 +194,8 @@ static int show_deleted_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops show_deleted_ops = {
+const struct ldb_module_ops ldb_show_deleted_module_ops = {
        .name              = "show_deleted",
        .search            = show_deleted_search,
        .init_context      = show_deleted_init
 };
-
-int ldb_show_deleted_init(void)
-{
-       return ldb_register_module(&show_deleted_ops);
-}
index acf2fd622cc29ddb04134ec055d5dba6e5d53b99..dbb58856a02da30a2120d2baf368eaff5b2ee032 100644 (file)
@@ -793,42 +793,16 @@ static int entryuuid_sequence_number(struct ldb_module *module, struct ldb_reque
        return LDB_SUCCESS;
 }
 
-static struct ldb_module_ops entryuuid_ops = {
+const struct ldb_module_ops ldb_entryuuid_module_ops = {
        .name              = "entryuuid",
        .init_context      = entryuuid_init,
-       .sequence_number   = entryuuid_sequence_number
+       .sequence_number   = entryuuid_sequence_number,
+       LDB_MAP_OPS
 };
 
-static struct ldb_module_ops nsuniqueid_ops = {
+const struct ldb_module_ops ldb_nsuniqueid_module_ops = {
        .name              = "nsuniqueid",
        .init_context      = nsuniqueid_init,
-       .sequence_number   = entryuuid_sequence_number
+       .sequence_number   = entryuuid_sequence_number,
+       LDB_MAP_OPS
 };
-
-/* the init function */
-int ldb_simple_ldap_map_module_init(void)
-{
-       int ret;
-       struct ldb_module_ops ops = ldb_map_get_ops();
-       entryuuid_ops.add       = ops.add;
-       entryuuid_ops.modify    = ops.modify;
-       entryuuid_ops.del       = ops.del;
-       entryuuid_ops.rename    = ops.rename;
-       entryuuid_ops.search    = ops.search;
-       entryuuid_ops.wait      = ops.wait;
-       ret = ldb_register_module(&entryuuid_ops);
-
-       if (ret) {
-               return ret;
-       }
-
-       nsuniqueid_ops.add      = ops.add;
-       nsuniqueid_ops.modify   = ops.modify;
-       nsuniqueid_ops.del      = ops.del;
-       nsuniqueid_ops.rename   = ops.rename;
-       nsuniqueid_ops.search   = ops.search;
-       nsuniqueid_ops.wait     = ops.wait;
-       ret = ldb_register_module(&nsuniqueid_ops);
-
-       return ret;
-}
index e84bf60b328074e9c27327e48849d842eb2caa58..56ae7b239a2feef296815df152f03b5da6940a56 100644 (file)
@@ -247,13 +247,8 @@ static int subtree_delete_wait(struct ldb_handle *handle, enum ldb_wait_type typ
        }
 }
 
-static const struct ldb_module_ops subtree_delete_ops = {
+const struct ldb_module_ops ldb_subtree_delete_module_ops = {
        .name              = "subtree_delete",
        .del               = subtree_delete,
        .wait              = subtree_delete_wait,
 };
-
-int ldb_subtree_delete_init(void)
-{
-       return ldb_register_module(&subtree_delete_ops);
-}
index 0964c3fdcd6567bb3ff2112367488c2bdb338944..bf8124e253acf51f5eda11e22566fbbc5dc2d8b8 100644 (file)
@@ -264,13 +264,8 @@ static int subtree_rename_wait(struct ldb_handle *handle, enum ldb_wait_type typ
        }
 }
 
-static const struct ldb_module_ops subtree_rename_ops = {
+const struct ldb_module_ops ldb_subtree_rename_module_ops = {
        .name              = "subtree_rename",
        .rename            = subtree_rename,
        .wait              = subtree_rename_wait,
 };
-
-int ldb_subtree_rename_init(void)
-{
-       return ldb_register_module(&subtree_rename_ops);
-}
index a18efd757aa6803a657e5e1176aa26a1c722f368..614f05f752de473509f2798ee4c791daf8b01058 100644 (file)
@@ -199,7 +199,7 @@ static int update_kt_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops update_kt_ops = {
+const struct ldb_module_ops ldb_update_keytab_module_ops = {
        .name              = "update_keytab",
        .init_context      = update_kt_init,
        .add               = update_kt_add,
@@ -209,8 +209,3 @@ static const struct ldb_module_ops update_kt_ops = {
        .end_transaction   = update_kt_end_trans,
        .del_transaction   = update_kt_del_trans,
 };
-
-int ldb_update_kt_init(void)
-{
-       return ldb_register_module(&update_kt_ops);
-}
index 9582f3613098bf6d5f02926d2841f16316480c90..9c189feb11dc4e2e69d74ee2322fe373bdd49fad 100644 (file)
@@ -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'.
- */
index ef4da4e6546e4e5eb71ad1b2640f87928b60b36b..e40bb9cd7e3aadb5a9d02eb204fbf7c085ded130 100644 (file)
@@ -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__ */
index 2c35097069877b679d096f778e99a9a916b35caa..58a9f2704ef8eafd65457cb339304e1b57637cff 100644 (file)
@@ -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);
index b6a85941664044e4e5e65f046a0da85dbcfc0e32..eb27263b16ffe2a0fc13f241665b4061bec36bc0 100644 (file)
@@ -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);
-}
index 45f23aa0c16c491353c2a2a40f023a85bb7c3a87..7dc4ae08c380eee8947643e5afc7bb8394728ac8 100644 (file)
@@ -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);
-}
index ee1bbe03353799cf4c6dd593c1342dabdda04ee1..b62b1f92cbd7d0271fffbbef452664bfb89662fe 100644 (file)
@@ -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);
-}
-
index fd580a3c4ac2ed038484791dbb5dba0fd579589a..88ebd13921e2f4259ef1250a43b20b6b9b8646b8 100644 (file)
@@ -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);
-}
-
index 1a0ddbb3c462515b9571c829793935407dadcce1..c4de8e8da8b376ee5dd4f1127c3962d76e543db6 100644 (file)
@@ -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);
-}
index 5400c502f13340149517a45bd774ab991c3dd9f1..0cd29ac4b7e0fc8839944481daf60fb908a3b805 100644 (file)
@@ -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);
-}
index 89b9a4fb19c69ae96dda928e356f57099c4ecee0..746befa559208bb368a0a4bf875d5eb46b617da8 100644 (file)
@@ -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);
-}
index 47aa4156675f9d8408c1651830c06c279c1de964..04468556ef3218b79ecc35ecac9261b1e044540a 100644 (file)
@@ -112,16 +112,9 @@ failed:
        return LDB_ERR_OTHER;
 }
 
-static const struct ldb_module_ops wins_ldb_ops = {
+const struct ldb_module_ops ldb_wins_ldb_module_ops = {
        .name          = "wins_ldb",
        .add           = wins_ldb_verify,
        .modify        = wins_ldb_verify,
        .init_context  = wins_ldb_init
 };
-
-
-/* the init function */
-int wins_ldb_module_init(void)
-{
-       return ldb_register_module(&wins_ldb_ops);
-}