nsswitch: Fix checking for config.h #define in nsstest.h
[gd/samba-autobuild/.git] / source4 / param / share.c
index 6c0269d5fc28e50fa40cbc2e748e6ac250803582..7a57151081269ffe4dba1fa9f419a03ba728d845 100644 (file)
@@ -1,7 +1,7 @@
 /* 
    Unix SMB/CIFS implementation.
    
-   Modular services configuration system
+   Modular shares configuration system
    
    Copyright (C) Simo Sorce    2006
    
 
 #include "includes.h"
 #include "param/share.h"
-#include "build.h"
 #include "param/param.h"
+#include "lib/util/samba_modules.h"
 
-const char *share_string_option(struct share_config *scfg, const char *opt_name, const char *defval)
+char *share_string_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name, const char *defval)
 {
-       return scfg->ctx->ops->string_option(scfg, opt_name, defval);
+       return scfg->ctx->ops->string_option(mem_ctx, scfg, opt_name, defval);
 }
 
 int share_int_option(struct share_config *scfg, const char *opt_name, int defval)
@@ -126,38 +126,32 @@ NTSTATUS share_register(const struct share_ops *ops)
        return NT_STATUS_OK;
 }
 
-NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, 
-                                                                  const char *backend_name,
-                                                                  struct share_context **ctx)
+NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name,
+                                  struct tevent_context *event_ctx, 
+                                  struct loadparm_context *lp_ctx,
+                                  struct share_context **ctx)
 {
        const struct share_ops *ops;
 
        ops = share_backend_by_name(backend_name);
        if (!ops) {
-               DEBUG(0, ("share_init_connection: share backend [%s] not found!\n", lp_share_backend(global_loadparm)));
+               DEBUG(0, ("share_init_connection: share backend [%s] not found!\n", backend_name));
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       return ops->init(mem_ctx, ops, ctx);
-}
-
-NTSTATUS share_get_context(TALLOC_CTX *mem_ctx, struct share_context **ctx)
-{
-       return share_get_context_by_name(mem_ctx, lp_share_backend(global_loadparm), ctx);
+       return ops->init(mem_ctx, ops, event_ctx, lp_ctx, ctx);
 }
 
 /*
   initialise the SHARE subsystem
 */
-NTSTATUS share_init(struct loadparm_context *lp_ctx)
+NTSTATUS share_init(void)
 {
-       init_module_fn static_init[] = STATIC_share_MODULES;
-       init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "share");
-
-       run_init_functions(static_init);
-       run_init_functions(shared_init);
+#define _MODULE_PROTO(init) extern NTSTATUS init(TALLOC_CTX *);
+       STATIC_share_MODULES_PROTO;
+       init_module_fn static_init[] = { STATIC_share_MODULES };
 
-       talloc_free(shared_init);
+       run_init_functions(NULL, static_init);
 
        return NT_STATUS_OK;
 }