Просмотр исходного кода

logsys: allow to use header files for #define's

most of the values in logsys.h are very useful for non logsys library
API users.

Allow to import them without sucking the whole lib.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2248 fd59a12c-fef9-0310-b244-a6a79926bd2f
Fabio M. Di Nitto 16 лет назад
Родитель
Сommit
7595cd31e7
5 измененных файлов с 20 добавлено и 14 удалено
  1. 3 3
      exec/totemnet.c
  2. 4 3
      exec/totempg.c
  3. 4 4
      exec/totemrrp.c
  4. 5 4
      exec/totemsrp.c
  5. 4 0
      include/corosync/engine/logsys.h

+ 3 - 3
exec/totemnet.c

@@ -63,6 +63,8 @@
 #include <corosync/hdb.h>
 #include <corosync/swab.h>
 #include <corosync/totem/coropoll.h>
+#define LOGSYS_UTILS_ONLY 1
+#include <corosync/engine/logsys.h>
 #include "totemnet.h"
 #include "wthread.h"
 
@@ -242,13 +244,11 @@ static void totemnet_instance_initialize (struct totemnet_instance *instance)
 	instance->my_memb_entries = 1;
 }
 
-#define	RECID_LOG UINT_MAX - 1
-
 #define log_printf(level, format, args...)				\
 do {									\
         instance->totemnet_log_printf (instance->totemnet_subsys_id,	\
                 __FUNCTION__, __FILE__, __LINE__,			\
-		level, RECID_LOG, (const char *)format, ##args);	\
+		level, LOGSYS_RECID_LOG, (const char *)format, ##args);	\
 } while (0);
 
 

+ 4 - 3
exec/totempg.c

@@ -99,6 +99,8 @@
 #include <corosync/list.h>
 #include <corosync/totem/coropoll.h>
 #include <corosync/totem/totempg.h>
+#define LOGSYS_UTILS_ONLY 1
+#include <corosync/engine/logsys.h>
 
 #include "totemmrp.h"
 #include "totemsrp.h"
@@ -237,12 +239,11 @@ static pthread_mutex_t callback_token_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static pthread_mutex_t mcast_msg_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-#define RECID_LOG UINT_MAX - 1
-
 #define log_printf(level, format, args...)				\
 do {									\
         totempg_log_printf (totempg_subsys_id, __FUNCTION__,		\
-		__FILE__, __LINE__, level, RECID_LOG, format, ##args);	\
+		__FILE__, __LINE__, level, LOGSYS_RECID_LOG,		\
+		format, ##args);					\
 } while (0);
 
 static int msg_count_send_ok (int msg_count);

+ 4 - 4
exec/totemrrp.c

@@ -63,6 +63,8 @@
 #include <corosync/hdb.h>
 #include <corosync/swab.h>
 #include <corosync/totem/coropoll.h>
+#define LOGSYS_UTILS_ONLY 1
+#include <corosync/engine/logsys.h>
 
 #include "totemnet.h"
 #include "totemrrp.h"
@@ -468,14 +470,12 @@ struct rrp_algo *rrp_algos[] = {
  */
 DECLARE_HDB_DATABASE (totemrrp_instance_database,NULL);
 
-#define RECID_LOG UINT_MAX - 1
-
 #define log_printf(level, format, args...)				\
 do {									\
 	rrp_instance->totemrrp_log_printf (				\
 		rrp_instance->totemrrp_subsys_id,			\
-		__FUNCTION__, __FILE__, __LINE__, level, RECID_LOG,	\
-		format, ##args);					\
+		__FUNCTION__, __FILE__, __LINE__, level,		\
+		LOGSYS_RECID_LOG, format, ##args);			\
 } while (0);
 
 /*

+ 5 - 4
exec/totemsrp.c

@@ -77,6 +77,9 @@
 #include <corosync/list.h>
 #include <corosync/hdb.h>
 #include <corosync/totem/coropoll.h>
+#define LOGSYS_UTILS_ONLY 1
+#include <corosync/engine/logsys.h>
+
 #include "totemsrp.h"
 #include "totemrrp.h"
 #include "totemnet.h"
@@ -622,13 +625,11 @@ struct message_handlers totemsrp_message_handlers = {
 
 static const char *rundir = NULL;
 
-#define RECID_LOG UINT_MAX - 1
-
 #define log_printf(level, format, args...)				\
 do {									\
 	instance->totemsrp_log_printf (instance->totemsrp_subsys_id,	\
-		__FUNCTION__, __FILE__, __LINE__, level, RECID_LOG,	\
-		format, ##args);					\
+		__FUNCTION__, __FILE__, __LINE__, level,		\
+		LOGSYS_RECID_LOG, format, ##args);			\
 } while (0);
 
 static void totemsrp_instance_initialize (struct totemsrp_instance *instance)

+ 4 - 0
include/corosync/engine/logsys.h

@@ -104,6 +104,8 @@ extern "C" {
 #define LOGSYS_MAX_SUBSYS_COUNT		64
 #define LOGSYS_MAX_SUBSYS_NAMELEN	64
 
+#ifndef LOGSYS_UTILS_ONLY
+
 extern int _logsys_system_setup(
 	const char *mainsystem,
 	unsigned int mode,
@@ -377,6 +379,8 @@ do {									\
 		LOGSYS_RECID_TRACE8, format, ##args);			\
 } while(0)
 
+#endif /* LOGSYS_UTILS_ONLY */
+
 #ifdef __cplusplus
 }
 #endif