summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-01-30 22:22:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:32 -0500
commitcaf8c6a76be051559ffcfe97084edca43e0a3cee (patch)
treecbab678e47d5174ba24bca915e47992e2b8d8206 /source3/smbd
parentcb916d33f534aef5e3527c41555d32c319345fef (diff)
downloadsamba-caf8c6a76be051559ffcfe97084edca43e0a3cee.tar.gz
samba-caf8c6a76be051559ffcfe97084edca43e0a3cee.tar.bz2
samba-caf8c6a76be051559ffcfe97084edca43e0a3cee.zip
r21064: The core of this patch is
void message_register(int msg_type, void (*fn)(int msg_type, struct process_id pid, - void *buf, size_t len)) + void *buf, size_t len, + void *private_data), + void *private_data) { struct dispatch_fns *dfn; So this adds a (so far unused) private pointer that is passed from message_register to the message handler. A prerequisite to implement a tiny samba4-API compatible wrapper around our messaging system. That itself is necessary for the Samba4 notify system. Yes, I know, I could import the whole Samba4 messaging system, but I want to do it step by step and I think getting notify in is more important in this step. Volker (This used to be commit c8ae60ed65dcce9660ee39c75488f2838cf9a28b)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/blocking.c18
-rw-r--r--source3/smbd/conn.c3
-rw-r--r--source3/smbd/notify.c5
-rw-r--r--source3/smbd/open.c3
-rw-r--r--source3/smbd/oplock.c30
-rw-r--r--source3/smbd/server.c30
6 files changed, 55 insertions, 34 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index e0478fa762..70b2d30aab 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -71,7 +71,8 @@ static BOOL in_chained_smb(void)
}
static void received_unlock_msg(int msg_type, struct process_id src,
- void *buf, size_t len);
+ void *buf, size_t len,
+ void *private_data);
/****************************************************************************
Function to push a blocking lock request onto the lock queue.
@@ -154,7 +155,8 @@ BOOL push_blocking_lock_request( struct byte_range_lock *br_lck,
/* Ensure we'll receive messages when this is unlocked. */
if (!set_lock_msg) {
- message_register(MSG_SMB_UNLOCK, received_unlock_msg);
+ message_register(MSG_SMB_UNLOCK, received_unlock_msg,
+ NULL);
set_lock_msg = True;
}
@@ -581,7 +583,8 @@ BOOL blocking_lock_was_deferred(int mid)
*****************************************************************************/
static void received_unlock_msg(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len,
+ void *private_data)
{
DEBUG(10,("received_unlock_msg\n"));
process_blocking_lock_queue();
@@ -775,8 +778,10 @@ void process_blocking_lock_queue(void)
#define MSG_BLOCKING_LOCK_CANCEL_SIZE (sizeof(blocking_lock_record *) + sizeof(NTSTATUS))
-static void process_blocking_lock_cancel_message(int msg_type, struct process_id src,
- void *buf, size_t len)
+static void process_blocking_lock_cancel_message(int msg_type,
+ struct process_id src,
+ void *buf, size_t len,
+ void *private_data)
{
NTSTATUS err;
const char *msg = (const char *)buf;
@@ -822,7 +827,8 @@ BOOL blocking_lock_cancel(files_struct *fsp,
if (!initialized) {
/* Register our message. */
message_register(MSG_SMB_BLOCKING_LOCK_CANCEL,
- process_blocking_lock_cancel_message);
+ process_blocking_lock_cancel_message,
+ NULL);
initialized = True;
}
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 083e8339c8..44888b777f 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -311,7 +311,8 @@ the message contains just a share name and all instances of that
share are unmounted
the special sharename '*' forces unmount of all shares
****************************************************************************/
-void msg_force_tdis(int msg_type, struct process_id pid, void *buf, size_t len)
+void msg_force_tdis(int msg_type, struct process_id pid, void *buf, size_t len,
+ void *private_data)
{
connection_struct *conn, *next;
fstring sharename;
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c
index c2f4572e7e..d920633b0a 100644
--- a/source3/smbd/notify.c
+++ b/source3/smbd/notify.c
@@ -498,7 +498,8 @@ void notify_fsp(files_struct *fsp, uint32 action, char *name)
}
static void notify_message_callback(int msgtype, struct process_id pid,
- void *buf, size_t len)
+ void *buf, size_t len,
+ void *private_data)
{
struct notify_message msg;
files_struct *fsp;
@@ -548,7 +549,7 @@ BOOL init_change_notify(void)
return False;
}
- message_register(MSG_SMB_NOTIFY, notify_message_callback);
+ message_register(MSG_SMB_NOTIFY, notify_message_callback, NULL);
return True;
}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index a5a8eacda0..529677a5f3 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2210,7 +2210,8 @@ NTSTATUS open_file_stat(connection_struct *conn, const char *fname,
smbd process.
****************************************************************************/
-void msg_file_was_renamed(int msg_type, struct process_id src, void *buf, size_t len)
+void msg_file_was_renamed(int msg_type, struct process_id src,
+ void *buf, size_t len, void *private_data)
{
files_struct *fsp;
char *frm = (char *)buf;
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 1f73ea837d..7b82a9ad9c 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -392,7 +392,8 @@ static void add_oplock_timeout_handler(files_struct *fsp)
*******************************************************************/
static void process_oplock_async_level2_break_message(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len,
+ void *private_data)
{
struct share_mode_entry msg;
files_struct *fsp;
@@ -478,7 +479,8 @@ static void process_oplock_async_level2_break_message(int msg_type, struct proce
*******************************************************************/
static void process_oplock_break_message(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len,
+ void *private_data)
{
struct share_mode_entry msg;
files_struct *fsp;
@@ -586,7 +588,8 @@ static void process_oplock_break_message(int msg_type, struct process_id src,
*******************************************************************/
static void process_kernel_oplock_break(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len,
+ void *private_data)
{
SMB_DEV_T dev;
SMB_INO_T inode;
@@ -677,7 +680,8 @@ void reply_to_oplock_break_requests(files_struct *fsp)
}
static void process_oplock_break_response(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len,
+ void *private_data)
{
struct share_mode_entry msg;
@@ -704,7 +708,8 @@ static void process_oplock_break_response(int msg_type, struct process_id src,
}
static void process_open_retry_message(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len,
+ void *private_data)
{
struct share_mode_entry msg;
@@ -858,15 +863,20 @@ BOOL init_oplocks(void)
DEBUG(3,("init_oplocks: initializing messages.\n"));
message_register(MSG_SMB_BREAK_REQUEST,
- process_oplock_break_message);
+ process_oplock_break_message,
+ NULL);
message_register(MSG_SMB_ASYNC_LEVEL2_BREAK,
- process_oplock_async_level2_break_message);
+ process_oplock_async_level2_break_message,
+ NULL);
message_register(MSG_SMB_BREAK_RESPONSE,
- process_oplock_break_response);
+ process_oplock_break_response,
+ NULL);
message_register(MSG_SMB_KERNEL_BREAK,
- process_kernel_oplock_break);
+ process_kernel_oplock_break,
+ NULL);
message_register(MSG_SMB_OPEN_RETRY,
- process_open_retry_message);
+ process_open_retry_message,
+ NULL);
if (lp_kernel_oplocks()) {
#if HAVE_KERNEL_OPLOCKS_IRIX
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 0bb4ad5b04..dcb685511b 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -76,7 +76,7 @@ struct event_context *smbd_event_context(void)
********************************************************************/
static void smb_conf_updated(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len, void *private_data)
{
DEBUG(10,("smb_conf_updated: Got message saying smb.conf was updated. Reloading.\n"));
reload_services(False);
@@ -88,7 +88,7 @@ static void smb_conf_updated(int msg_type, struct process_id src,
********************************************************************/
static void smb_stat_cache_delete(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len, void *private_data)
{
const char *name = (const char *)buf;
DEBUG(10,("smb_stat_cache_delete: delete name %s\n", name));
@@ -139,7 +139,8 @@ static void killkids(void)
****************************************************************************/
static void msg_sam_sync(int UNUSED(msg_type), struct process_id UNUSED(pid),
- void *UNUSED(buf), size_t UNUSED(len))
+ void *UNUSED(buf), size_t UNUSED(len),
+ void *private_data)
{
DEBUG(10, ("** sam sync message received, ignoring\n"));
}
@@ -150,7 +151,7 @@ static void msg_sam_sync(int UNUSED(msg_type), struct process_id UNUSED(pid),
****************************************************************************/
static void msg_sam_repl(int msg_type, struct process_id pid,
- void *buf, size_t len)
+ void *buf, size_t len, void *private_data)
{
uint32 low_serial;
@@ -184,7 +185,7 @@ static BOOL open_sockets_inetd(void)
}
static void msg_exit_server(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len, void *private_data)
{
DEBUG(3, ("got a SHUTDOWN message\n"));
exit_server_cleanly(NULL);
@@ -192,7 +193,7 @@ static void msg_exit_server(int msg_type, struct process_id src,
#ifdef DEVELOPER
static void msg_inject_fault(int msg_type, struct process_id src,
- void *buf, size_t len)
+ void *buf, size_t len, void *private_data)
{
int sig;
@@ -429,15 +430,16 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_
/* Listen to messages */
- message_register(MSG_SMB_SAM_SYNC, msg_sam_sync);
- message_register(MSG_SMB_SAM_REPL, msg_sam_repl);
- message_register(MSG_SHUTDOWN, msg_exit_server);
- message_register(MSG_SMB_FILE_RENAME, msg_file_was_renamed);
- message_register(MSG_SMB_CONF_UPDATED, smb_conf_updated);
- message_register(MSG_SMB_STAT_CACHE_DELETE, smb_stat_cache_delete);
+ message_register(MSG_SMB_SAM_SYNC, msg_sam_sync, NULL);
+ message_register(MSG_SMB_SAM_REPL, msg_sam_repl, NULL);
+ message_register(MSG_SHUTDOWN, msg_exit_server, NULL);
+ message_register(MSG_SMB_FILE_RENAME, msg_file_was_renamed, NULL);
+ message_register(MSG_SMB_CONF_UPDATED, smb_conf_updated, NULL);
+ message_register(MSG_SMB_STAT_CACHE_DELETE, smb_stat_cache_delete,
+ NULL);
#ifdef DEVELOPER
- message_register(MSG_SMB_INJECT_FAULT, msg_inject_fault);
+ message_register(MSG_SMB_INJECT_FAULT, msg_inject_fault, NULL);
#endif
/* now accept incoming connections - forking a new process
@@ -1097,7 +1099,7 @@ extern void build_options(BOOL screen);
TimeInit();
/* register our message handlers */
- message_register(MSG_SMB_FORCE_TDIS, msg_force_tdis);
+ message_register(MSG_SMB_FORCE_TDIS, msg_force_tdis, NULL);
smbd_process();