]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: use loopdev debug facility
authorKarel Zak <kzak@redhat.com>
Thu, 29 Sep 2011 21:29:46 +0000 (23:29 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 29 Sep 2011 21:29:46 +0000 (23:29 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_loopdev.c
libmount/src/mountP.h

index 084f08fa44ec2f689c25cd6b82caf3a724780cd1..377dd769e8dbb34935c308ab08457a47936ad66f 100644 (file)
@@ -86,8 +86,11 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
                DBG(CXT, mnt_debug_h(cxt, "enabling READ-ONLY flag"));
                lo_flags |= LO_FLAGS_READ_ONLY;
        }
+
        loopcxt_init(&lc, 0);
 
+       ON_DBG(CXT, loopcxt_enable_debug(&lc, 1));
+
        optstr = mnt_fs_get_user_options(cxt->fs);
 
        /*
index 92d0b26a50a0c3ccf8b6f0c011a1a84461655ef3..cce4c5c3543168194a43e5b3467a4c4818146668 100644 (file)
 # include <stdio.h>
 # include <stdarg.h>
 
-# define DBG(m,x)      do { \
-                               if ((MNT_DEBUG_ ## m) & libmount_debug_mask) {\
+# define ON_DBG(m, x)  do { \
+                               if ((MNT_DEBUG_ ## m) & libmount_debug_mask) { \
+                                       x; \
+                               } \
+                       } while (0)
+
+# define DBG(m, x)     do { \
+                               if ((MNT_DEBUG_ ## m) & libmount_debug_mask) { \
                                        fprintf(stderr, "libmount: %8s: ", # m); \
                                        x; \
                                } \
-                       } while(0)
+                       } while (0)
 
 # define DBG_FLUSH     do { fflush(stderr); } while(0)
 
@@ -87,7 +93,8 @@ mnt_debug_h(void *handler, const char *mesg, ...)
 }
 
 #else /* !CONFIG_LIBMOUNT_DEBUG */
-# define DBG(m,x) do { ; } while(0)
+# define ON_DBG(m,x) do { ; } while (0)
+# define DBG(m,x) do { ; } while (0)
 # define DBG_FLUSH do { ; } while(0)
 #endif