summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-02-04 21:58:29 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-02-04 21:58:29 +1100
commit0f8eeb81ec109cde681961614fb690f8373fa9c6 (patch)
tree03d3fe8f2a594cb291a3ecd10ab5c4a367cca556
parentb3c5fbec47739ee2bb26f900d1f564a36dc3ad82 (diff)
downloadsamba-0f8eeb81ec109cde681961614fb690f8373fa9c6.tar.gz
samba-0f8eeb81ec109cde681961614fb690f8373fa9c6.tar.bz2
samba-0f8eeb81ec109cde681961614fb690f8373fa9c6.zip
Remove useless layer of indirection, where every service called
task_service_init() manually. Now this is called from service.c for all services. Andrew Bartlett (This used to be commit 9c9a4731cafd0dcf6c8523a7b06759cd4f14e4db)
-rw-r--r--source4/cldap_server/cldap_server.c11
-rw-r--r--source4/dsdb/repl/drepl_service.c10
-rw-r--r--source4/kdc/kdc.c12
-rw-r--r--source4/ldap_server/ldap_server.c14
-rw-r--r--source4/nbt_server/nbt_server.c12
-rw-r--r--source4/rpc_server/service_rpc.c14
-rw-r--r--source4/smb_server/smb_server.c14
-rw-r--r--source4/smbd/service.c11
-rw-r--r--source4/web_server/web_server.c14
-rw-r--r--source4/winbind/wb_server.c13
-rw-r--r--source4/wrepl_server/wrepl_server.c19
11 files changed, 20 insertions, 124 deletions
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index 944d679a2d..7858ee2cf0 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -205,18 +205,9 @@ static void cldapd_task_init(struct task_server *task)
/*
- initialise the cldapd server
- */
-static NTSTATUS cldapd_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
-{
- return task_server_startup(event_ctx, lp_ctx, "cldap", model_ops, cldapd_task_init);
-}
-
-
-/*
register ourselves as a available server
*/
NTSTATUS server_service_cldapd_init(void)
{
- return register_server_service("cldap", cldapd_init);
+ return register_server_service("cldap", cldapd_task_init);
}
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index 246309e16f..3375059e99 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -181,17 +181,9 @@ static void dreplsrv_task_init(struct task_server *task)
}
/*
- initialise the dsdb replicator service
- */
-static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
-{
- return task_server_startup(event_ctx, lp_ctx, "drepl", model_ops, dreplsrv_task_init);
-}
-
-/*
register ourselves as a available server
*/
NTSTATUS server_service_drepl_init(void)
{
- return register_server_service("drepl", dreplsrv_init);
+ return register_server_service("drepl", dreplsrv_task_init);
}
diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c
index d820f0abe9..52ee475862 100644
--- a/source4/kdc/kdc.c
+++ b/source4/kdc/kdc.c
@@ -660,18 +660,8 @@ static void kdc_task_init(struct task_server *task)
}
-/*
- called on startup of the KDC service
-*/
-static NTSTATUS kdc_init(struct event_context *event_ctx,
- struct loadparm_context *lp_ctx,
- const struct model_ops *model_ops)
-{
- return task_server_startup(event_ctx, lp_ctx, "kdc", model_ops, kdc_task_init);
-}
-
/* called at smbd startup - register ourselves as a server service */
NTSTATUS server_service_kdc_init(void)
{
- return register_server_service("kdc", kdc_init);
+ return register_server_service("kdc", kdc_task_init);
}
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index f9c763eec7..5b2519c035 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -576,20 +576,8 @@ failed:
task_server_terminate(task, "Failed to startup ldap server task");
}
-/*
- called on startup of the web server service It's job is to start
- listening on all configured sockets
-*/
-static NTSTATUS ldapsrv_init(struct event_context *event_context,
- struct loadparm_context *lp_ctx,
- const struct model_ops *model_ops)
-{
- return task_server_startup(event_context, lp_ctx, "ldap", model_ops,
- ldapsrv_task_init);
-}
-
NTSTATUS server_service_ldap_init(void)
{
- return register_server_service("ldap", ldapsrv_init);
+ return register_server_service("ldap", ldapsrv_task_init);
}
diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c
index bcdc63e984..2ac1fb4ef3 100644
--- a/source4/nbt_server/nbt_server.c
+++ b/source4/nbt_server/nbt_server.c
@@ -89,19 +89,9 @@ static void nbtd_task_init(struct task_server *task)
/*
- initialise the nbt server
- */
-static NTSTATUS nbtd_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
-{
- return task_server_startup(event_ctx, lp_ctx, "nbt",
- model_ops, nbtd_task_init);
-}
-
-
-/*
register ourselves as a available server
*/
NTSTATUS server_service_nbtd_init(void)
{
- return register_server_service("nbt", nbtd_init);
+ return register_server_service("nbt", nbtd_task_init);
}
diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c
index 855e120ced..ddcf1c2a99 100644
--- a/source4/rpc_server/service_rpc.c
+++ b/source4/rpc_server/service_rpc.c
@@ -457,18 +457,6 @@ failed:
task_server_terminate(task, "Failed to startup dcerpc server task");
}
-/*
- called on startup of the smb server service It's job is to start
- listening on all configured sockets
-*/
-static NTSTATUS dcesrv_init(struct event_context *event_context,
- struct loadparm_context *lp_ctx,
- const struct model_ops *model_ops)
-{
- return task_server_startup(event_context, lp_ctx, "rpc",
- model_ops, dcesrv_task_init);
-}
-
NTSTATUS server_service_rpc_init(void)
{
init_module_fn static_init[] = { STATIC_dcerpc_server_MODULES };
@@ -479,5 +467,5 @@ NTSTATUS server_service_rpc_init(void)
talloc_free(shared_init);
- return register_server_service("rpc", dcesrv_init);
+ return register_server_service("rpc", dcesrv_task_init);
}
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 866ae26fa4..9a8a8cf5c4 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -250,20 +250,8 @@ failed:
task_server_terminate(task, "Failed to startup smb server task");
}
-/*
- called on startup of the smb server service It's job is to start
- listening on all configured sockets
-*/
-static NTSTATUS smbsrv_init(struct event_context *event_context,
- struct loadparm_context *lp_ctx,
- const struct model_ops *model_ops)
-{
- return task_server_startup(event_context, lp_ctx, "smb",
- model_ops, smbsrv_task_init);
-}
-
/* called at smbd startup - register ourselves as a server service */
NTSTATUS server_service_smb_init(void)
{
- return register_server_service("smb", smbsrv_init);
+ return register_server_service("smb", smbsrv_task_init);
}
diff --git a/source4/smbd/service.c b/source4/smbd/service.c
index 525b245616..2b1fcc4bd8 100644
--- a/source4/smbd/service.c
+++ b/source4/smbd/service.c
@@ -30,20 +30,20 @@
static struct registered_server {
struct registered_server *next, *prev;
const char *service_name;
- NTSTATUS (*service_init)(struct event_context *, struct loadparm_context *lp_ctx, const struct model_ops *);
+ void (*task_init)(struct task_server *);
} *registered_servers;
/*
register a server service.
*/
NTSTATUS register_server_service(const char *name,
- NTSTATUS (*service_init)(struct event_context *, struct loadparm_context *lp_ctx, const struct model_ops *))
+ void (*task_init)(struct task_server *))
{
struct registered_server *srv;
srv = talloc(talloc_autofree_context(), struct registered_server);
NT_STATUS_HAVE_NO_MEMORY(srv);
srv->service_name = name;
- srv->service_init = service_init;
+ srv->task_init = task_init;
DLIST_ADD_END(registered_servers, srv, struct registered_server *);
return NT_STATUS_OK;
}
@@ -53,14 +53,15 @@ NTSTATUS register_server_service(const char *name,
initialise a server service
*/
static NTSTATUS server_service_init(const char *name,
- struct event_context *event_ctx,
+ struct event_context *event_context,
struct loadparm_context *lp_ctx,
const struct model_ops *model_ops)
{
struct registered_server *srv;
for (srv=registered_servers; srv; srv=srv->next) {
if (strcasecmp(name, srv->service_name) == 0) {
- return srv->service_init(event_ctx, lp_ctx, model_ops);
+ return task_server_startup(event_context, lp_ctx, srv->service_name,
+ model_ops, srv->task_init);
}
}
return NT_STATUS_INVALID_SYSTEM_SERVICE;
diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c
index bd212cff7d..ac83a3384d 100644
--- a/source4/web_server/web_server.c
+++ b/source4/web_server/web_server.c
@@ -290,20 +290,8 @@ failed:
}
-/*
- called on startup of the web server service It's job is to start
- listening on all configured sockets
-*/
-static NTSTATUS websrv_init(struct event_context *event_context,
- struct loadparm_context *lp_ctx,
- const struct model_ops *model_ops)
-{
- return task_server_startup(event_context, lp_ctx, "web",
- model_ops, websrv_task_init);
-}
-
/* called at smbd startup - register ourselves as a server service */
NTSTATUS server_service_web_init(void)
{
- return register_server_service("web", websrv_init);
+ return register_server_service("web", websrv_task_init);
}
diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c
index 9acde4a557..9b303f3615 100644
--- a/source4/winbind/wb_server.c
+++ b/source4/winbind/wb_server.c
@@ -202,20 +202,9 @@ nomem:
}
/*
- initialise the winbind server
- */
-static NTSTATUS winbind_init(struct event_context *event_ctx,
- struct loadparm_context *lp_ctx,
- const struct model_ops *model_ops)
-{
- return task_server_startup(event_ctx, lp_ctx, "winbind",
- model_ops, winbind_task_init);
-}
-
-/*
register ourselves as a available server
*/
NTSTATUS server_service_winbind_init(void)
{
- return register_server_service("winbind", winbind_init);
+ return register_server_service("winbind", winbind_task_init);
}
diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c
index d13482dd98..e750d9355a 100644
--- a/source4/wrepl_server/wrepl_server.c
+++ b/source4/wrepl_server/wrepl_server.c
@@ -453,6 +453,10 @@ static void wreplsrv_task_init(struct task_server *task)
NTSTATUS status;
struct wreplsrv_service *service;
+ if (!lp_wins_support(task->lp_ctx)) {
+ return;
+ }
+
task_server_set_title(task, "task[wreplsrv]");
service = talloc_zero(task, struct wreplsrv_service);
@@ -502,22 +506,9 @@ static void wreplsrv_task_init(struct task_server *task)
}
/*
- initialise the WREPL server
- */
-static NTSTATUS wreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
-{
- if (!lp_wins_support(lp_ctx)) {
- return NT_STATUS_OK;
- }
-
- return task_server_startup(event_ctx, lp_ctx, "wrepl",
- model_ops, wreplsrv_task_init);
-}
-
-/*
register ourselves as a available server
*/
NTSTATUS server_service_wrepl_init(void)
{
- return register_server_service("wrepl", wreplsrv_init);
+ return register_server_service("wrepl", wreplsrv_task_init);
}