summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-01-10 10:52:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:23 -0500
commit1cd4339b9a2786aa26691ca4f02fa93ab0958b88 (patch)
tree9b09324617e38a651de0a761b3c591fa7deff74a /source4/smbd
parent848e236516ccc15864f7c3d2e05a905f6a81678e (diff)
downloadsamba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.tar.gz
samba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.tar.bz2
samba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.zip
r20646: first preparations for cluster enablement. This changes "
uint32_t server_id to struct server_id server_id; which allows a server ID to have an node number. The node number will be zero in non-clustered case. This is the most basic hook needed for clustering, and ctdb. (This used to be commit 2365abaa991d57d68c6ebe9be608e01c907102eb)
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process_model.h5
-rw-r--r--source4/smbd/process_single.c9
-rw-r--r--source4/smbd/process_standard.c10
-rw-r--r--source4/smbd/service_stream.c9
-rw-r--r--source4/smbd/service_stream.h2
-rw-r--r--source4/smbd/service_task.c3
-rw-r--r--source4/smbd/service_task.h4
7 files changed, 24 insertions, 18 deletions
diff --git a/source4/smbd/process_model.h b/source4/smbd/process_model.h
index 27fac68bb9..a10f63f1c5 100644
--- a/source4/smbd/process_model.h
+++ b/source4/smbd/process_model.h
@@ -26,6 +26,7 @@
#define __PROCESS_MODEL_H__
#include "lib/socket/socket.h"
+#include "smbd/service_task.h"
/* modules can use the following to determine if the interface has changed
* please increment the version number after each interface change
@@ -46,12 +47,12 @@ struct model_ops {
/* function to accept new connection */
void (*accept_connection)(struct event_context *, struct socket_context *,
void (*)(struct event_context *, struct socket_context *,
- uint32_t , void *),
+ struct server_id , void *),
void *);
/* function to create a task */
void (*new_task)(struct event_context *,
- void (*)(struct event_context *, uint32_t, void *),
+ void (*)(struct event_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 9604302199..221cfb7807 100644
--- a/source4/smbd/process_single.c
+++ b/source4/smbd/process_single.c
@@ -25,6 +25,7 @@
#include "includes.h"
#include "smbd/process_model.h"
#include "system/filesys.h"
+#include "cluster/cluster.h"
/*
called when the process model is selected
@@ -39,7 +40,7 @@ static void single_model_init(struct event_context *ev)
static void single_accept_connection(struct event_context *ev,
struct socket_context *sock,
void (*new_conn)(struct event_context *, struct socket_context *,
- uint32_t , void *),
+ struct server_id , void *),
void *private)
{
NTSTATUS status;
@@ -61,18 +62,18 @@ static void single_accept_connection(struct event_context *ev,
talloc_steal(private, sock);
- new_conn(ev, sock2, socket_get_fd(sock2), private);
+ new_conn(ev, 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 *, uint32_t, void *),
+ void (*new_task)(struct event_context *, struct server_id, void *),
void *private)
{
static uint32_t taskid = 0x10000000;
- new_task(ev, taskid++, private);
+ new_task(ev, cluster_id(taskid++), private);
}
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index 0dc9274e21..074d988e1e 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -28,8 +28,8 @@
#include "lib/socket/socket.h"
#include "smbd/process_model.h"
#include "param/secrets.h"
-
#include "system/filesys.h"
+#include "cluster/cluster.h"
#ifdef HAVE_SETPROCTITLE
#ifdef HAVE_SETPROCTITLE_H
@@ -58,7 +58,7 @@ static void standard_model_init(struct event_context *ev)
static void standard_accept_connection(struct event_context *ev,
struct socket_context *sock,
void (*new_conn)(struct event_context *, struct socket_context *,
- uint32_t , void *),
+ struct server_id , void *),
void *private)
{
NTSTATUS status;
@@ -126,7 +126,7 @@ static void standard_accept_connection(struct event_context *ev,
talloc_free(s);
/* setup this new connection */
- new_conn(ev2, sock2, pid, private);
+ new_conn(ev2, 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 +141,7 @@ 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 *, uint32_t , void *),
+ void (*new_task)(struct event_context *, struct server_id , void *),
void *private)
{
pid_t pid;
@@ -179,7 +179,7 @@ static void standard_new_task(struct event_context *ev,
setproctitle("task server_id[%d]", pid);
/* setup this new connection */
- new_task(ev2, pid, private);
+ new_task(ev2, 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/service_stream.c b/source4/smbd/service_stream.c
index 725a3b5080..f3f3a67e78 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -28,6 +28,7 @@
#include "smbd/service.h"
#include "smbd/service_stream.h"
#include "lib/messaging/irpc.h"
+#include "cluster/cluster.h"
/* the range of ports to try for dcerpc over tcp endpoints */
#define SERVER_TCP_LOW_PORT 1024
@@ -134,7 +135,7 @@ NTSTATUS stream_new_connection_merge(struct event_context *ev,
srv_conn->private = private_data;
srv_conn->model_ops = model_ops;
srv_conn->socket = sock;
- srv_conn->server_id = 0;
+ srv_conn->server_id = cluster_id(0);
srv_conn->ops = stream_ops;
srv_conn->msg_ctx = msg_ctx;
srv_conn->event.ctx = ev;
@@ -151,7 +152,7 @@ NTSTATUS stream_new_connection_merge(struct event_context *ev,
*/
static void stream_new_connection(struct event_context *ev,
struct socket_context *sock,
- uint32_t server_id, void *private)
+ struct server_id server_id, void *private)
{
struct stream_socket *stream_socket = talloc_get_type(private, struct stream_socket);
struct stream_connection *srv_conn;
@@ -191,10 +192,10 @@ static void stream_new_connection(struct event_context *ev,
s = socket_get_my_addr(sock, ev);
if (s && c) {
const char *title;
- title = talloc_asprintf(s, "conn[%s] c[%s:%u] s[%s:%u] server_id[%d]",
+ title = talloc_asprintf(s, "conn[%s] c[%s:%u] s[%s:%u] server_id[%s]",
stream_socket->ops->name,
c->addr, c->port, s->addr, s->port,
- server_id);
+ cluster_id_string(s, server_id));
if (title) {
stream_connection_set_title(srv_conn, title);
}
diff --git a/source4/smbd/service_stream.h b/source4/smbd/service_stream.h
index 692e18bea5..03fdcf522e 100644
--- a/source4/smbd/service_stream.h
+++ b/source4/smbd/service_stream.h
@@ -37,7 +37,7 @@
struct stream_connection {
const struct stream_server_ops *ops;
const struct model_ops *model_ops;
- uint32_t server_id;
+ struct server_id server_id;
void *private;
struct {
diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c
index 2963bac425..06bd328386 100644
--- a/source4/smbd/service_task.c
+++ b/source4/smbd/service_task.c
@@ -50,7 +50,8 @@ struct task_state {
called by the process model code when the new task starts up. This then calls
the server specific startup code
*/
-static void task_server_callback(struct event_context *event_ctx, uint32_t server_id, void *private)
+static void task_server_callback(struct event_context *event_ctx,
+ struct server_id server_id, void *private)
{
struct task_state *state = talloc_get_type(private, struct task_state);
struct task_server *task;
diff --git a/source4/smbd/service_task.h b/source4/smbd/service_task.h
index c0adf08fd0..f89b5e65f9 100644
--- a/source4/smbd/service_task.h
+++ b/source4/smbd/service_task.h
@@ -27,8 +27,10 @@ struct task_server {
struct event_context *event_ctx;
const struct model_ops *model_ops;
struct messaging_context *msg_ctx;
- uint32_t server_id;
+ struct server_id server_id;
void *private;
};
+
+
#endif /* __SERVICE_TASK_H__ */