[libvirt] [PATCH] Don't disable all logging with --disable-debug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch changes the automake conditional for debugging to
disable only the debug output, not the entire logging module.
Since the logging symbols are always visible now, I moved them to
libvirt_private.syms and got rid of libvirt_debug.syms. I noticed
that debugFlag wasn't being used anymore, so I removed that too.

There was some code in __virExec where if you called with NULLs
for childout and childerr, it would conditionally set the fds to
either -1 or the /dev/null fd depending on ENABLE_DEBUG. I'm not
sure why the difference, but it seemed safe to remove the entire
conditional section since either setting is effectively treated
the same way in the following code.

Signed-off-by: Amy Griffis <amy.griffis@xxxxxx>


diff --git a/src/Makefile.am b/src/Makefile.am
index f65e7ad..23a1843 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -498,10 +498,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
@@ -517,7 +513,6 @@ endif
 EXTRA_DIST += \
   libvirt_public.syms		\
   libvirt_private.syms		\
-  libvirt_debug.syms		\
   libvirt_driver_modules.syms	\
   libvirt_bridge.syms		\
   libvirt_linux.syms
diff --git a/src/libvirt.c b/src/libvirt.c
index bf49018..bcb707e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -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,
diff --git a/src/libvirt_debug.syms b/src/libvirt_debug.syms
deleted file mode 100644
index 1742a0b..0000000
--- a/src/libvirt_debug.syms
+++ /dev/null
@@ -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;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 309d7f9..3958d9b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -192,6 +192,18 @@ virRegisterStorageDriver;
 virRegisterDeviceMonitor;
 
 
+# logging.h
+virLogMessage;
+virLogSetDefaultPriority;
+virLogDefineFilter;
+virLogDefineOutput;
+virLogParseFilters;
+virLogParseOutputs;
+virLogStartup;
+virLogShutdown;
+virLogReset;
+
+
 # memory.h
 virAlloc;
 virAllocN;
diff --git a/src/logging.c b/src/logging.c
index 83e07cc..fd1d5d4 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -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 */
 
diff --git a/src/logging.h b/src/logging.h
index 7ea8935..d99bb31 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -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
diff --git a/src/util.c b/src/util.c
index 8b746f5..408e17a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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) {

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]