]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: further debug.h integration
authorOndrej Oprala <ooprala@redhat.com>
Thu, 13 Mar 2014 09:53:16 +0000 (10:53 +0100)
committerOndrej Oprala <ooprala@redhat.com>
Thu, 13 Mar 2014 10:03:23 +0000 (11:03 +0100)
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
libmount/src/init.c
libmount/src/mountP.h

index a14637d7596c931b564ad509b644905c9472ea26..19278bb89ed8d740a8529b5221958ab11641fe32 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "mountP.h"
 
-int libmount_debug_mask;
+UL_DEBUG_DEFINE_MASK(libmount);
 
 /**
  * mnt_init_debug:
@@ -29,24 +29,12 @@ int libmount_debug_mask;
  */
 void mnt_init_debug(int mask)
 {
-       if (libmount_debug_mask & MNT_DEBUG_INIT)
-               return;
-       if (!mask) {
-               char *str = getenv("LIBMOUNT_DEBUG");
-               if (str)
-                       libmount_debug_mask = strtoul(str, 0, 0);
-       } else
-               libmount_debug_mask = mask;
-
-       libmount_debug_mask |= MNT_DEBUG_INIT;
+       INIT_DBG(mask);
 
        if (libmount_debug_mask != MNT_DEBUG_INIT) {
                const char *ver = NULL;
                const char **features = NULL, **p;
 
-               DBG(INIT, mnt_debug("library debug mask: 0x%04x",
-                               libmount_debug_mask));
-
                mnt_get_library_version(&ver);
                mnt_get_library_features(&features);
 
index 6b20f8ff09d4c837a86b979f85279e832b9dc2df..1081c0d2fa755f1128aa407a4ef5a11b8203e97b 100644 (file)
@@ -53,6 +53,8 @@
 #define MNT_DEBUG_DIFF         (1 << 11)
 #define MNT_DEBUG_ALL          0xFFFF
 
+#define MNT_DEF_FLAG(m) UL_DEFINE_FLAG(MNT_DEBUG_, m)
+
 #ifdef CONFIG_LIBMOUNT_DEBUG
 # include <stdio.h>
 # include <stdarg.h>
@@ -79,7 +81,7 @@
                                        fflush(stderr); \
                        } while(0)
 
-extern int libmount_debug_mask;
+UL_DEBUG_DECLARE_MASK(libmount);
 
 static inline void __attribute__ ((__format__ (__printf__, 1, 2)))
 mnt_debug(const char *mesg, ...)
@@ -108,6 +110,7 @@ mnt_debug_h(void *handler, const char *mesg, ...)
 # define WARN_REFCOUNT(m,o,r)  do { ; } while (0)
 # define ON_DBG(m,x) do { ; } while (0)
 # define DBG(m,x) do { ; } while (0)
+# define INIT_DBG(m,x) do { ; } while (0)
 # define DBG_FLUSH do { ; } while(0)
 #endif