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
This commit is contained in:
Fabio M. Di Nitto 2009-06-18 05:17:43 +00:00
parent 493aaf239b
commit 7595cd31e7
5 changed files with 20 additions and 14 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);
/*

View File

@ -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)

View File

@ -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