From e95942ed84fef4dd34c380d59145d3e182b01702 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 May 2007 20:56:39 +0000 Subject: [PATCH] r22954: More messaging_register (This used to be commit 9b8df24107ffe3016031e5257c5680689f061886) --- source3/printing/nt_printing.c | 9 +++++---- source3/printing/printing.c | 18 ++++++++++-------- source3/rpc_server/srv_spoolss_nt.c | 24 ++++++++++++++++-------- source3/smbd/server.c | 2 +- source3/utils/net_ads.c | 6 ------ 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 965793b3cf3..84dba9d55a7 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -542,7 +542,7 @@ static BOOL upgrade_to_version_5(void) Open the NT printing tdbs. Done once before fork(). ****************************************************************************/ -BOOL nt_printing_init(void) +BOOL nt_printing_init(struct messaging_context *msg_ctx) { const char *vstring = "INFO/version"; WERROR win_rc; @@ -631,15 +631,16 @@ BOOL nt_printing_init(void) * drivers are installed */ - message_register(MSG_PRINTER_DRVUPGRADE, do_drv_upgrade_printer, NULL); + messaging_register(msg_ctx, NULL, MSG_PRINTER_DRVUPGRADE, + do_drv_upgrade_printer); /* * register callback to handle updating printer data * when a driver is initialized */ - message_register(MSG_PRINTERDATA_INIT_RESET, reset_all_printerdata, - NULL); + messaging_register(msg_ctx, NULL, MSG_PRINTERDATA_INIT_RESET, + reset_all_printerdata); /* 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 9bae768c199..6717f473cc5 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -178,7 +178,7 @@ static int get_queue_status(const char* sharename, print_status_struct *); Initialise the printing backend. Called once at startup before the fork(). ****************************************************************************/ -BOOL print_backend_init(void) +BOOL print_backend_init(struct messaging_context *msg_ctx) { const char *sversion = "INFO/version"; pstring printing_path; @@ -215,7 +215,7 @@ BOOL print_backend_init(void) close_all_print_db(); /* Don't leave any open. */ /* do NT print initialization... */ - return nt_printing_init(); + return nt_printing_init(msg_ctx); } /**************************************************************************** @@ -1348,16 +1348,18 @@ 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 server_id src, - void *buf, size_t msglen, - void *private_data) +static void print_queue_receive(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) { fstring sharename; pstring lpqcommand, lprmcommand; int printing_type; size_t len; - len = tdb_unpack( (uint8 *)buf, msglen, "fdPP", + len = tdb_unpack( (uint8 *)data->data, data->length, "fdPP", sharename, &printing_type, lpqcommand, @@ -1401,8 +1403,8 @@ void start_background_queue(void) exit(1); } - message_register(MSG_PRINTER_UPDATE, print_queue_receive, - NULL); + messaging_register(smbd_messaging_context(), NULL, + MSG_PRINTER_UPDATE, print_queue_receive); DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); while (1) { diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index e2dd773c042..49782dca43d 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -1225,15 +1225,19 @@ 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 server_id src, - void *buf, size_t len, void *private_data) +void do_drv_upgrade_printer(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) { fstring drivername; int snum; int n_services = lp_numservices(); + size_t len; - len = MIN(len,sizeof(drivername)-1); - strncpy(drivername, (const char *)buf, len); + len = MIN(data->length,sizeof(drivername)-1); + strncpy(drivername, (const char *)data->data, len); DEBUG(10,("do_drv_upgrade_printer: Got message for new driver [%s]\n", drivername )); @@ -1324,15 +1328,19 @@ static BOOL srv_spoolss_reset_printerdata(char* drivername) over all printers, resetting printer data as neessary **********************************************************************/ -void reset_all_printerdata(int msg_type, struct server_id src, - void *buf, size_t len, void *private_data) +void reset_all_printerdata(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) { fstring drivername; int snum; int n_services = lp_numservices(); + size_t len; - len = MIN( len, sizeof(drivername)-1 ); - strncpy( drivername, (const char *)buf, len ); + len = MIN( data->length, sizeof(drivername)-1 ); + strncpy( drivername, (const char *)data->data, len ); DEBUG(10,("reset_all_printerdata: Got message for new driver [%s]\n", drivername )); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index a54bed3e1b8..7a139afa476 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1029,7 +1029,7 @@ extern void build_options(BOOL screen); exit(1); #endif - if (!print_backend_init()) + if (!print_backend_init(smbd_messaging_context())) exit(1); if (!init_guest_info()) { diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index a9319a380cc..a1206bbd524 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1921,12 +1921,6 @@ static int net_ads_printer_info(int argc, const char **argv) return 0; } -void do_drv_upgrade_printer(int msg_type, struct server_id src, - void *buf, size_t len, void *private_data) -{ - return; -} - static int net_ads_printer_publish(int argc, const char **argv) { ADS_STRUCT *ads; -- 2.11.4.GIT