summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/mountP.h
diff options
context:
space:
mode:
authorKarel Zak2010-09-13 17:06:18 +0200
committerKarel Zak2011-01-03 12:28:42 +0100
commit3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d (patch)
tree5813da0ccbd778cb7e79f42eb39de43aadd1d000 /shlibs/mount/src/mountP.h
parentlibmount: add new psetudo filesystems (diff)
downloadkernel-qcow2-util-linux-3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d.tar.gz
kernel-qcow2-util-linux-3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d.tar.xz
kernel-qcow2-util-linux-3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d.zip
libmount: rewrite DBG() macro
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/mountP.h')
-rw-r--r--shlibs/mount/src/mountP.h54
1 files changed, 42 insertions, 12 deletions
diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h
index 444d0d776..ff3d21dc3 100644
--- a/shlibs/mount/src/mountP.h
+++ b/shlibs/mount/src/mountP.h
@@ -34,21 +34,51 @@
#define CONFIG_LIBMOUNT_DEBUG
#endif
-#define DEBUG_INIT (1 << 1)
-#define DEBUG_CACHE (1 << 2)
-#define DEBUG_OPTIONS (1 << 3)
-#define DEBUG_LOCKS (1 << 4)
-#define DEBUG_TAB (1 << 5)
-#define DEBUG_MTAB (1 << 6)
-#define DEBUG_UTILS (1 << 7)
-#define DEBUG_ALL 0xFFFF
+#define MNT_DEBUG_INIT (1 << 1)
+#define MNT_DEBUG_CACHE (1 << 2)
+#define MNT_DEBUG_OPTIONS (1 << 3)
+#define MNT_DEBUG_LOCKS (1 << 4)
+#define MNT_DEBUG_TAB (1 << 5)
+#define MNT_DEBUG_MTAB (1 << 6)
+#define MNT_DEBUG_UTILS (1 << 7)
+#define MNT_DEBUG_CXT (1 << 8)
+#define MNT_DEBUG_ALL 0xFFFF
#ifdef CONFIG_LIBMOUNT_DEBUG
-#include <stdio.h>
+# include <stdio.h>
+# include <stdarg.h>
+
+# define DBG(m,x) do { \
+ if ((MNT_DEBUG_ ## m) & libmount_debug_mask) {\
+ fprintf(stderr, "libmount: %s: ", # m); \
+ x; \
+ } \
+ } while(0)
+
extern int libmount_debug_mask;
-#define DBG(m,x) if ((m) & libmount_debug_mask) x
-#else
-#define DBG(m,x)
+
+static inline void mnt_debug(const char *mesg, ...)
+{
+ va_list ap;
+ va_start(ap, mesg);
+ vfprintf(stderr, mesg, ap);
+ va_end(ap);
+ fputc('\n', stderr);
+}
+
+static inline void mnt_debug_h(void *handler, const char *mesg, ...)
+{
+ va_list ap;
+
+ fprintf(stderr, "[%p]: ", handler);
+ va_start(ap, mesg);
+ vfprintf(stderr, mesg, ap);
+ va_end(ap);
+ fputc('\n', stderr);
+}
+
+#else /* !CONFIG_LIBMOUNT_DEBUG */
+# define DBG(m,x)
#endif
/* extension for files in the /etc/fstab.d directory */