From mboxrd@z Thu Jan 1 00:00:00 1970 From: pcaulfield@sourceware.org Date: 3 Oct 2007 10:06:22 -0000 Subject: [Cluster-devel] cluster/cman/daemon ais.c barrier.c cmanccs.c ... Message-ID: <20071003100622.22900.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: pcaulfield at sourceware.org 2007-10-03 10:06:21 Modified files: cman/daemon : ais.c barrier.c cmanccs.c commands.c config.c daemon.c logging.c logging.h Log message: Tidy logsys use. Is this OK now Steve ? Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/ais.c.diff?cvsroot=cluster&r1=1.51&r2=1.52 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/barrier.c.diff?cvsroot=cluster&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cmanccs.c.diff?cvsroot=cluster&r1=1.30&r2=1.31 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/config.c.diff?cvsroot=cluster&r1=1.18&r2=1.19 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/daemon.c.diff?cvsroot=cluster&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/logging.c.diff?cvsroot=cluster&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/logging.h.diff?cvsroot=cluster&r1=1.8&r2=1.9 --- cluster/cman/daemon/ais.c 2007/10/01 12:36:58 1.51 +++ cluster/cman/daemon/ais.c 2007/10/03 10:06:21 1.52 @@ -71,6 +71,8 @@ { .group = "CMAN", .group_len = 4}, }; +LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO); + /* This structure is tacked onto the start of a cluster message packet for our * own nefarious purposes. */ struct cl_protheader { @@ -209,13 +211,17 @@ if (getenv("CMAN_PIPE")) startup_pipe = atoi(getenv("CMAN_PIPE")); - init_debug(debug_mask); + set_debuglog(debug_mask); /* We need to set this up to internal defaults too early */ openlog("openais", LOG_CONS|LOG_PID, LOG_LOCAL4); global_objdb = objdb; + /* Enable stderr logging if requested by cman_tool */ + if (debug_mask) + logsys_config_subsys_set("CMAN", LOGSYS_TAG_LOG, LOG_DEBUG); + /* Read low-level totem/aisexec etc config from CCS */ init_config(objdb); @@ -256,7 +262,7 @@ if (!getenv("CMAN_DEBUGLOG")) { objdb_get_int(objdb, object_handle, "debug_mask", &debug_mask); - init_debug(debug_mask); + set_debuglog(debug_mask); } } @@ -267,8 +273,6 @@ close(startup_pipe); startup_pipe = 0; - cman_flush_debuglog(); - /* Start totem */ totempg_groups_initialize(&group_handle, cman_deliver_fn, cman_confchg_fn); totempg_groups_join(group_handle, cman_group, 1); --- cluster/cman/daemon/barrier.c 2007/09/17 08:03:36 1.12 +++ cluster/cman/daemon/barrier.c 2007/10/03 10:06:21 1.13 @@ -45,6 +45,8 @@ extern int we_are_a_cluster_member; +LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO); + /* A barrier */ struct cl_barrier { struct list list; --- cluster/cman/daemon/cmanccs.c 2007/09/17 08:03:36 1.30 +++ cluster/cman/daemon/cmanccs.c 2007/10/03 10:06:21 1.31 @@ -71,6 +71,8 @@ static unsigned short cluster_id; static char cluster_name[MAX_CLUSTER_NAME_LEN + 1]; +LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO); + static uint16_t generate_cluster_id(char *name) { int i; --- cluster/cman/daemon/commands.c 2007/09/27 09:01:30 1.72 +++ cluster/cman/daemon/commands.c 2007/10/03 10:06:21 1.73 @@ -48,6 +48,7 @@ #include "ais.h" #define max(a,b) (((a) > (b)) ? (a) : (b)) +LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO); /* Reference counting for cluster applications */ static int use_count; --- cluster/cman/daemon/config.c 2006/08/15 13:43:12 1.18 +++ cluster/cman/daemon/config.c 2007/10/03 10:06:21 1.19 @@ -18,6 +18,8 @@ #include "ccs.h" #include "logging.h" +LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO); + static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned int parent, char *object, char *key, int always_create) { --- cluster/cman/daemon/daemon.c 2007/09/17 08:03:36 1.37 +++ cluster/cman/daemon/daemon.c 2007/10/03 10:06:21 1.38 @@ -42,6 +42,8 @@ #include "barrier.h" #include "ais.h" +LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO); + struct queued_reply { struct list list; --- cluster/cman/daemon/logging.c 2007/09/19 12:49:37 1.16 +++ cluster/cman/daemon/logging.c 2007/10/03 10:06:21 1.17 @@ -24,24 +24,11 @@ #include #include "logging.h" -/* Make this global so that all of cman can use the same subsys name */ -unsigned int logsys_subsys_id; -int subsys_mask = 0; +LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO); -void init_debug(int subsystems) -{ - logsys_subsys_id = logsys_config_subsys_set ("CMAN", LOGSYS_TAG_LOG, (subsystems?LOG_LEVEL_DEBUG:LOG_LEVEL_WARNING) ); - logsys_config_mode_set(LOG_MODE_BUFFER_BEFORE_CONFIG | ((subsystems)?LOG_MODE_OUTPUT_STDERR:0)); - subsys_mask = subsystems; -} +int subsys_mask = 0; void set_debuglog(int subsystems) { subsys_mask = subsystems; } - - -void cman_flush_debuglog() -{ - logsys_config_mode_set(LOG_MODE_FLUSH_AFTER_CONFIG | ((subsys_mask)?LOG_MODE_OUTPUT_STDERR:0)); -} --- cluster/cman/daemon/logging.h 2007/09/17 08:03:36 1.8 +++ cluster/cman/daemon/logging.h 2007/10/03 10:06:21 1.9 @@ -10,8 +10,7 @@ ******************************************************************************* ******************************************************************************/ #include -extern void init_debug(int subsystems); -extern void cman_flush_debuglog(void); + extern void set_debuglog(int subsystems); /* Debug macros */ @@ -21,7 +20,6 @@ #define CMAN_DEBUG_DAEMON 8 #define CMAN_DEBUG_AIS 16 -extern unsigned int logsys_subsys_id; extern int subsys_mask; #define P_BARRIER(fmt, args...) if (subsys_mask & CMAN_DEBUG_BARRIER) log_printf(logsys_mkpri(LOG_LEVEL_DEBUG, logsys_subsys_id), "barrier: " fmt, ## args)