big cleanup of the debug configuration option

* src/Makefile.am src/libvirt.c src/libvirt_private.syms src/logging.c
  src/logging.h src/util.c src/libvirt_debug.syms: big cleanup of
  the debug configuration option and code by Amy Griffis
daniel
This commit is contained in:
Daniel Veillard 2009-06-26 15:08:04 +00:00
parent b052424c0d
commit 173c230e66
8 changed files with 23 additions and 68 deletions

View File

@ -1,3 +1,9 @@
Fri Jun 26 17:06:18 CEST 2009 Daniel Veillard <veillard@redhat.com>
* src/Makefile.am src/libvirt.c src/libvirt_private.syms src/logging.c
src/logging.h src/util.c src/libvirt_debug.syms: big cleanup of
the debug configuration option and code by Amy Griffis
Fri Jun 26 16:07:54 CEST 2009 Daniel Veillard <veillard@redhat.com>
* src/node_device.c src/node_device_hal.h src/node_device_hal_linux.c:

View File

@ -501,10 +501,6 @@ EXTRA_DIST += \
# symbols aren't present at all.
#
if ENABLE_DEBUG
USED_SYM_FILES += libvirt_debug.syms
endif
if WITH_DRIVER_MODULES
USED_SYM_FILES += libvirt_driver_modules.syms
endif
@ -520,7 +516,6 @@ endif
EXTRA_DIST += \
libvirt_public.syms \
libvirt_private.syms \
libvirt_debug.syms \
libvirt_driver_modules.syms \
libvirt_bridge.syms \
libvirt_linux.syms

View File

@ -256,9 +256,7 @@ winsock_init (void)
int
virInitialize(void)
{
#ifdef ENABLE_DEBUG
char *debugEnv;
#endif
if (initialized)
return(0);
@ -269,7 +267,6 @@ virInitialize(void)
virRandomInitialize(time(NULL) ^ getpid()))
return -1;
#ifdef ENABLE_DEBUG
debugEnv = getenv("LIBVIRT_DEBUG");
if (debugEnv && *debugEnv && *debugEnv != '0') {
if (STREQ(debugEnv, "2") || STREQ(debugEnv, "info"))
@ -287,7 +284,6 @@ virInitialize(void)
debugEnv = getenv("LIBVIRT_LOG_OUTPUTS");
if (debugEnv)
virLogParseOutputs(debugEnv);
#endif
DEBUG0("register drivers");
@ -1055,13 +1051,11 @@ do_open (const char *name,
/* Secondary driver for storage. Optional */
for (i = 0; i < virStorageDriverTabCount; i++) {
res = virStorageDriverTab[i]->open (ret, auth, flags);
#ifdef ENABLE_DEBUG
DEBUG("storage driver %d %s returned %s",
i, virStorageDriverTab[i]->name,
res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" :
(res == VIR_DRV_OPEN_DECLINED ? "DECLINED" :
(res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
#endif
if (res == VIR_DRV_OPEN_ERROR) {
if (0 && STREQ(virStorageDriverTab[i]->name, "remote")) {
virLibConnWarning (NULL, VIR_WAR_NO_STORAGE,

View File

@ -1,19 +0,0 @@
#
# These symbols are dependent upon --enable-debug.
#
# libvirt_internal.h
debugFlag;
# logging.h
virLogMessage;
virLogSetDefaultPriority;
virLogDefineFilter;
virLogDefineOutput;
virLogParseFilters;
virLogParseOutputs;
virLogStartup;
virLogShutdown;
virLogReset;

View File

@ -192,6 +192,18 @@ virRegisterStorageDriver;
virRegisterDeviceMonitor;
# logging.h
virLogMessage;
virLogSetDefaultPriority;
virLogDefineFilter;
virLogDefineOutput;
virLogParseFilters;
virLogParseOutputs;
virLogStartup;
virLogShutdown;
virLogReset;
# memory.h
virAlloc;
virAllocN;

View File

@ -39,9 +39,6 @@
#include "util.h"
#include "threads.h"
#ifdef ENABLE_DEBUG
int debugFlag = 0;
/*
* Macro used to format the message as a string in virLogMessage
* and borrowed from libxml2 (also used in virRaiseError)
@ -793,5 +790,4 @@ int virLogParseFilters(const char *filters) {
}
return(ret);
}
#endif /* ENABLE_DEBUG */

View File

@ -32,22 +32,17 @@
#ifdef ENABLE_DEBUG
#define VIR_DEBUG_INT(category, f, l, fmt,...) \
virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, __VA_ARGS__)
#else
#define VIR_DEBUG_INT(category, f, l, fmt,...) \
do { } while (0)
#endif /* !ENABLE_DEBUG */
#define VIR_INFO_INT(category, f, l, fmt,...) \
virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, __VA_ARGS__)
#define VIR_WARN_INT(category, f, l, fmt,...) \
virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, __VA_ARGS__)
#define VIR_ERROR_INT(category, f, l, fmt,...) \
virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, __VA_ARGS__)
#else
#define VIR_DEBUG_INT(category, f, l, fmt,...) \
do { } while (0)
#define VIR_INFO_INT(category, f, l, fmt,...) \
do { } while (0)
#define VIR_WARN_INT(category, f, l, fmt,...) \
do { } while (0)
#define VIR_ERROR_INT(category, f, l, fmt,...) \
do { } while (0)
#endif /* !ENABLE_DEBUG */
#define VIR_DEBUG(fmt,...) \
VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, __VA_ARGS__)
@ -108,8 +103,6 @@ typedef int (*virLogOutputFunc) (const char *category, int priority,
*/
typedef void (*virLogCloseFunc) (void *data);
#ifdef ENABLE_DEBUG
extern int virLogSetDefaultPriority(int priority);
extern int virLogDefineFilter(const char *match, int priority, int flags);
extern int virLogDefineOutput(virLogOutputFunc f, virLogCloseFunc c,
@ -128,18 +121,4 @@ extern void virLogMessage(const char *category, int priority,
const char *funcname, long long linenr, int flags,
const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 6, 7);
#else /* ENABLE_DEBUG */
#define virLogSetDefaultPriority(p)
#define virLogDefineFilter(m, p, f)
#define virLogDefineOutput(func, c, d, p, f)
#define virLogStartup()
#define virLogReset()
#define virLogShutdown()
#define virLogParseFilters(f)
#define virLogParseOutputs(o)
#define virLogMessage(c, p, func, l, f, fmt, __VA_ARGS__)
#endif /* ENABLE_DEBUG */
#endif

View File

@ -349,10 +349,6 @@ __virExec(virConnectPtr conn,
} else {
childout = *outfd;
}
#ifndef ENABLE_DEBUG
} else {
childout = null;
#endif
}
if (errfd != NULL) {
@ -380,10 +376,6 @@ __virExec(virConnectPtr conn,
} else {
childerr = *errfd;
}
#ifndef ENABLE_DEBUG
} else {
childerr = null;
#endif
}
if ((pid = fork()) < 0) {