diff options
author | Volker Lendecke <vlendec@samba.org> | 2007-01-30 22:22:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:32 -0500 |
commit | caf8c6a76be051559ffcfe97084edca43e0a3cee (patch) | |
tree | cbab678e47d5174ba24bca915e47992e2b8d8206 /source3 | |
parent | cb916d33f534aef5e3527c41555d32c319345fef (diff) | |
download | samba-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')
-rw-r--r-- | source3/lib/debug.c | 8 | ||||
-rw-r--r-- | source3/lib/dmallocmsg.c | 14 | ||||
-rw-r--r-- | source3/lib/messages.c | 17 | ||||
-rw-r--r-- | source3/lib/tallocmsg.c | 5 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 18 | ||||
-rw-r--r-- | source3/nmbd/nmbd_elections.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_winsserver.c | 2 | ||||
-rw-r--r-- | source3/nsswitch/winbindd.c | 19 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_cm.c | 12 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_dual.c | 25 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 5 | ||||
-rw-r--r-- | source3/printing/printing.c | 6 | ||||
-rw-r--r-- | source3/profile/profile.c | 9 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 11 | ||||
-rw-r--r-- | source3/smbd/blocking.c | 18 | ||||
-rw-r--r-- | source3/smbd/conn.c | 3 | ||||
-rw-r--r-- | source3/smbd/notify.c | 5 | ||||
-rw-r--r-- | source3/smbd/open.c | 3 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 30 | ||||
-rw-r--r-- | source3/smbd/server.c | 30 | ||||
-rw-r--r-- | source3/torture/msgtest.c | 5 | ||||
-rw-r--r-- | source3/utils/net_ads.c | 2 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 25 |
23 files changed, 166 insertions, 108 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 00f6b0e72f..5f14166110 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -472,7 +472,7 @@ BOOL debug_parse_levels(const char *params_str) ****************************************************************************/ static void debug_message(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { const char *params_str = (const char *)buf; @@ -509,7 +509,7 @@ void debug_message_send(pid_t pid, const char *params_str) ****************************************************************************/ static void debuglevel_message(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { char *message = debug_list_class_names_and_levels(); @@ -539,8 +539,8 @@ void debug_init(void) initialised = True; - message_register(MSG_DEBUG, debug_message); - message_register(MSG_REQ_DEBUGLEVEL, debuglevel_message); + message_register(MSG_DEBUG, debug_message, NULL); + message_register(MSG_REQ_DEBUGLEVEL, debuglevel_message, NULL); for(p = default_classname_table; *p; p++) { debug_add_class(*p); diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index 1b2308ecba..fed7bf59c5 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -35,8 +35,10 @@ static unsigned long our_dm_mark = 0; * Respond to a POOL_USAGE message by sending back string form of memory * usage stats. **/ -static void msg_req_dmalloc_mark(int UNUSED(msg_type), struct process_id UNUSED(src_pid), - void *UNUSED(buf), size_t UNUSED(len)) +static void msg_req_dmalloc_mark(int UNUSED(msg_type), + struct process_id UNUSED(src_pid), + void *UNUSED(buf), size_t UNUSED(len), + void *private_data) { #ifdef ENABLE_DMALLOC our_dm_mark = dmalloc_mark(); @@ -50,7 +52,8 @@ static void msg_req_dmalloc_mark(int UNUSED(msg_type), struct process_id UNUSED( static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), struct process_id UNUSED(src_pid), - void *UNUSED(buf), size_t UNUSED(len)) + void *UNUSED(buf), size_t UNUSED(len), + void *private_data) { #ifdef ENABLE_DMALLOC dmalloc_log_changed(our_dm_mark, True, True, True); @@ -66,7 +69,8 @@ static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), **/ void register_dmalloc_msgs(void) { - message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark); - message_register(MSG_REQ_DMALLOC_LOG_CHANGED, msg_req_dmalloc_log_changed); + message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark, NULL); + message_register(MSG_REQ_DMALLOC_LOG_CHANGED, + msg_req_dmalloc_log_changed, NULL); DEBUG(2, ("Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED\n")); } diff --git a/source3/lib/messages.c b/source3/lib/messages.c index de17a03afc..d231373475 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -66,7 +66,9 @@ struct message_rec { static struct dispatch_fns { struct dispatch_fns *next, *prev; int msg_type; - void (*fn)(int msg_type, struct process_id pid, void *buf, size_t len); + void (*fn)(int msg_type, struct process_id pid, void *buf, size_t len, + void *private_data); + void *private_data; } *dispatch_fns; /**************************************************************************** @@ -102,7 +104,7 @@ static void sig_usr1(void) ****************************************************************************/ static void ping_message(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { const char *msg = buf ? (const char *)buf : "none"; @@ -133,7 +135,7 @@ BOOL message_init(void) CatchSignal(SIGUSR1, SIGNAL_CAST sig_usr1); - message_register(MSG_PING, ping_message); + message_register(MSG_PING, ping_message, NULL); /* Register some debugging related messages */ @@ -493,7 +495,9 @@ void message_dispatch(void) for (dfn = dispatch_fns; dfn; dfn = dfn->next) { if (dfn->msg_type == msg_type) { DEBUG(10,("message_dispatch: processing message of type %d.\n", msg_type)); - dfn->fn(msg_type, src, len ? (void *)buf : NULL, len); + dfn->fn(msg_type, src, + len ? (void *)buf : NULL, len, + dfn->private_data); n_handled++; break; } @@ -516,7 +520,9 @@ void message_dispatch(void) 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; @@ -535,6 +541,7 @@ void message_register(int msg_type, dfn->msg_type = msg_type; dfn->fn = fn; + dfn->private_data = private_data; DLIST_ADD(dispatch_fns, dfn); } diff --git a/source3/lib/tallocmsg.c b/source3/lib/tallocmsg.c index e4e9bac94d..0f493538f3 100644 --- a/source3/lib/tallocmsg.c +++ b/source3/lib/tallocmsg.c @@ -66,7 +66,8 @@ static void msg_pool_usage_helper(const void *ptr, int depth, int max_depth, int * usage stats. **/ void msg_pool_usage(int msg_type, struct process_id src_pid, - void *UNUSED(buf), size_t UNUSED(len)) + void *UNUSED(buf), size_t UNUSED(len), + void *private_data) { struct msg_pool_usage_state state; @@ -100,6 +101,6 @@ void msg_pool_usage(int msg_type, struct process_id src_pid, **/ void register_msg_pool_usage(void) { - message_register(MSG_REQ_POOL_USAGE, msg_pool_usage); + message_register(MSG_REQ_POOL_USAGE, msg_pool_usage, NULL); DEBUG(2, ("Registered MSG_REQ_POOL_USAGE\n")); } diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 4a05fde28c..46f209872b 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -77,7 +77,7 @@ static void terminate(void) **************************************************************************** */ static void nmbd_terminate(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { terminate(); } @@ -272,7 +272,7 @@ static BOOL reload_nmbd_services(BOOL test) **************************************************************************** */ static void msg_reload_nmbd_services(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { write_browse_list( 0, True ); dump_all_namelists(); @@ -289,7 +289,7 @@ static void msg_reload_nmbd_services(int msg_type, struct process_id src, } static void msg_nmbd_send_packet(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { struct packet_struct *p = (struct packet_struct *)buf; struct subnet_record *subrec; @@ -558,7 +558,7 @@ static void process(void) if(reload_after_sighup) { DEBUG( 0, ( "Got SIGHUP dumping debug info.\n" ) ); msg_reload_nmbd_services(MSG_SMB_CONF_UPDATED, - pid_to_procid(0), (void*) &no_subnets, 0); + pid_to_procid(0), (void*) &no_subnets, 0, NULL); if(no_subnets) return; reload_after_sighup = 0; @@ -745,14 +745,14 @@ static BOOL open_sockets(BOOL isdaemon, int port) pidfile_create("nmbd"); message_init(); - message_register(MSG_FORCE_ELECTION, nmbd_message_election); + message_register(MSG_FORCE_ELECTION, nmbd_message_election, NULL); #if 0 /* Until winsrepl is done. */ - message_register(MSG_WINS_NEW_ENTRY, nmbd_wins_new_entry); + message_register(MSG_WINS_NEW_ENTRY, nmbd_wins_new_entry, NULL); #endif - message_register(MSG_SHUTDOWN, nmbd_terminate); - message_register(MSG_SMB_CONF_UPDATED, msg_reload_nmbd_services); - message_register(MSG_SEND_PACKET, msg_nmbd_send_packet); + message_register(MSG_SHUTDOWN, nmbd_terminate, NULL); + message_register(MSG_SMB_CONF_UPDATED, msg_reload_nmbd_services, NULL); + message_register(MSG_SEND_PACKET, msg_nmbd_send_packet, NULL); TimeInit(); diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c index 50e1372936..3aadd70b83 100644 --- a/source3/nmbd/nmbd_elections.c +++ b/source3/nmbd/nmbd_elections.c @@ -379,7 +379,7 @@ yet registered on subnet %s\n", nmb_namestr(&nmbname), subrec->subnet_name )); ***************************************************************************/ void nmbd_message_election(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { struct subnet_record *subrec; diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index 320415503b..6ea102c391 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -2371,7 +2371,7 @@ void wins_write_database(time_t t, BOOL background) ***************************************************************************/ void nmbd_wins_new_entry(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { WINS_RECORD *record; struct name_record *namerec = NULL; diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index c44750ec6f..9a4d7e3aed 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -174,7 +174,8 @@ static void sigchld_handler(int signum) } /* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/ -static void msg_reload_services(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_reload_services(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { /* Flush various caches */ flush_caches(); @@ -182,7 +183,8 @@ static void msg_reload_services(int msg_type, struct process_id src, void *buf, } /* React on 'smbcontrol winbindd shutdown' in the same way as on SIGTERM*/ -static void msg_shutdown(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_shutdown(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { do_sigterm = True; } @@ -877,7 +879,7 @@ static void process_loop(void) DEBUG(3, ("got SIGHUP\n")); - msg_reload_services(MSG_SMB_CONF_UPDATED, pid_to_procid(0), NULL, 0); + msg_reload_services(MSG_SMB_CONF_UPDATED, pid_to_procid(0), NULL, 0, NULL); do_sighup = False; } @@ -1075,13 +1077,14 @@ int main(int argc, char **argv, char **envp) /* React on 'smbcontrol winbindd reload-config' in the same way as to SIGHUP signal */ - message_register(MSG_SMB_CONF_UPDATED, msg_reload_services); - message_register(MSG_SHUTDOWN, msg_shutdown); + message_register(MSG_SMB_CONF_UPDATED, msg_reload_services, NULL); + message_register(MSG_SHUTDOWN, msg_shutdown, NULL); /* Handle online/offline messages. */ - message_register(MSG_WINBIND_OFFLINE,winbind_msg_offline); - message_register(MSG_WINBIND_ONLINE,winbind_msg_online); - message_register(MSG_WINBIND_ONLINESTATUS,winbind_msg_onlinestatus); + message_register(MSG_WINBIND_OFFLINE, winbind_msg_offline, NULL); + message_register(MSG_WINBIND_ONLINE, winbind_msg_online, NULL); + message_register(MSG_WINBIND_ONLINESTATUS, winbind_msg_onlinestatus, + NULL); poptFreeContext(pc); diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index 2875e725e4..35017d39a4 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -82,7 +82,8 @@ static BOOL get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain, Child failed to find DC's. Reschedule check. ****************************************************************/ -static void msg_failed_to_go_online(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_failed_to_go_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -117,7 +118,8 @@ static void msg_failed_to_go_online(int msg_type, struct process_id src, void *b Actually cause a reconnect from a message. ****************************************************************/ -static void msg_try_to_go_online(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_try_to_go_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -182,8 +184,10 @@ static BOOL fork_child_dc_connect(struct winbindd_domain *domain) if (child_pid != 0) { /* Parent */ - message_register(MSG_WINBIND_TRY_TO_GO_ONLINE,msg_try_to_go_online); - message_register(MSG_WINBIND_FAILED_TO_GO_ONLINE,msg_failed_to_go_online); + message_register(MSG_WINBIND_TRY_TO_GO_ONLINE, + msg_try_to_go_online, NULL); + message_register(MSG_WINBIND_FAILED_TO_GO_ONLINE, + msg_failed_to_go_online, NULL); message_unblock(); return True; } diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c index 22786df601..0dacf4c385 100644 --- a/source3/nsswitch/winbindd_dual.c +++ b/source3/nsswitch/winbindd_dual.c @@ -476,7 +476,8 @@ void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain) /* Set our domains as offline and forward the offline message to our children. */ -void winbind_msg_offline(int msg_type, struct process_id src, void *buf, size_t len) +void winbind_msg_offline(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_child *child; struct winbindd_domain *domain; @@ -527,7 +528,8 @@ void winbind_msg_offline(int msg_type, struct process_id src, void *buf, size_t /* Set our domains as online and forward the online message to our children. */ -void winbind_msg_online(int msg_type, struct process_id src, void *buf, size_t len) +void winbind_msg_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_child *child; struct winbindd_domain *domain; @@ -579,7 +581,8 @@ void winbind_msg_online(int msg_type, struct process_id src, void *buf, size_t l } /* Forward the online/offline messages to our children. */ -void winbind_msg_onlinestatus(int msg_type, struct process_id src, void *buf, size_t len) +void winbind_msg_onlinestatus(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_child *child; @@ -641,7 +644,8 @@ static void account_lockout_policy_handler(struct event_context *ctx, /* Deal with a request to go offline. */ -static void child_msg_offline(int msg_type, struct process_id src, void *buf, size_t len) +static void child_msg_offline(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -678,7 +682,8 @@ static void child_msg_offline(int msg_type, struct process_id src, void *buf, si /* Deal with a request to go online. */ -static void child_msg_online(int msg_type, struct process_id src, void *buf, size_t len) +static void child_msg_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -739,7 +744,8 @@ static const char *collect_onlinestatus(TALLOC_CTX *mem_ctx) return buf; } -static void child_msg_onlinestatus(int msg_type, struct process_id src, void *buf, size_t len) +static void child_msg_onlinestatus(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { TALLOC_CTX *mem_ctx; const char *message; @@ -843,9 +849,10 @@ static BOOL fork_domain_child(struct winbindd_child *child) message_unblock(); /* Handle online/offline messages. */ - message_register(MSG_WINBIND_OFFLINE,child_msg_offline); - message_register(MSG_WINBIND_ONLINE,child_msg_online); - message_register(MSG_WINBIND_ONLINESTATUS,child_msg_onlinestatus); + message_register(MSG_WINBIND_OFFLINE, child_msg_offline, NULL); + message_register(MSG_WINBIND_ONLINE, child_msg_online, NULL); + message_register(MSG_WINBIND_ONLINESTATUS, child_msg_onlinestatus, + NULL); if ( child->domain ) { child->domain->startup = True; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index aa9075c7db..e415cd41b2 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -629,14 +629,15 @@ BOOL nt_printing_init(void) * drivers are installed */ - message_register( MSG_PRINTER_DRVUPGRADE, do_drv_upgrade_printer ); + message_register(MSG_PRINTER_DRVUPGRADE, do_drv_upgrade_printer, NULL); /* * register callback to handle updating printer data * when a driver is initialized */ - message_register( MSG_PRINTERDATA_INIT_RESET, reset_all_printerdata ); + message_register(MSG_PRINTERDATA_INIT_RESET, reset_all_printerdata, + NULL); /* of course, none of the message callbacks matter if you don't tell messages.c that you interested in receiving PRINT_GENERAL diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 2f1d123a20..588641358f 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1352,7 +1352,8 @@ static void print_queue_update_with_lock( const char *sharename, this is the receive function of the background lpq updater ****************************************************************************/ static void print_queue_receive(int msg_type, struct process_id src, - void *buf, size_t msglen) + void *buf, size_t msglen, + void *private_data) { fstring sharename; pstring lpqcommand, lprmcommand; @@ -1403,7 +1404,8 @@ void start_background_queue(void) exit(1); } - message_register(MSG_PRINTER_UPDATE, print_queue_receive); + message_register(MSG_PRINTER_UPDATE, print_queue_receive, + NULL); DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); while (1) { diff --git a/source3/profile/profile.c b/source3/profile/profile.c index fe03bc04a3..8aaaee161d 100644 --- a/source3/profile/profile.c +++ b/source3/profile/profile.c @@ -44,7 +44,8 @@ BOOL do_profile_times = False; /**************************************************************************** receive a set profile level message ****************************************************************************/ -void profile_message(int msg_type, struct process_id src, void *buf, size_t len) +void profile_message(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { int level; @@ -97,7 +98,7 @@ void profile_message(int msg_type, struct process_id src, void *buf, size_t len) receive a request profile level message ****************************************************************************/ void reqprofile_message(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { int level; @@ -246,8 +247,8 @@ BOOL profile_setup(BOOL rdonly) } profile_p = &profile_h->stats; - message_register(MSG_PROFILE, profile_message); - message_register(MSG_REQ_PROFILELEVEL, reqprofile_message); + message_register(MSG_PROFILE, profile_message, NULL); + message_register(MSG_REQ_PROFILELEVEL, reqprofile_message, NULL); return True; } diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index b6af6b0b80..a655b7054b 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -1107,7 +1107,8 @@ static BOOL notify2_unpack_msg( SPOOLSS_NOTIFY_MSG *msg, struct timeval *tv, voi ********************************************************************/ static void receive_notify2_message_list(int msg_type, struct process_id src, - void *msg, size_t len) + void *msg, size_t len, + void *private_data) { size_t msg_count, i; char *buf = (char *)msg; @@ -1219,7 +1220,8 @@ static BOOL srv_spoolss_drv_upgrade_printer(char* drivername) over all printers, upgrading ones as necessary **********************************************************************/ -void do_drv_upgrade_printer(int msg_type, struct process_id src, void *buf, size_t len) +void do_drv_upgrade_printer(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { fstring drivername; int snum; @@ -1317,7 +1319,7 @@ static BOOL srv_spoolss_reset_printerdata(char* drivername) **********************************************************************/ void reset_all_printerdata(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { fstring drivername; int snum; @@ -2597,7 +2599,8 @@ static BOOL srv_spoolss_replyopenprinter(int snum, const char *printer, if ( !spoolss_connect_to_client( ¬ify_cli_pipe, client_ip, unix_printer )) return False; - message_register(MSG_PRINTER_NOTIFY2, receive_notify2_message_list); + message_register(MSG_PRINTER_NOTIFY2, + receive_notify2_message_list, NULL); /* Tell the connections db we're now interested in printer * notify messages. */ register_message_flags( True, FLAG_MSG_PRINT_NOTIFY ); 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(); diff --git a/source3/torture/msgtest.c b/source3/torture/msgtest.c index d913c4903f..ad1b35a9dd 100644 --- a/source3/torture/msgtest.c +++ b/source3/torture/msgtest.c @@ -29,7 +29,8 @@ static int pong_count; /**************************************************************************** a useful function for testing the message system ****************************************************************************/ -static void pong_message(int msg_type, struct process_id src, void *buf, size_t len) +static void pong_message(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { pong_count++; } @@ -57,7 +58,7 @@ static void pong_message(int msg_type, struct process_id src, void *buf, size_t pid = atoi(argv[1]); n = atoi(argv[2]); - message_register(MSG_PONG, pong_message); + message_register(MSG_PONG, pong_message, NULL); for (i=0;i<n;i++) { message_send_pid(pid_to_procid(pid), MSG_PING, NULL, 0, True); diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 48127f6c8a..f2fa807322 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1802,7 +1802,7 @@ static int net_ads_printer_info(int argc, const char **argv) } void do_drv_upgrade_printer(int msg_type, struct process_id src, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { return; } diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 9ca304c62b..26e2b82ae6 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -98,7 +98,8 @@ static void wait_replies(BOOL multiple_replies) /* Message handler callback that displays the PID and a string on stdout */ -static void print_pid_string_cb(int msg_type, struct process_id pid, void *buf, size_t len) +static void print_pid_string_cb(int msg_type, struct process_id pid, void *buf, + size_t len, void *private_data) { printf("PID %u: %.*s", (unsigned int)procid_to_pid(&pid), (int)len, (const char *)buf); @@ -108,7 +109,7 @@ static void print_pid_string_cb(int msg_type, struct process_id pid, void *buf, /* Message handler callback that displays a string on stdout */ static void print_string_cb(int msg_type, struct process_id pid, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { printf("%.*s", (int)len, (const char *)buf); num_replies++; @@ -371,7 +372,8 @@ static BOOL do_election(const struct process_id pid, /* Ping a samba daemon process */ -static void pong_cb(int msg_type, struct process_id pid, void *buf, size_t len) +static void pong_cb(int msg_type, struct process_id pid, void *buf, + size_t len, void *private_data) { char *src_string = procid_str(NULL, &pid); printf("PONG from pid %s\n", src_string); @@ -391,7 +393,7 @@ static BOOL do_ping(const struct process_id pid, const int argc, const char **ar if (!send_message(pid, MSG_PING, NULL, 0, False)) return False; - message_register(MSG_PONG, pong_cb); + message_register(MSG_PONG, pong_cb, NULL); wait_replies(procid_to_pid(&pid) == 0); @@ -436,7 +438,8 @@ static BOOL do_profile(const struct process_id pid, /* Return the profiling level */ -static void profilelevel_cb(int msg_type, struct process_id pid, void *buf, size_t len) +static void profilelevel_cb(int msg_type, struct process_id pid, void *buf, + size_t len, void *private_data) { int level; const char *s; @@ -473,7 +476,7 @@ static void profilelevel_cb(int msg_type, struct process_id pid, void *buf, size } static void profilelevel_rqst(int msg_type, struct process_id pid, - void *buf, size_t len) + void *buf, size_t len, void *private_data) { int v = 0; @@ -495,8 +498,8 @@ static BOOL do_profilelevel(const struct process_id pid, if (!send_message(pid, MSG_REQ_PROFILELEVEL, NULL, 0, False)) return False; - message_register(MSG_PROFILELEVEL, profilelevel_cb); - message_register(MSG_REQ_PROFILELEVEL, profilelevel_rqst); + message_register(MSG_PROFILELEVEL, profilelevel_cb, NULL); + message_register(MSG_REQ_PROFILELEVEL, profilelevel_rqst, NULL); wait_replies(procid_to_pid(&pid) == 0); @@ -525,7 +528,7 @@ static BOOL do_debuglevel(const struct process_id pid, if (!send_message(pid, MSG_REQ_DEBUGLEVEL, NULL, 0, False)) return False; - message_register(MSG_DEBUGLEVEL, print_pid_string_cb); + message_register(MSG_DEBUGLEVEL, print_pid_string_cb, NULL); wait_replies(procid_to_pid(&pid) == 0); @@ -732,7 +735,7 @@ static BOOL do_poolusage(const struct process_id pid, return False; } - message_register(MSG_POOL_USAGE, print_string_cb); + message_register(MSG_POOL_USAGE, print_string_cb, NULL); /* Send a message and register our interest in a reply */ @@ -923,7 +926,7 @@ static BOOL do_winbind_onlinestatus(const struct process_id pid, return False; } - message_register(MSG_WINBIND_ONLINESTATUS, print_pid_string_cb); + message_register(MSG_WINBIND_ONLINESTATUS, print_pid_string_cb, NULL); if (!send_message(pid, MSG_WINBIND_ONLINESTATUS, &myid, sizeof(myid), False)) return False; |