summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-24 19:39:53 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-10-28 13:10:28 +0200
commit87354c9a6de95d5dcebace77a35fc21a73d599ab (patch)
treea6d36044d59b15893680282a274d964136d27fe5 /lib/util
parentb7b798e15b7be2d57e20c14cca2f908b301ed894 (diff)
downloadsamba-87354c9a6de95d5dcebace77a35fc21a73d599ab.tar.gz
samba-87354c9a6de95d5dcebace77a35fc21a73d599ab.tar.bz2
samba-87354c9a6de95d5dcebace77a35fc21a73d599ab.zip
lib/util Split samba-modules library into public and private parts
This will allow OpenChange to get at the symbols it needs, without exposing any more of this as a public API than we must. Andrew Bartlett
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/internal_module.c (renamed from lib/util/modules.c)41
-rw-r--r--lib/util/internal_module.h42
-rw-r--r--lib/util/samba-module.pc.in11
-rw-r--r--lib/util/samba_module.c62
-rw-r--r--lib/util/samba_module.h (renamed from lib/util/samba_modules.h)10
-rwxr-xr-xlib/util/wscript_build14
6 files changed, 128 insertions, 52 deletions
diff --git a/lib/util/modules.c b/lib/util/internal_module.c
index e9e6bf5dc8..04c02f0760 100644
--- a/lib/util/modules.c
+++ b/lib/util/internal_module.c
@@ -21,7 +21,7 @@
#include "includes.h"
#include "dynconfig/dynconfig.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/internal_module.h"
#include "system/filesys.h"
#include "system/dir.h"
@@ -82,7 +82,7 @@ samba_init_module_fn load_module(const char *path, bool is_probe, void **handle_
* Obtain list of init functions from the modules in the specified
* directory
*/
-static samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
+samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
{
DIR *dir;
struct dirent *entry;
@@ -119,43 +119,6 @@ static samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
return ret;
}
-/**
- * Run the specified init functions.
- *
- * @return true if all functions ran successfully, false otherwise
- */
-bool samba_init_module_fns_run(samba_init_module_fn *fns)
-{
- int i;
- bool ret = true;
-
- if (fns == NULL)
- return true;
-
- for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); }
-
- return ret;
-}
-
-/**
- * Load the initialization functions from DSO files for a specific subsystem.
- *
- * Will return an array of function pointers to initialization functions
- */
-
-samba_init_module_fn *samba_modules_load(TALLOC_CTX *mem_ctx, const char *subsystem)
-{
- char *path = modules_path(mem_ctx, subsystem);
- samba_init_module_fn *ret;
-
- ret = load_modules(mem_ctx, path);
-
- talloc_free(path);
-
- return ret;
-}
-
-
/* Load a dynamic module. Only log a level 0 error if we are not checking
for the existence of a module (probling). */
diff --git a/lib/util/internal_module.h b/lib/util/internal_module.h
new file mode 100644
index 0000000000..7d1acc52a3
--- /dev/null
+++ b/lib/util/internal_module.h
@@ -0,0 +1,42 @@
+/*
+ Unix SMB/CIFS implementation.
+ Handling of idle/exit events
+ Copyright (C) Stefan (metze) Metzmacher 2003
+ Copyright (C) Andrew Bartlett 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _INTERNAL_MODULES_H
+#define _INTERNAL_MODULES_H
+
+#include "lib/util/samba_module.h"
+
+/**
+ * Obtain the init function from a shared library file.
+ *
+ * The handle to dlclose() in case of error is returns in *handle if handle is not NULL
+ */
+samba_init_module_fn load_module(const char *path, bool is_probe, void **handle);
+
+int smb_load_modules(const char **modules);
+NTSTATUS smb_probe_module(const char *subsystem, const char *module);
+
+/**
+ * Obtain list of init functions from the modules in the specified
+ * directory
+ */
+samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path);
+
+#endif /* _INTERNAL_MODULES_H */
diff --git a/lib/util/samba-module.pc.in b/lib/util/samba-module.pc.in
new file mode 100644
index 0000000000..8f22988cd0
--- /dev/null
+++ b/lib/util/samba-module.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: samba-modules
+Description: Samba module loading utility functions
+Requires: talloc
+Version: 0.0.1
+Libs: @LIB_RPATH@ -L${libdir} -lsamba-modules
+Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1
diff --git a/lib/util/samba_module.c b/lib/util/samba_module.c
new file mode 100644
index 0000000000..f555eea8b6
--- /dev/null
+++ b/lib/util/samba_module.c
@@ -0,0 +1,62 @@
+/*
+ Unix SMB/CIFS implementation.
+ Samba utility functions
+ Copyright (C) Jelmer Vernooij 2002-2003,2005-2007
+ Copyright (C) Stefan (metze) Metzmacher 2003
+ Copyright (C) Andrew Bartlett 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "dynconfig/dynconfig.h"
+#include "lib/util/internal_module.h"
+#include "system/filesys.h"
+#include "system/dir.h"
+
+/**
+ * Run the specified init functions.
+ *
+ * @return true if all functions ran successfully, false otherwise
+ */
+bool samba_init_module_fns_run(samba_init_module_fn *fns)
+{
+ int i;
+ bool ret = true;
+
+ if (fns == NULL)
+ return true;
+
+ for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); }
+
+ return ret;
+}
+
+/**
+ * Load the initialization functions from DSO files for a specific subsystem.
+ *
+ * Will return an array of function pointers to initialization functions
+ */
+
+samba_init_module_fn *samba_modules_load(TALLOC_CTX *mem_ctx, const char *subsystem)
+{
+ char *path = modules_path(mem_ctx, subsystem);
+ samba_init_module_fn *ret;
+
+ ret = load_modules(mem_ctx, path);
+
+ talloc_free(path);
+
+ return ret;
+}
diff --git a/lib/util/samba_modules.h b/lib/util/samba_module.h
index a3d7609cb6..32b5c4b6ad 100644
--- a/lib/util/samba_modules.h
+++ b/lib/util/samba_module.h
@@ -33,13 +33,6 @@ NTSTATUS samba_init_module(void);
#define SAMBA_INIT_MODULE "samba_init_module"
/**
- * Obtain the init function from a shared library file.
- *
- * The handle to dlclose() in case of error is returns in *handle if handle is not NULL
- */
-samba_init_module_fn load_module(const char *path, bool is_probe, void **handle);
-
-/**
* Run the specified init functions.
*
* @return true if all functions ran successfully, false otherwise
@@ -53,7 +46,4 @@ bool samba_init_module_fns_run(samba_init_module_fn *fns);
*/
samba_init_module_fn *samba_modules_load(TALLOC_CTX *mem_ctx, const char *subsystem);
-int smb_load_modules(const char **modules);
-NTSTATUS smb_probe_module(const char *subsystem, const char *module);
-
#endif /* _SAMBA_MODULES_H */
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 1dc65fab5e..990887aeab 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -17,11 +17,19 @@ bld.SAMBA_LIBRARY('samba-util',
pc_files='samba-util.pc'
)
-bld.SAMBA_LIBRARY('samba-modules',
- source='modules.c',
+bld.SAMBA_LIBRARY('samba-module',
+ source='samba_module.c',
+ deps='errors samba-util samba-internal-module',
+ local_include=False,
+ public_headers='samba_module.h',
+ vnum='0.0.1',
+ pc_files='samba-module.pc')
+
+bld.SAMBA_LIBRARY('samba-internal-module',
+ source='internal_module.c',
deps='errors samba-util',
local_include=False,
- private_library=True)
+ private_library=True)
bld.SAMBA_LIBRARY('asn1util',
source='asn1.c',