r21064: The core of this patch is
authorVolker Lendecke <vlendec@samba.org>
Tue, 30 Jan 2007 22:22:06 +0000 (22:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:17:32 +0000 (12:17 -0500)
 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)

23 files changed:
source3/lib/debug.c
source3/lib/dmallocmsg.c
source3/lib/messages.c
source3/lib/tallocmsg.c
source3/nmbd/nmbd.c
source3/nmbd/nmbd_elections.c
source3/nmbd/nmbd_winsserver.c
source3/nsswitch/winbindd.c
source3/nsswitch/winbindd_cm.c
source3/nsswitch/winbindd_dual.c
source3/printing/nt_printing.c
source3/printing/printing.c
source3/profile/profile.c
source3/rpc_server/srv_spoolss_nt.c
source3/smbd/blocking.c
source3/smbd/conn.c
source3/smbd/notify.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/server.c
source3/torture/msgtest.c
source3/utils/net_ads.c
source3/utils/smbcontrol.c

index 00f6b0e72ff8a0af87995933b4979fd9f28f99e9..5f1416611067c96f1f50187895a63e74b8c9e533 100644 (file)
@@ -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);
index 1b2308ecba65307ea22f4f75aeb723c7b604b56d..fed7bf59c52165d4205bec0440f04b724557f929 100644 (file)
@@ -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"));
 }      
index de17a03afc19d9a59a6ea7389c905da42d1e0587..d2313734752e9155cf4c7b33d10ac700b9b2876c 100644 (file)
@@ -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);
        }
index e4e9bac94d672727b3dc960daef41159260a6f49..0f493538f3c104a21f27c7cc58fed2270ff3cd91 100644 (file)
@@ -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"));
 }      
index 4a05fde28c9b40400fb64b413292c63ba7405e42..46f209872b03555d4bad081affa96b9e85f12dad 100644 (file)
@@ -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();
 
index 50e13729361e2ca39660c3b934eb315bba03004b..3aadd70b83ccdee828b5aa2d1520ff4471c00c21 100644 (file)
@@ -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;
 
index 320415503b3ad83723fdd745c876f42a3c9bf19c..6ea102c391397b867d6d098eb65c3ac924113e00 100644 (file)
@@ -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;
index c44750ec6fa85522985e37c19729970b202322b4..9a4d7e3aedfffb63cf01614e670d7c80add211bc 100644 (file)
@@ -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);
 
index 2875e725e47ee16e87a9cd005b8c87562b4d6b55..35017d39a439642c7a65c636273675d753d25a53 100644 (file)
@@ -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;
        }
index 22786df601e0f2c58cbf68799b05cb069b92f4fb..0dacf4c385ee33ae8891ab2aeda101a27d959e14 100644 (file)
@@ -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;
index aa9075c7db30f9048b407ff2b98672e54d29de68..e415cd41b2a9ef454902c14a8f12929d8221f124 100644 (file)
@@ -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 
index 2f1d123a2001ea94bcfcef4982e8a5070b9cdc6f..588641358f38fea04e16d1a5c4a909d5494533b1 100644 (file)
@@ -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) {
index fe03bc04a390bd0cd9484cb62d43d1dd178a132a..8aaaee161d2af0abe7c937c2100519898f146de6 100644 (file)
@@ -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;
 }
 
index b6af6b0b80aebb92c98d590fabefd07dbf905d86..a655b7054b15ce4c24fd525e4fd0caf2ec8f8034 100644 (file)
@@ -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( &notify_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 );
index e0478fa762fedbef9e99ef03f6fa1a1da64d04b4..70b2d30aaba5b6185044089d6c1e0c2d0c12e619 100644 (file)
@@ -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;
        }
index 083e8339c80bfac4073e7057f84c2c9abed71fe5..44888b777f2e536b6d3014f7434a261f76d7d4df 100644 (file)
@@ -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;
index c2f4572e7ecd85ddd38da68d81bb3f9dae77b3ee..d920633b0aa66f1f7af125501f328b2e718aa421 100644 (file)
@@ -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;
 }
index a5a8eacda00f973af5315c682201110746396bf9..529677a5f3565ff047dd99c5fd66e228e7a16dbe 100644 (file)
@@ -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;
index 1f73ea837da03208f40570f0d8aa69d85d4720d1..7b82a9ad9c8cff30b7a5ecd400d1dd2fbffe6b4d 100644 (file)
@@ -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
index 0bb4ad5b04ee27fb59e05968731839b8a0e0885c..dcb685511bf72898fc32c85fdb3bc3757cbcd6cf 100644 (file)
@@ -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();
 
index d913c4903f39ea2e6fd53e2464547f48407e5fc8..ad1b35a9dd818822957897eb12bde4900c3175f8 100644 (file)
@@ -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);
index 48127f6c8a79de0f859535cdbf561a13eb33ff05..f2fa8073226d0ca1861cd3369142a488bc30c17e 100644 (file)
@@ -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;
 }
index 9ca304c62bd15ffb9f5731cbf67173207768452b..26e2b82ae68d2b28e13270337ad1dd2b50478a9d 100644 (file)
@@ -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;