[Openais] [PATCH 4/9] logsys: allow to use header files for #define's
Fabio M. Di Nitto
fdinitto at redhat.com
Wed Jun 17 03:53:44 PDT 2009
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.
Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
:100644 100644 59c8a3e... b1f19c4... M exec/totemnet.c
:100644 100644 bb34451... 7565805... M exec/totempg.c
:100644 100644 6ad24c2... e0d19ca... M exec/totemrrp.c
:100644 100644 19beb42... e14e377... M exec/totemsrp.c
:100644 100644 c2fe08a... ea53cac... M include/corosync/engine/logsys.h
exec/totemnet.c | 6 +++---
exec/totempg.c | 7 ++++---
exec/totemrrp.c | 8 ++++----
exec/totemsrp.c | 9 +++++----
include/corosync/engine/logsys.h | 4 ++++
5 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/exec/totemnet.c b/exec/totemnet.c
index 59c8a3e..b1f19c4 100644
--- a/exec/totemnet.c
+++ b/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);
diff --git a/exec/totempg.c b/exec/totempg.c
index bb34451..7565805 100644
--- a/exec/totempg.c
+++ b/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);
diff --git a/exec/totemrrp.c b/exec/totemrrp.c
index 6ad24c2..e0d19ca 100644
--- a/exec/totemrrp.c
+++ b/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);
/*
diff --git a/exec/totemsrp.c b/exec/totemsrp.c
index 19beb42..e14e377 100644
--- a/exec/totemsrp.c
+++ b/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)
diff --git a/include/corosync/engine/logsys.h b/include/corosync/engine/logsys.h
index c2fe08a..ea53cac 100644
--- a/include/corosync/engine/logsys.h
+++ b/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
--
1.5.4.3
More information about the Openais
mailing list