lib/util Split samba-modules library into public and private parts
[gd/samba-autobuild/.git] / source4 / ntptr / ntptr_base.c
index 1a14c3b33ec34a73715b300e71b1bacb424f613b..7b16986655e11f6763fe33d7a4fe50a76527c4ae 100644 (file)
@@ -24,8 +24,8 @@
 
 #include "includes.h"
 #include "ntptr/ntptr.h"
-#include "build.h"
 #include "param/param.h"
+#include "lib/util/samba_module.h"
 
 /* the list of currently registered NTPTR backends */
 static struct ntptr_backend {
@@ -69,13 +69,15 @@ NTSTATUS ntptr_register(const void *_ops)
        return NT_STATUS_OK;
 }
 
-NTSTATUS ntptr_init(struct loadparm_context *lp_ctx)
+NTSTATUS ntptr_init(void)
 {
-       init_module_fn static_init[] = STATIC_ntptr_MODULES;
-       init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntptr");
+#define _MODULE_PROTO(init) extern NTSTATUS init(void);
+       STATIC_ntptr_MODULES_PROTO;
+       samba_init_module_fn static_init[] = { STATIC_ntptr_MODULES };
+       samba_init_module_fn *shared_init = samba_modules_load(NULL, "ntptr");
 
-       run_init_functions(static_init);
-       run_init_functions(shared_init);
+       samba_init_module_fns_run(static_init);
+       samba_init_module_fns_run(shared_init);
 
        talloc_free(shared_init);
        
@@ -119,7 +121,9 @@ const struct ntptr_critical_sizes *ntptr_interface_version(void)
 /*
   create a ntptr_context with a specified NTPTR backend
 */
-NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, const char *providor, struct ntptr_context **_ntptr)
+NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx,
+                           struct loadparm_context *lp_ctx,
+                           const char *providor, struct ntptr_context **_ntptr)
 {
        NTSTATUS status;
        struct ntptr_context *ntptr;
@@ -132,6 +136,8 @@ NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, const char *providor, struct nt
        NT_STATUS_HAVE_NO_MEMORY(ntptr);
        ntptr->private_data     = NULL;
        ntptr->ops              = ntptr_backend_byname(providor);
+       ntptr->ev_ctx           = ev_ctx;
+       ntptr->lp_ctx           = lp_ctx;
 
        if (!ntptr->ops) {
                DEBUG(1,("ntptr_init_context: failed to find NTPTR providor='%s'\n",