public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: master - qdisk: port to new logsys api Date: Tue, 05 Aug 2008 07:37:00 -0000 [thread overview] Message-ID: <20080805055154.543E012003F@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=cbc9ece3ea971c17efd260104c4f40e3a855bb5e Commit: cbc9ece3ea971c17efd260104c4f40e3a855bb5e Parent: 0ca6a6a2dda71909275738d929dd72306d3039c3 Author: Fabio M. Di Nitto <fdinitto@redhat.com> AuthorDate: Tue Aug 5 07:51:02 2008 +0200 Committer: Fabio M. Di Nitto <fdinitto@redhat.com> CommitterDate: Tue Aug 5 07:51:02 2008 +0200 qdisk: port to new logsys api switch to new logsys api and fix a bug where debug output was always enabled. Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> --- cman/qdisk/daemon_init.c | 2 -- cman/qdisk/disk.c | 2 -- cman/qdisk/disk_util.c | 2 -- cman/qdisk/main.c | 13 ++++--------- cman/qdisk/mkqdisk.c | 14 +++++++++----- cman/qdisk/proc.c | 2 -- cman/qdisk/score.c | 2 -- 7 files changed, 13 insertions(+), 24 deletions(-) diff --git a/cman/qdisk/daemon_init.c b/cman/qdisk/daemon_init.c index 2185cad..0edbd6b 100644 --- a/cman/qdisk/daemon_init.c +++ b/cman/qdisk/daemon_init.c @@ -37,8 +37,6 @@ int check_process_running(char *prog, pid_t * pid); static void update_pidfile(char *prog); static int setup_sigmask(void); -LOGSYS_DECLARE_SUBSYS ("QDISK", SYSLOGLEVEL); - static int check_pid_valid(pid_t pid, char *prog) { diff --git a/cman/qdisk/disk.c b/cman/qdisk/disk.c index 463cf2a..ca03b81 100644 --- a/cman/qdisk/disk.c +++ b/cman/qdisk/disk.c @@ -30,8 +30,6 @@ static int diskRawRead(target_info_t *disk, char *buf, int len); uint32_t clu_crc32(const char *data, size_t count); -LOGSYS_DECLARE_SUBSYS ("QDISK", SYSLOGLEVEL); - /** * Swap the bytes of a shared header so that it's always in big-endian form * when stored on disk. diff --git a/cman/qdisk/disk_util.c b/cman/qdisk/disk_util.c index 07faa39..f53068a 100644 --- a/cman/qdisk/disk_util.c +++ b/cman/qdisk/disk_util.c @@ -17,8 +17,6 @@ #include <time.h> #include <openais/service/logsys.h> -LOGSYS_DECLARE_SUBSYS ("QDISK", SYSLOGLEVEL); - inline void _diff_tv(struct timeval *dest, struct timeval *start, struct timeval *end) { diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c index 0f3fe7d..f0906d5 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -56,13 +56,6 @@ static void update_local_status(qd_ctx *ctx, node_info_t *ni, int max, int score int score_req, int score_max); -LOGSYS_DECLARE_SYSTEM (NULL, - LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_BUFFER_BEFORE_CONFIG, - LOGDIR "/qdisk.log", - SYSLOGFACILITY); - -LOGSYS_DECLARE_SUBSYS ("QDISK", SYSLOGLEVEL); - static void int_handler(int sig) { @@ -1079,7 +1072,7 @@ get_logsys_config_data(int *debug) logmode = logsys_config_mode_get(); - if (!debug) { + if (!*debug) { if (ccs_get(ccsfd, "/cluster/logging/@debug", &val) == 0) { if(!strcmp(val, "on")) { global_debug = 1; @@ -1503,6 +1496,8 @@ main(int argc, char **argv) pid_t pid; quorum_header_t qh; + logsys_init("QDISK", LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_OUTPUT_FILE | LOG_MODE_FILTER_DEBUG_FROM_SYSLOG | LOG_MODE_BUFFER_BEFORE_CONFIG, SYSLOGFACILITY, SYSLOGLEVEL, LOGDIR "/qdisk.log"); + if (check_process_running(argv[0], &pid) && pid !=getpid()) { printf("QDisk services already running\n"); return 0; @@ -1672,7 +1667,7 @@ main(int argc, char **argv) out: cman_finish(ctx.qc_ch); qd_destroy(&ctx); - + logsys_exit(); return ret; } diff --git a/cman/qdisk/mkqdisk.c b/cman/qdisk/mkqdisk.c index c9dffb7..dbb0d33 100644 --- a/cman/qdisk/mkqdisk.c +++ b/cman/qdisk/mkqdisk.c @@ -12,10 +12,6 @@ #include <unistd.h> #include <openais/service/logsys.h> -LOGSYS_DECLARE_SYSTEM (NULL, LOG_MODE_OUTPUT_STDERR, NULL, SYSLOGFACILITY); - -LOGSYS_DECLARE_SUBSYS ("QDISK", SYSLOGLEVEL); - int main(int argc, char **argv) { @@ -23,6 +19,8 @@ main(int argc, char **argv) char *newdev = NULL, *newlabel = NULL; int rv, verbose_level = 1; + logsys_init("QDISK", LOG_MODE_OUTPUT_STDERR | LOG_MODE_NOSUBSYS, SYSLOGFACILITY, SYSLOGLEVEL, NULL); + printf("mkqdisk v" RELEASE_VERSION "\n\n"); /* XXX this is horrible but we need to prioritize options as long as @@ -32,7 +30,13 @@ main(int argc, char **argv) switch (rv) { case 'd': ++verbose_level; - logsys_config_priority_set (LOG_LEVEL_DEBUG); + /* Workaround a bug in logsys new API. + * logsys segfaults if our first operation is to set the priority + * because the logsys_config_priority_set is buggy. + * Temporary use the direct call while fix is applied upstream and propagated + */ + // logsys_config_priority_set(LOG_LEVEL_DEBUG); + _logsys_config_priority_set(0, LOG_LEVEL_DEBUG); break; } } diff --git a/cman/qdisk/proc.c b/cman/qdisk/proc.c index 349e7e8..78ff82f 100644 --- a/cman/qdisk/proc.c +++ b/cman/qdisk/proc.c @@ -21,8 +21,6 @@ struct device_args { int pad; }; -LOGSYS_DECLARE_SUBSYS ("QDISK", SYSLOGLEVEL); - int check_device(char *device, char *label, quorum_header_t *qh, int flags) diff --git a/cman/qdisk/score.c b/cman/qdisk/score.c index d6a9780..16ba39e 100644 --- a/cman/qdisk/score.c +++ b/cman/qdisk/score.c @@ -29,8 +29,6 @@ struct h_arg { int count; }; -LOGSYS_DECLARE_SUBSYS ("QDISK", SYSLOGLEVEL); - /* XXX Messy, but works for now... */
reply other threads:[~2008-08-05 5:53 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=20080805055154.543E012003F@lists.fedorahosted.org \ --to=fabbione@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /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: linkBe 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).