[Open-FCoE] [PATCH 08/15] fcoe-utils: Have a fcoemon_utils.[ch] use_syslog flag

Robert Love robert.w.love at intel.com
Thu Jul 16 17:01:03 UTC 2009


Currently fcoemon_utils.[ch] uses the fcm_use_syslog global
variable to determine if it should use syslog or not.

This patch changes the name of the macro and adds an accesible
routine for changing this value.

Signed-off-by: Robert Love <robert.w.love at intel.com>
---

 fcoemon.c       |    1 +
 fcoemon_utils.c |    9 ++++++++-
 fcoemon_utils.h |    4 +++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/fcoemon.c b/fcoemon.c
index 65d30e6..89555a5 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -286,6 +286,7 @@ static int fcm_read_config_files(void)
 	/* if not found, default to "yes" */
 	if (!strncasecmp(val, "yes", 3) || !rc) {
 		fcoe_config.use_syslog = 1;
+		enable_syslog(1);
 		fcm_use_syslog = 1;
 	}
 
diff --git a/fcoemon_utils.c b/fcoemon_utils.c
index 0bb013e..74353e0 100644
--- a/fcoemon_utils.c
+++ b/fcoemon_utils.c
@@ -23,12 +23,19 @@
 
 u_char libsa_lock_hier;		/* for lock debugging non-log related */
 
+int use_syslog;
+
 /*
  * Size of on-stack line buffers.
  * These shouldn't be to large for a kernel stack frame.
  */
 #define SA_LOG_BUF_LEN  200	/* on-stack line buffer size */
 
+void enable_syslog(int enable)
+{
+	use_syslog = enable;
+}
+
 /*
  * log with a variable argument list.
  */
@@ -169,7 +176,7 @@ sa_log_timestamp(void)
 void
 sa_log_output(const char *buf)
 {
-	if (fcm_use_syslog) {
+	if (use_syslog) {
 		syslog(LOG_INFO, "%s", buf);
 		return;
 	}
diff --git a/fcoemon_utils.h b/fcoemon_utils.h
index 05faac2..4a4546f 100644
--- a/fcoemon_utils.h
+++ b/fcoemon_utils.h
@@ -276,6 +276,8 @@ extern fc_wwn_t
 fc_wwn_from_mac(u_int64_t, u_int32_t scheme, u_int32_t port);
 
 extern int hex2int(char *b);
-extern int fcm_use_syslog;
+
+int use_syslog;
+void enable_syslog(int);
 
 #endif /* _FCOEMON_UTILS_H_ */




More information about the devel mailing list