From 448483199fb436309735f5203b3282fca2c517ec Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 26 Dec 2005 16:46:55 +0000 Subject: r12494: Support loading modules from .so files for most subsystems. We now use a different system for initializing the modules for a subsystem. Most subsystems now have an init function that looks something like this: init_module_fn static_init[] = STATIC_AUTH_MODULES; init_module_fn *shared_init = load_samba_modules(NULL, "auth"); run_init_functions(static_init); run_init_functions(shared_init); talloc_free(shared_init); I hope to eliminate the other init functions later on (the init_programname_subsystems; defines). (This used to be commit b6d2ad4ce0a91c4be790dd258820c492ff1787ea) --- source4/build/smb_build/smb_build_h.pm | 36 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'source4/build/smb_build/smb_build_h.pm') diff --git a/source4/build/smb_build/smb_build_h.pm b/source4/build/smb_build/smb_build_h.pm index e06e965ac7..2bb9f35c53 100644 --- a/source4/build/smb_build/smb_build_h.pm +++ b/source4/build/smb_build/smb_build_h.pm @@ -24,6 +24,8 @@ sub _prepare_smb_build_h($) { my $depend = shift; my @defines = (); + my %declared = (); + my $output = ""; # # loop over all binaries @@ -42,7 +44,9 @@ sub _prepare_smb_build_h($) $DEFINE->{KEY} = $name . "_init_subsystems"; $DEFINE->{VAL} = "do { \\\n"; foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) { - $DEFINE->{VAL} .= "\t\textern NTSTATUS $subkey(void); \\\n"; + next if defined($declared{$subkey}); + $output .= "NTSTATUS $subkey(void);\n"; + $declared{$subkey} = 1; } foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) { @@ -53,6 +57,24 @@ sub _prepare_smb_build_h($) push(@defines,$DEFINE); } + foreach my $key (values %{$depend}) { + my $DEFINE = (); + next if ($key->{TYPE} ne "LIBRARY" and $key->{TYPE} ne "SUBSYSTEM"); + next unless defined($key->{INIT_FUNCTIONS}); + + $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT"; + $DEFINE->{KEY} = "STATIC_$key->{NAME}_MODULES"; + $DEFINE->{VAL} = "{ \\\n"; + foreach (@{$key->{INIT_FUNCTIONS}}) { + $DEFINE->{VAL} .= "\t$_, \\\n"; + $output .= "NTSTATUS $_(void);\n"; + } + + $DEFINE->{VAL} .= "\tNULL \\\n }"; + + push(@defines,$DEFINE); + } + # # Shared modules # @@ -78,10 +100,7 @@ sub _prepare_smb_build_h($) # # loop over all SMB_BUILD_H define sections # - my $output = ""; - foreach my $key (@defines) { - $output .= _add_define_section($key); - } + foreach (@defines) { $output .= _add_define_section($_); } return $output; } @@ -98,15 +117,12 @@ sub _prepare_smb_build_h($) sub create_smb_build_h($$) { my ($CTX, $file) = @_; - my $output = "/* autogenerated by build/smb_build/main.pl */\n"; - - $output .= _prepare_smb_build_h($CTX); open(SMB_BUILD_H,">$file") || die ("Can't open `$file'\n"); - print SMB_BUILD_H $output; + print SMB_BUILD_H "/* autogenerated by build/smb_build/main.pl */\n"; + print SMB_BUILD_H _prepare_smb_build_h($CTX); close(SMB_BUILD_H); print __FILE__.": creating $file\n"; - return; } 1; -- cgit