summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-11-06 23:23:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:36 -0500
commit71db46ea665606384f2be1be708c74c97c9adfb2 (patch)
tree24c84e12f4fc925f3ec1e69348493d7222df1e44 /source4/lib/registry
parentb012ab557b8f8a2f58dfbbe8b7818f3e6d8cf38f (diff)
downloadsamba-71db46ea665606384f2be1be708c74c97c9adfb2.tar.gz
samba-71db46ea665606384f2be1be708c74c97c9adfb2.tar.bz2
samba-71db46ea665606384f2be1be708c74c97c9adfb2.zip
r3586: Fix some of the issues with the module init functions.
Both subsystems and modules can now have init functions, which can be specified in .mk files (INIT_FUNCTION = ...) The build system will define : - SUBSYSTEM_init_static_modules that calls the init functions of all statically compiled modules. Failing to load will generate an error which is not fatal - BINARY_init_subsystems that calls the init functions (if defined) for the subsystems the binary depends on This removes the hack with the "static bool Initialised = " and the "lazy_init" functions (This used to be commit 7a8244761bfdfdfb48f8264d76951ebdfbf7bd8a)
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/common/reg_interface.c17
-rw-r--r--source4/lib/registry/config.mk7
-rw-r--r--source4/lib/registry/tools/regdiff.c1
-rw-r--r--source4/lib/registry/tools/regpatch.c1
-rw-r--r--source4/lib/registry/tools/regshell.c1
-rw-r--r--source4/lib/registry/tools/regtree.c1
6 files changed, 16 insertions, 12 deletions
diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c
index b2d659258d..0399fc26aa 100644
--- a/source4/lib/registry/common/reg_interface.c
+++ b/source4/lib/registry/common/reg_interface.c
@@ -59,24 +59,19 @@ NTSTATUS registry_register(const void *_function)
return NT_STATUS_OK;
}
-static BOOL registry_init(void)
+NTSTATUS registry_init(void)
{
- static BOOL initialised;
NTSTATUS status;
- if(initialised) {
- return True;
- }
-
status = register_subsystem("registry", registry_register);
if (NT_STATUS_IS_ERR(status)) {
DEBUG(0, ("Error registering registry subsystem: %s\n", nt_errstr(status)));
- return False;
+ return status;
}
- initialised = True;
- static_init_registry;
- return True;
+ registry_init_static_modules;
+
+ return NT_STATUS_OK;
}
/* Find a backend in the list of available backends */
@@ -84,8 +79,6 @@ static struct reg_init_function_entry *reg_find_backend_entry(const char *name)
{
struct reg_init_function_entry *entry;
- if(registry_init() == False) return NULL;
-
entry = backends;
while(entry) {
diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk
index 659e705d5d..dacd6d5295 100644
--- a/source4/lib/registry/config.mk
+++ b/source4/lib/registry/config.mk
@@ -3,6 +3,7 @@
################################################
# Start MODULE registry_nt4
[MODULE::registry_nt4]
+INIT_FUNCTION = registry_nt4_init
INIT_OBJ_FILES = \
lib/registry/reg_backend_nt4/reg_backend_nt4.o
# End MODULE registry_nt4
@@ -11,6 +12,7 @@ INIT_OBJ_FILES = \
################################################
# Start MODULE registry_w95
[MODULE::registry_w95]
+INIT_FUNCTION = registry_w95_init
INIT_OBJ_FILES = \
lib/registry/reg_backend_w95/reg_backend_w95.o
# End MODULE registry_w95
@@ -19,6 +21,7 @@ INIT_OBJ_FILES = \
################################################
# Start MODULE registry_dir
[MODULE::registry_dir]
+INIT_FUNCTION = registry_dir_init
INIT_OBJ_FILES = \
lib/registry/reg_backend_dir/reg_backend_dir.o
# End MODULE registry_dir
@@ -27,6 +30,7 @@ INIT_OBJ_FILES = \
################################################
# Start MODULE registry_rpc
[MODULE::registry_rpc]
+INIT_FUNCTION = registry_rpc_init
INIT_OBJ_FILES = \
lib/registry/reg_backend_rpc/reg_backend_rpc.o
REQUIRED_SUBSYSTEMS = \
@@ -37,6 +41,7 @@ REQUIRED_SUBSYSTEMS = \
################################################
# Start MODULE registry_gconf
[MODULE::registry_gconf]
+INIT_FUNCTION = registry_gconf_init
INIT_OBJ_FILES = \
lib/registry/reg_backend_gconf/reg_backend_gconf.o
REQUIRED_LIBRARIES = \
@@ -47,6 +52,7 @@ REQUIRED_LIBRARIES = \
################################################
# Start MODULE registry_ldb
[MODULE::registry_ldb]
+INIT_FUNCTION = registry_ldb_init
INIT_OBJ_FILES = \
lib/registry/reg_backend_ldb/reg_backend_ldb.o
REQUIRED_SUBSYSTEMS = \
@@ -57,6 +63,7 @@ REQUIRED_SUBSYSTEMS = \
################################################
# Start SUBSYSTEM REGISTRY
[SUBSYSTEM::REGISTRY]
+INIT_FUNCTION = registry_init
INIT_OBJ_FILES = \
lib/registry/common/reg_interface.o
ADD_OBJ_FILES = \
diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c
index 80f4a5c49f..55c8f1e72f 100644
--- a/source4/lib/registry/tools/regdiff.c
+++ b/source4/lib/registry/tools/regdiff.c
@@ -131,6 +131,7 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey,
POPT_TABLEEND
};
+ regdiff_init_subsystems;
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
index d70d7b8457..a8b2f83ee1 100644
--- a/source4/lib/registry/tools/regpatch.c
+++ b/source4/lib/registry/tools/regpatch.c
@@ -771,6 +771,7 @@ static int nt_apply_reg_command_file(struct registry_context *r, const char *cmd
POPT_TABLEEND
};
+ regpatch_init_subsystems;
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index d705a0b802..8d044f6fa2 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -356,6 +356,7 @@ static char **reg_completion(const char *text, int start, int end)
POPT_TABLEEND
};
+ regshell_init_subsystems;
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index a8225c026d..ced7a00f94 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -88,6 +88,7 @@ static void print_tree(int l, struct registry_key *p, int fullpath, int novals)
POPT_TABLEEND
};
+ regtree_init_subsystems;
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);