summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-05 19:03:43 -0600
committerStefan Metzmacher <metze@samba.org>2008-01-05 13:06:03 -0600
commitdf408d056ec03f2abe08ce0ea487e1875b90e7bf (patch)
tree68cb7b83f12d50d8536acef9c1fed74d22ad9f54 /source4/smbd
parent01c79091924602bb5c3f1c0c823b2577c4708f6a (diff)
downloadsamba-df408d056ec03f2abe08ce0ea487e1875b90e7bf.tar.gz
samba-df408d056ec03f2abe08ce0ea487e1875b90e7bf.tar.bz2
samba-df408d056ec03f2abe08ce0ea487e1875b90e7bf.zip
r26672: Janitorial: Remove uses of global_loadparm.
(This used to be commit 18cd08623eaad7d2cd63b82ea5275d4dfd21cf00)
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process_model.h13
-rw-r--r--source4/smbd/process_single.c12
-rw-r--r--source4/smbd/process_standard.c11
-rw-r--r--source4/smbd/process_thread.c24
-rw-r--r--source4/smbd/service_stream.c12
-rw-r--r--source4/smbd/service_task.c6
6 files changed, 56 insertions, 22 deletions
diff --git a/source4/smbd/process_model.h b/source4/smbd/process_model.h
index 19212606c1..c2a5c9e9e8 100644
--- a/source4/smbd/process_model.h
+++ b/source4/smbd/process_model.h
@@ -44,14 +44,21 @@ struct model_ops {
void (*model_init)(struct event_context *);
/* function to accept new connection */
- void (*accept_connection)(struct event_context *, struct socket_context *,
- void (*)(struct event_context *, struct socket_context *,
+ void (*accept_connection)(struct event_context *,
+ struct loadparm_context *,
+ struct socket_context *,
+ void (*)(struct event_context *,
+ struct loadparm_context *,
+ struct socket_context *,
struct server_id , void *),
void *);
/* function to create a task */
void (*new_task)(struct event_context *,
- void (*)(struct event_context *, struct server_id, void *),
+ struct loadparm_context *lp_ctx,
+ void (*)(struct event_context *,
+ struct loadparm_context *, struct server_id,
+ void *),
void *);
/* function to terminate a connection or task */
diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c
index 5ba2c8df88..5d3c36adb9 100644
--- a/source4/smbd/process_single.c
+++ b/source4/smbd/process_single.c
@@ -37,8 +37,11 @@ static void single_model_init(struct event_context *ev)
called when a listening socket becomes readable.
*/
static void single_accept_connection(struct event_context *ev,
+ struct loadparm_context *lp_ctx,
struct socket_context *sock,
- void (*new_conn)(struct event_context *, struct socket_context *,
+ void (*new_conn)(struct event_context *,
+ struct loadparm_context *,
+ struct socket_context *,
struct server_id , void *),
void *private)
{
@@ -61,18 +64,19 @@ static void single_accept_connection(struct event_context *ev,
talloc_steal(private, sock);
- new_conn(ev, sock2, cluster_id(socket_get_fd(sock2)), private);
+ new_conn(ev, lp_ctx, sock2, cluster_id(socket_get_fd(sock2)), private);
}
/*
called to startup a new task
*/
static void single_new_task(struct event_context *ev,
- void (*new_task)(struct event_context *, struct server_id, void *),
+ struct loadparm_context *lp_ctx,
+ void (*new_task)(struct event_context *, struct loadparm_context *, struct server_id, void *),
void *private)
{
static uint32_t taskid = 0x10000000;
- new_task(ev, cluster_id(taskid++), private);
+ new_task(ev, lp_ctx, cluster_id(taskid++), private);
}
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index 09d32d05aa..c088ea3b1a 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -56,8 +56,10 @@ static void standard_model_init(struct event_context *ev)
called when a listening socket becomes readable.
*/
static void standard_accept_connection(struct event_context *ev,
+ struct loadparm_context *lp_ctx,
struct socket_context *sock,
- void (*new_conn)(struct event_context *, struct socket_context *,
+ void (*new_conn)(struct event_context *,
+ struct loadparm_context *, struct socket_context *,
struct server_id , void *),
void *private)
{
@@ -126,7 +128,7 @@ static void standard_accept_connection(struct event_context *ev,
talloc_free(s);
/* setup this new connection */
- new_conn(ev2, sock2, cluster_id(pid), private);
+ new_conn(ev2, lp_ctx, sock2, cluster_id(pid), private);
/* we can't return to the top level here, as that event context is gone,
so we now process events in the new event context until there are no
@@ -141,7 +143,8 @@ static void standard_accept_connection(struct event_context *ev,
called to create a new server task
*/
static void standard_new_task(struct event_context *ev,
- void (*new_task)(struct event_context *, struct server_id , void *),
+ struct loadparm_context *lp_ctx,
+ void (*new_task)(struct event_context *, struct loadparm_context *lp_ctx, struct server_id , void *),
void *private)
{
pid_t pid;
@@ -179,7 +182,7 @@ static void standard_new_task(struct event_context *ev,
setproctitle("task server_id[%d]", pid);
/* setup this new connection */
- new_task(ev2, cluster_id(pid), private);
+ new_task(ev2, lp_ctx, cluster_id(pid), private);
/* we can't return to the top level here, as that event context is gone,
so we now process events in the new event context until there are no
diff --git a/source4/smbd/process_thread.c b/source4/smbd/process_thread.c
index 349ed44bc9..6c5f4816c0 100644
--- a/source4/smbd/process_thread.c
+++ b/source4/smbd/process_thread.c
@@ -39,7 +39,8 @@ static pthread_key_t title_key;
struct new_conn_state {
struct event_context *ev;
struct socket_context *sock;
- void (*new_conn)(struct event_context *, struct socket_context *, uint32_t , void *);
+ struct loadparm_context *lp_ctx;
+ void (*new_conn)(struct event_context *, struct loadparm_context *lp_ctx, struct socket_context *, uint32_t , void *);
void *private;
};
@@ -47,7 +48,7 @@ static void *thread_connection_fn(void *thread_parm)
{
struct new_conn_state *new_conn = talloc_get_type(thread_parm, struct new_conn_state);
- new_conn->new_conn(new_conn->ev, new_conn->sock, pthread_self(), new_conn->private);
+ new_conn->new_conn(new_conn->ev, new_conn->lp_ctx, new_conn->sock, pthread_self(), new_conn->private);
/* run this connection from here */
event_loop_wait(new_conn->ev);
@@ -61,8 +62,11 @@ static void *thread_connection_fn(void *thread_parm)
called when a listening socket becomes readable
*/
static void thread_accept_connection(struct event_context *ev,
+ struct loadparm_context *lp_ctx,
struct socket_context *sock,
- void (*new_conn)(struct event_context *, struct socket_context *,
+ void (*new_conn)(struct event_context *,
+ struct loadparm_context *,
+ struct socket_context *,
uint32_t , void *),
void *private)
{
@@ -84,6 +88,7 @@ static void thread_accept_connection(struct event_context *ev,
state->new_conn = new_conn;
state->private = private;
+ state->lp_ctx = lp_ctx;
state->ev = ev2;
/* accept an incoming connection. */
@@ -117,7 +122,9 @@ static void thread_accept_connection(struct event_context *ev,
struct new_task_state {
struct event_context *ev;
- void (*new_task)(struct event_context *, uint32_t , void *);
+ struct loadparm_context *lp_ctx;
+ void (*new_task)(struct event_context *, struct loadparm_context *,
+ uint32_t , void *);
void *private;
};
@@ -125,7 +132,8 @@ static void *thread_task_fn(void *thread_parm)
{
struct new_task_state *new_task = talloc_get_type(thread_parm, struct new_task_state);
- new_task->new_task(new_task->ev, pthread_self(), new_task->private);
+ new_task->new_task(new_task->ev, new_task->lp_ctx, pthread_self(),
+ new_task->private);
/* run this connection from here */
event_loop_wait(new_task->ev);
@@ -139,7 +147,10 @@ static void *thread_task_fn(void *thread_parm)
called when a new task is needed
*/
static void thread_new_task(struct event_context *ev,
- void (*new_task)(struct event_context *, uint32_t , void *),
+ struct loadparm_context *lp_ctx,
+ void (*new_task)(struct event_context *,
+ struct loadparm_context *,
+ uint32_t , void *),
void *private)
{
int rc;
@@ -158,6 +169,7 @@ static void thread_new_task(struct event_context *ev,
}
state->new_task = new_task;
+ state->lp_ctx = lp_ctx;
state->private = private;
state->ev = ev2;
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c
index 6d2e95dc94..0d6f1b7281 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -43,6 +43,7 @@
*/
struct stream_socket {
const struct stream_server_ops *ops;
+ struct loadparm_context *lp_ctx;
struct event_context *event_ctx;
const struct model_ops *model_ops;
struct socket_context *sock;
@@ -151,6 +152,7 @@ NTSTATUS stream_new_connection_merge(struct event_context *ev,
context of the new process (if appropriate)
*/
static void stream_new_connection(struct event_context *ev,
+ struct loadparm_context *lp_ctx,
struct socket_context *sock,
struct server_id server_id, void *private)
{
@@ -182,9 +184,9 @@ static void stream_new_connection(struct event_context *ev,
/* setup to receive internal messages on this connection */
srv_conn->msg_ctx = messaging_init(srv_conn,
- lp_messaging_path(srv_conn, global_loadparm),
+ lp_messaging_path(srv_conn, lp_ctx),
srv_conn->server_id,
- lp_iconv_convenience(global_loadparm),
+ lp_iconv_convenience(lp_ctx),
ev);
if (!srv_conn->msg_ctx) {
stream_terminate_connection(srv_conn, "messaging_init() failed");
@@ -225,7 +227,8 @@ static void stream_accept_handler(struct event_context *ev, struct fd_event *fde
/* ask the process model to create us a process for this new
connection. When done, it calls stream_new_connection()
with the newly created socket */
- stream_socket->model_ops->accept_connection(ev, stream_socket->sock,
+ stream_socket->model_ops->accept_connection(ev, stream_socket->lp_ctx,
+ stream_socket->sock,
stream_new_connection, stream_socket);
}
@@ -238,6 +241,7 @@ static void stream_accept_handler(struct event_context *ev, struct fd_event *fde
to the socket implementation - JRV20070903
*/
NTSTATUS stream_setup_socket(struct event_context *event_context,
+ struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
const struct stream_server_ops *stream_ops,
const char *family,
@@ -259,6 +263,8 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
talloc_steal(stream_socket, stream_socket->sock);
+ stream_socket->lp_ctx = talloc_reference(stream_socket, lp_ctx);
+
/* ready to listen */
status = socket_set_option(stream_socket->sock, "SO_KEEPALIVE", NULL);
NT_STATUS_NOT_OK_RETURN(status);
diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c
index f286da5cf6..08588464cc 100644
--- a/source4/smbd/service_task.c
+++ b/source4/smbd/service_task.c
@@ -53,6 +53,7 @@ struct task_state {
the server specific startup code
*/
static void task_server_callback(struct event_context *event_ctx,
+ struct loadparm_context *lp_ctx,
struct server_id server_id, void *private)
{
struct task_state *state = talloc_get_type(private, struct task_state);
@@ -64,7 +65,7 @@ static void task_server_callback(struct event_context *event_ctx,
task->event_ctx = event_ctx;
task->model_ops = state->model_ops;
task->server_id = server_id;
- task->lp_ctx = global_loadparm;
+ task->lp_ctx = lp_ctx;
task->msg_ctx = messaging_init(task,
lp_messaging_path(task, task->lp_ctx),
@@ -83,6 +84,7 @@ static void task_server_callback(struct event_context *event_ctx,
startup a task based server
*/
NTSTATUS task_server_startup(struct event_context *event_ctx,
+ struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
void (*task_init)(struct task_server *))
{
@@ -94,7 +96,7 @@ NTSTATUS task_server_startup(struct event_context *event_ctx,
state->task_init = task_init;
state->model_ops = model_ops;
- model_ops->new_task(event_ctx, task_server_callback, state);
+ model_ops->new_task(event_ctx, lp_ctx, task_server_callback, state);
return NT_STATUS_OK;
}