From caf8c6a76be051559ffcfe97084edca43e0a3cee Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 30 Jan 2007 22:22:06 +0000 Subject: 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) --- source3/utils/net_ads.c | 2 +- source3/utils/smbcontrol.c | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'source3/utils') 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; -- cgit