From d73658219925fb5a8ef55e6408ba3ea5c4688a58 Mon Sep 17 00:00:00 2001 From: Ondrej Oprala Date: Thu, 13 Mar 2014 10:53:16 +0100 Subject: [PATCH] libmount: further debug.h integration Signed-off-by: Ondrej Oprala --- libmount/src/init.c | 16 ++-------------- libmount/src/mountP.h | 5 ++++- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/libmount/src/init.c b/libmount/src/init.c index a14637d759..19278bb89e 100644 --- a/libmount/src/init.c +++ b/libmount/src/init.c @@ -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); diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h index 6b20f8ff09..1081c0d2fa 100644 --- a/libmount/src/mountP.h +++ b/libmount/src/mountP.h @@ -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 # include @@ -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 -- 2.47.2