[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Tue Jan 17 01:46:04 MST 2012
The branch, master has been updated
via 7d83d37 s3:lib/messages: remove unused messaging_event_context()
via ecd8fcd s3:smbcontrol: avoid using messaging_event_context()
via 77d1053 s3:smbcontrol: pass tevent_context down to wait_replies()
via e5ee6d3 s3:smbcontrol: pass tevent_context down to subcommands
via 32b5b46 s3:printing: avoid messaging_event_context() in print_queue_housekeeping()
from cb2fbdd s3-install: Don't let MANDIR and SRCDIR be overwritten
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 7d83d379ad2424dfd88cbfbab1b7dbae06b23bd1
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 16 16:15:59 2012 +0100
s3:lib/messages: remove unused messaging_event_context()
metze
Autobuild-User: Stefan Metzmacher <metze at samba.org>
Autobuild-Date: Tue Jan 17 09:45:30 CET 2012 on sn-devel-104
commit ecd8fcdb1eaf7ef4efa7d26dcef1fb4a8950fd8e
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 16 16:14:35 2012 +0100
s3:smbcontrol: avoid using messaging_event_context()
metze
commit 77d1053c294f0b25d0c6c03d53acfe7b00f22ef5
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 16 16:11:42 2012 +0100
s3:smbcontrol: pass tevent_context down to wait_replies()
metze
commit e5ee6d3a2473dbfefe649210464c5ef2c050c641
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 16 16:08:48 2012 +0100
s3:smbcontrol: pass tevent_context down to subcommands
metze
commit 32b5b461fa72df813da2b45b255b11ed350328fa
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 16 15:54:41 2012 +0100
s3:printing: avoid messaging_event_context() in print_queue_housekeeping()
metze
-----------------------------------------------------------------------
Summary of changes:
source3/include/messages.h | 1 -
source3/lib/messages.c | 5 --
source3/printing/queue_process.c | 27 ++++++--
source3/utils/smbcontrol.c | 145 +++++++++++++++++++++++---------------
4 files changed, 108 insertions(+), 70 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/messages.h b/source3/include/messages.h
index e3538f1..2161a77 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -107,7 +107,6 @@ bool message_send_all(struct messaging_context *msg_ctx,
int msg_type,
const void *buf, size_t len,
int *n_sent);
-struct event_context *messaging_event_context(struct messaging_context *msg_ctx);
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
struct event_context *ev);
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 421d883..12e3a48 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -176,11 +176,6 @@ bool message_send_all(struct messaging_context *msg_ctx,
return true;
}
-struct event_context *messaging_event_context(struct messaging_context *msg_ctx)
-{
- return msg_ctx->event_ctx;
-}
-
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
struct event_context *ev)
{
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c
index ce4047c..de41f89 100644
--- a/source3/printing/queue_process.c
+++ b/source3/printing/queue_process.c
@@ -44,10 +44,16 @@ static void reload_pcap_change_notify(struct tevent_context *ev,
message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL);
}
+struct printing_queue_housekeeping_state {
+ struct tevent_context *ev;
+ struct messaging_context *msg;
+};
+
static bool print_queue_housekeeping(const struct timeval *now, void *pvt)
{
- struct messaging_context *msg_ctx =
- talloc_get_type_abort(pvt, struct messaging_context);
+ struct printing_queue_housekeeping_state *state =
+ talloc_get_type_abort(pvt,
+ struct printing_queue_housekeeping_state);
time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
time_t t = time_mono(NULL);
@@ -58,8 +64,7 @@ static bool print_queue_housekeeping(const struct timeval *now, void *pvt)
if ((printcap_cache_time != 0) &&
(t >= (last_printer_reload_time + printcap_cache_time))) {
DEBUG( 3,( "Printcap cache time expired.\n"));
- pcap_cache_reload(messaging_event_context(msg_ctx),
- msg_ctx,
+ pcap_cache_reload(state->ev, state->msg,
&reload_pcap_change_notify);
last_printer_reload_time = t;
}
@@ -70,12 +75,22 @@ static bool print_queue_housekeeping(const struct timeval *now, void *pvt)
static bool printing_subsystem_queue_tasks(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
+ struct printing_queue_housekeeping_state *state;
+
+ state = talloc_zero(ev_ctx, struct printing_queue_housekeeping_state);
+ if (state == NULL) {
+ DEBUG(0,("Could not talloc printing_queue_housekeeping_state\n"));
+ return false;
+ }
+ state->ev = ev_ctx;
+ state->msg = msg_ctx;
+
if (!(event_add_idle(ev_ctx, NULL,
timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0),
"print_queue_housekeeping",
print_queue_housekeeping,
- msg_ctx))) {
- DEBUG(0, ("Could not add print_queue_housekeeping event\n"));
+ state))) {
+ DEBUG(0,("Could not add print_queue_housekeeping event\n"));
return false;
}
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index f0eafa0..5699f23 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -85,13 +85,14 @@ static void smbcontrol_timeout(struct tevent_context *event_ctx,
/* Wait for one or more reply messages */
-static void wait_replies(struct messaging_context *msg_ctx,
+static void wait_replies(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
bool multiple_replies)
{
struct tevent_timer *te;
bool timed_out = False;
- if (!(te = tevent_add_timer(messaging_event_context(msg_ctx), NULL,
+ if (!(te = tevent_add_timer(ev_ctx, NULL,
timeval_current_ofs(timeout, 0),
smbcontrol_timeout, (void *)&timed_out))) {
DEBUG(0, ("tevent_add_timer failed\n"));
@@ -102,7 +103,7 @@ static void wait_replies(struct messaging_context *msg_ctx,
int ret;
if (num_replies > 0 && !multiple_replies)
break;
- ret = tevent_loop_once(messaging_event_context(msg_ctx));
+ ret = tevent_loop_once(ev_ctx);
if (ret != 0) {
break;
}
@@ -140,7 +141,8 @@ static void print_string_cb(struct messaging_context *msg,
/* Send no message. Useful for testing. */
-static bool do_noop(struct messaging_context *msg_ctx,
+static bool do_noop(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -156,7 +158,8 @@ static bool do_noop(struct messaging_context *msg_ctx,
/* Send a debug string */
-static bool do_debug(struct messaging_context *msg_ctx,
+static bool do_debug(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -171,7 +174,8 @@ static bool do_debug(struct messaging_context *msg_ctx,
}
-static bool do_idmap(struct messaging_context *msg_ctx,
+static bool do_idmap(struct tevent_context *ev,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -328,9 +332,10 @@ static int stack_trace_connection(const struct connections_key *key,
return 0;
}
-static bool do_daemon_stack_trace(struct messaging_context *msg_ctx,
+static bool do_daemon_stack_trace(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
- const int argc, const char **argv)
+ const int argc, const char **argv)
{
pid_t dest;
int count = 0;
@@ -358,9 +363,10 @@ static bool do_daemon_stack_trace(struct messaging_context *msg_ctx,
#else /* defined(HAVE_LIBUNWIND_PTRACE) && defined(HAVE_LINUX_PTRACE) */
-static bool do_daemon_stack_trace(struct messaging_context *msg_ctx,
+static bool do_daemon_stack_trace(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
- const int argc, const char **argv)
+ const int argc, const char **argv)
{
fprintf(stderr,
"Daemon stack tracing is not supported on this platform\n");
@@ -371,9 +377,10 @@ static bool do_daemon_stack_trace(struct messaging_context *msg_ctx,
/* Inject a fault (fatal signal) into a running smbd */
-static bool do_inject_fault(struct messaging_context *msg_ctx,
+static bool do_inject_fault(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
- const int argc, const char **argv)
+ const int argc, const char **argv)
{
if (argc != 2) {
fprintf(stderr, "Usage: smbcontrol <dest> inject "
@@ -413,7 +420,8 @@ static bool do_inject_fault(struct messaging_context *msg_ctx,
/* Force a browser election */
-static bool do_election(struct messaging_context *msg_ctx,
+static bool do_election(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -439,7 +447,8 @@ static void pong_cb(struct messaging_context *msg,
num_replies++;
}
-static bool do_ping(struct messaging_context *msg_ctx,
+static bool do_ping(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -455,7 +464,7 @@ static bool do_ping(struct messaging_context *msg_ctx,
messaging_register(msg_ctx, NULL, MSG_PONG, pong_cb);
- wait_replies(msg_ctx, procid_to_pid(&pid) == 0);
+ wait_replies(ev_ctx, msg_ctx, procid_to_pid(&pid) == 0);
/* No replies were received within the timeout period */
@@ -469,7 +478,8 @@ static bool do_ping(struct messaging_context *msg_ctx,
/* Set profiling options */
-static bool do_profile(struct messaging_context *msg_ctx,
+static bool do_profile(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -552,7 +562,8 @@ static void profilelevel_rqst(struct messaging_context *msg_ctx,
send_message(msg_ctx, pid, MSG_PROFILELEVEL, &v, sizeof(int));
}
-static bool do_profilelevel(struct messaging_context *msg_ctx,
+static bool do_profilelevel(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -570,7 +581,7 @@ static bool do_profilelevel(struct messaging_context *msg_ctx,
messaging_register(msg_ctx, NULL, MSG_REQ_PROFILELEVEL,
profilelevel_rqst);
- wait_replies(msg_ctx, procid_to_pid(&pid) == 0);
+ wait_replies(ev_ctx, msg_ctx, procid_to_pid(&pid) == 0);
/* No replies were received within the timeout period */
@@ -584,7 +595,8 @@ static bool do_profilelevel(struct messaging_context *msg_ctx,
/* Display debug level settings */
-static bool do_debuglevel(struct messaging_context *msg_ctx,
+static bool do_debuglevel(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -600,7 +612,7 @@ static bool do_debuglevel(struct messaging_context *msg_ctx,
messaging_register(msg_ctx, NULL, MSG_DEBUGLEVEL, print_pid_string_cb);
- wait_replies(msg_ctx, procid_to_pid(&pid) == 0);
+ wait_replies(ev_ctx, msg_ctx, procid_to_pid(&pid) == 0);
/* No replies were received within the timeout period */
@@ -614,7 +626,8 @@ static bool do_debuglevel(struct messaging_context *msg_ctx,
/* Send a print notify message */
-static bool do_printnotify(struct messaging_context *msg_ctx,
+static bool do_printnotify(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -645,8 +658,7 @@ static bool do_printnotify(struct messaging_context *msg_ctx,
return False;
}
- notify_printer_status_byname(messaging_event_context(msg_ctx),
- msg_ctx, argv[2],
+ notify_printer_status_byname(ev_ctx, msg_ctx, argv[2],
PRINTER_STATUS_PAUSED);
goto send;
@@ -659,8 +671,7 @@ static bool do_printnotify(struct messaging_context *msg_ctx,
return False;
}
- notify_printer_status_byname(messaging_event_context(msg_ctx),
- msg_ctx, argv[2],
+ notify_printer_status_byname(ev_ctx, msg_ctx, argv[2],
PRINTER_STATUS_OK);
goto send;
@@ -677,7 +688,7 @@ static bool do_printnotify(struct messaging_context *msg_ctx,
jobid = atoi(argv[3]);
notify_job_status_byname(
- messaging_event_context(msg_ctx), msg_ctx,
+ ev_ctx, msg_ctx,
argv[2], jobid, JOB_STATUS_PAUSED,
SPOOLSS_NOTIFY_MSG_UNIX_JOBID);
@@ -695,7 +706,7 @@ static bool do_printnotify(struct messaging_context *msg_ctx,
jobid = atoi(argv[3]);
notify_job_status_byname(
- messaging_event_context(msg_ctx), msg_ctx,
+ ev_ctx, msg_ctx,
argv[2], jobid, JOB_STATUS_QUEUED,
SPOOLSS_NOTIFY_MSG_UNIX_JOBID);
@@ -713,12 +724,12 @@ static bool do_printnotify(struct messaging_context *msg_ctx,
jobid = atoi(argv[3]);
notify_job_status_byname(
- messaging_event_context(msg_ctx), msg_ctx,
+ ev_ctx, msg_ctx,
argv[2], jobid, JOB_STATUS_DELETING,
SPOOLSS_NOTIFY_MSG_UNIX_JOBID);
notify_job_status_byname(
- messaging_event_context(msg_ctx), msg_ctx,
+ ev_ctx, msg_ctx,
argv[2], jobid, JOB_STATUS_DELETING|
JOB_STATUS_DELETED,
SPOOLSS_NOTIFY_MSG_UNIX_JOBID);
@@ -747,8 +758,7 @@ static bool do_printnotify(struct messaging_context *msg_ctx,
return False;
}
- notify_printer_byname(messaging_event_context(msg_ctx),
- msg_ctx, argv[2], attribute,
+ notify_printer_byname(ev_ctx, msg_ctx, argv[2], attribute,
discard_const_p(char, argv[4]));
goto send;
@@ -764,7 +774,8 @@ send:
/* Close a share */
-static bool do_closeshare(struct messaging_context *msg_ctx,
+static bool do_closeshare(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -780,7 +791,8 @@ static bool do_closeshare(struct messaging_context *msg_ctx,
/* Tell winbindd an IP got dropped */
-static bool do_ip_dropped(struct messaging_context *msg_ctx,
+static bool do_ip_dropped(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -796,7 +808,8 @@ static bool do_ip_dropped(struct messaging_context *msg_ctx,
/* force a blocking lock retry */
-static bool do_lockretry(struct messaging_context *msg_ctx,
+static bool do_lockretry(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -810,7 +823,8 @@ static bool do_lockretry(struct messaging_context *msg_ctx,
/* force a validation of all brl entries, including re-sends. */
-static bool do_brl_revalidate(struct messaging_context *msg_ctx,
+static bool do_brl_revalidate(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -824,7 +838,8 @@ static bool do_brl_revalidate(struct messaging_context *msg_ctx,
/* Display talloc pool usage */
-static bool do_poolusage(struct messaging_context *msg_ctx,
+static bool do_poolusage(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -840,7 +855,7 @@ static bool do_poolusage(struct messaging_context *msg_ctx,
if (!send_message(msg_ctx, pid, MSG_REQ_POOL_USAGE, NULL, 0))
return False;
- wait_replies(msg_ctx, procid_to_pid(&pid) == 0);
+ wait_replies(ev_ctx, msg_ctx, procid_to_pid(&pid) == 0);
/* No replies were received within the timeout period */
@@ -854,7 +869,8 @@ static bool do_poolusage(struct messaging_context *msg_ctx,
/* Perform a dmalloc mark */
-static bool do_dmalloc_mark(struct messaging_context *msg_ctx,
+static bool do_dmalloc_mark(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -868,7 +884,8 @@ static bool do_dmalloc_mark(struct messaging_context *msg_ctx,
/* Perform a dmalloc changed */
-static bool do_dmalloc_changed(struct messaging_context *msg_ctx,
+static bool do_dmalloc_changed(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -884,7 +901,8 @@ static bool do_dmalloc_changed(struct messaging_context *msg_ctx,
/* Shutdown a server process */
-static bool do_shutdown(struct messaging_context *msg_ctx,
+static bool do_shutdown(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -898,7 +916,8 @@ static bool do_shutdown(struct messaging_context *msg_ctx,
/* Notify a driver upgrade */
-static bool do_drvupgrade(struct messaging_context *msg_ctx,
+static bool do_drvupgrade(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -912,9 +931,10 @@ static bool do_drvupgrade(struct messaging_context *msg_ctx,
strlen(argv[1]) + 1);
}
-static bool do_winbind_online(struct messaging_context *msg_ctx,
+static bool do_winbind_online(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
- const int argc, const char **argv)
+ const int argc, const char **argv)
{
TDB_CONTEXT *tdb;
@@ -939,9 +959,10 @@ static bool do_winbind_online(struct messaging_context *msg_ctx,
return send_message(msg_ctx, pid, MSG_WINBIND_ONLINE, NULL, 0);
}
-static bool do_winbind_offline(struct messaging_context *msg_ctx,
+static bool do_winbind_offline(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
- const int argc, const char **argv)
+ const int argc, const char **argv)
{
TDB_CONTEXT *tdb;
bool ret = False;
@@ -1005,7 +1026,8 @@ static bool do_winbind_offline(struct messaging_context *msg_ctx,
return ret;
}
-static bool do_winbind_onlinestatus(struct messaging_context *msg_ctx,
+static bool do_winbind_onlinestatus(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -1025,7 +1047,7 @@ static bool do_winbind_onlinestatus(struct messaging_context *msg_ctx,
sizeof(myid)))
return False;
- wait_replies(msg_ctx, procid_to_pid(&pid) == 0);
+ wait_replies(ev_ctx, msg_ctx, procid_to_pid(&pid) == 0);
/* No replies were received within the timeout period */
@@ -1037,7 +1059,8 @@ static bool do_winbind_onlinestatus(struct messaging_context *msg_ctx,
return num_replies;
}
-static bool do_dump_event_list(struct messaging_context *msg_ctx,
+static bool do_dump_event_list(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -1053,7 +1076,8 @@ static bool do_dump_event_list(struct messaging_context *msg_ctx,
return send_message(msg_ctx, pid, MSG_DUMP_EVENT_LIST, NULL, 0);
}
-static bool do_winbind_dump_domain_list(struct messaging_context *msg_ctx,
+static bool do_winbind_dump_domain_list(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
const struct server_id pid,
const int argc, const char **argv)
{
@@ -1095,7 +1119,7 @@ static bool do_winbind_dump_domain_list(struct messaging_context *msg_ctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list