From: Pete Zaitcev <zaitcev@redhat.com>
To: jeff@garzik.org
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [Patch 3/3] tabled: End-to-end verbosity
Date: Wed, 31 Mar 2010 18:43:18 -0600 [thread overview]
Message-ID: <20100331184318.0616bbad@redhat.com> (raw)
Signed-Off-By: Pete Zaitcev <zaitcev@redhat.com>
---
server/cldu.c | 9 ++++++---
server/server.c | 11 ++++++++---
server/tabled.h | 3 +--
3 files changed, 15 insertions(+), 8 deletions(-)
commit 820e53ea5ec85a69f6e1648e8d445a0d87ea6a72
Author: Master <zaitcev@lembas.zaitcev.lan>
Date: Wed Mar 31 18:27:00 2010 -0600
End-2-end verbosity.
diff --git a/server/cldu.c b/server/cldu.c
index aecf336..e705725 100644
--- a/server/cldu.c
+++ b/server/cldu.c
@@ -82,7 +82,7 @@ static void add_chunk_node(struct cld_session *sp, const char *name);
static struct timeval cldu_rescan_delay = { 50, 0 };
-struct hail_log cldu_hail_log = {
+static struct hail_log cldu_hail_log = {
.func = applog,
};
@@ -223,7 +223,8 @@ static int cldu_set_cldc(struct cld_session *sp, int newactive)
hp->host, hp->port);
sp->nsp = ncld_sess_open(hp->host, hp->port, &error,
- cldu_sess_event, sp, "tabled", "tabled");
+ cldu_sess_event, sp, "tabled", "tabled",
+ &cldu_hail_log);
if (sp->nsp == NULL) {
if (error < 1000) {
applog(LOG_ERR, "ncld_sess_open(%s,%u) error: %s",
@@ -581,12 +582,14 @@ void cld_init()
/*
* This initiates our sole session with a CLD instance.
*/
-int cld_begin(const char *thishost, const char *thisgroup)
+int cld_begin(const char *thishost, const char *thisgroup, int verbose)
{
static struct cld_session *sp = &ses;
struct timespec tm;
int retry_cnt;
+ cldu_hail_log.verbose = verbose;
+
evtimer_set(&ses.tm_rescan, cldu_tm_rescan, &ses);
if (cldu_setgroup(sp, thisgroup, thishost)) {
diff --git a/server/server.c b/server/server.c
index e0d785c..8d03c15 100644
--- a/server/server.c
+++ b/server/server.c
@@ -78,6 +78,8 @@ static struct argp_option options[] = {
"Write daemon process id to FILE" },
{ "foreground", 'F', NULL, 0,
"Run in foreground, do not fork" },
+ { "verbose", 'v', NULL, 0,
+ "Enable verbosity in libcldc" },
{ }
};
@@ -90,6 +92,7 @@ static const struct argp argp = { options, parse_opt, NULL, doc };
static bool server_running = true;
static bool use_syslog = true;
+static int verbose = 0;
int debugging = 0;
struct server tabled_srv = {
@@ -192,6 +195,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
case 'P':
tabled_srv.pid_file = strdup(arg);
break;
+ case 'v':
+ verbose = 1;
+ break;
case ARGP_KEY_ARG:
argp_usage(state); /* too many args */
break;
@@ -1829,8 +1835,7 @@ int main (int argc, char *argv[])
if (use_syslog)
openlog(PROGRAM_NAME, LOG_PID, LOG_LOCAL3);
if (debugging)
- applog(LOG_INFO, "Verbose debug output enabled");
- cldu_hail_log.verbose = debugging;
+ applog(LOG_INFO, "Debug output enabled");
/*
* now we can parse the configuration, errors to applog
@@ -1889,7 +1894,7 @@ int main (int argc, char *argv[])
if (rc)
goto err_out_net;
- if (cld_begin(tabled_srv.ourhost, tabled_srv.group) != 0) {
+ if (cld_begin(tabled_srv.ourhost, tabled_srv.group, verbose) != 0) {
rc = 1;
goto err_cld_session;
}
diff --git a/server/tabled.h b/server/tabled.h
index 72bf20d..73714f0 100644
--- a/server/tabled.h
+++ b/server/tabled.h
@@ -290,10 +290,9 @@ extern void cli_in_end(struct client *cli);
/* cldu.c */
extern void cld_init(void);
-extern int cld_begin(const char *fqdn, const char *group);
+extern int cld_begin(const char *fqdn, const char *group, int verbose);
extern void cldu_add_host(const char *host, unsigned int port);
extern void cld_end(void);
-extern struct hail_log cldu_hail_log;
/* util.c */
extern size_t strlist_len(GList *l);
reply other threads:[~2010-04-01 0:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100331184318.0616bbad@redhat.com \
--to=zaitcev@redhat.com \
--cc=hail-devel@vger.kernel.org \
--cc=jeff@garzik.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).