From 09627638224759c985f0636c5616b0357c91e450 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 10 Jun 2010 11:48:39 -0400 Subject: s3:misc make use of server_[event/messaging]_context directly Untangle these functions from smbd specific dependencies so they can be freely used in multiple servers. --- source3/printing/notify.c | 6 +++--- source3/printing/print_cups.c | 8 ++++---- source3/printing/printing.c | 13 +++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 33807f72ef..a18b2fd897 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -232,7 +232,7 @@ static void print_notify_event_send_messages(struct tevent_context *event_ctx, TALLOC_FREE(notify_event); change_to_root_user(); - print_notify_send_messages(smbd_messaging_context(), 0); + print_notify_send_messages(server_messaging_context(), 0); } /********************************************************************** @@ -326,9 +326,9 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer)); DLIST_ADD_END(notify_queue_head, pnqueue, struct notify_queue *); num_messages++; - if ((notify_event == NULL) && (smbd_event_context() != NULL)) { + if ((notify_event == NULL) && (server_event_context() != NULL)) { /* Add an event for 1 second's time to send this queue. */ - notify_event = tevent_add_timer(smbd_event_context(), NULL, + notify_event = tevent_add_timer(server_event_context(), NULL, timeval_current_ofs(1,0), print_notify_event_send_messages, NULL); } diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index 7366f85973..76a13cf3b4 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -434,8 +434,8 @@ static bool cups_pcap_load_async(int *pfd) close_all_print_db(); - if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(), - smbd_event_context(), true))) { + if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(), + server_event_context(), true))) { DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n")); smb_panic("cups_pcap_load_async: reinit_after_fork() failed"); } @@ -576,7 +576,7 @@ bool cups_cache_reload(void) DEBUG(10,("cups_cache_reload: sync read on fd %d\n", *p_pipe_fd )); - cups_async_callback(smbd_event_context(), + cups_async_callback(server_event_context(), NULL, EVENT_FD_READ, (void *)p_pipe_fd); @@ -592,7 +592,7 @@ bool cups_cache_reload(void) *p_pipe_fd )); /* Trigger an event when the pipe can be read. */ - cache_fd_event = event_add_fd(smbd_event_context(), + cache_fd_event = event_add_fd(server_event_context(), NULL, *p_pipe_fd, EVENT_FD_READ, cups_async_callback, diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 05728d1731..74edb25eb5 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1436,8 +1436,8 @@ void start_background_queue(void) close(pause_pipe[0]); pause_pipe[0] = -1; - if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(), - smbd_event_context(), + if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(), + server_event_context(), true))) { DEBUG(0,("reinit_after_fork() failed\n")); smb_panic("reinit_after_fork() failed"); @@ -1455,10 +1455,11 @@ void start_background_queue(void) exit(1); } - messaging_register(smbd_messaging_context(), NULL, + messaging_register(server_messaging_context(), NULL, MSG_PRINTER_UPDATE, print_queue_receive); - fde = tevent_add_fd(smbd_event_context(), smbd_event_context(), + fde = tevent_add_fd(server_event_context(), + server_event_context(), pause_pipe[1], TEVENT_FD_READ, printing_pause_fd_handler, NULL); @@ -1468,7 +1469,7 @@ void start_background_queue(void) } DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); - ret = tevent_loop_wait(smbd_event_context()); + ret = tevent_loop_wait(server_event_context()); /* should not be reached */ DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n", ret, (ret == 0) ? "out of events" : strerror(errno))); @@ -1601,7 +1602,7 @@ static void print_queue_update(int snum, bool force) /* finally send the message */ - messaging_send_buf(smbd_messaging_context(), + messaging_send_buf(server_messaging_context(), pid_to_procid(background_lpq_updater_pid), MSG_PRINTER_UPDATE, (uint8 *)buffer, len); -- cgit