summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/init.c
diff options
context:
space:
mode:
authorKarel Zak2014-11-03 13:13:32 +0100
committerKarel Zak2014-11-03 13:13:32 +0100
commit4dcea3206121b430e5e8a3c5a808bd358a11d0b6 (patch)
treec54fe5bd4f1f0021a5a944eeed654c9266676dd9 /libfdisk/src/init.c
parentlibsmartcols: clean up debug, add help debug mask (diff)
downloadkernel-qcow2-util-linux-4dcea3206121b430e5e8a3c5a808bd358a11d0b6.tar.gz
kernel-qcow2-util-linux-4dcea3206121b430e5e8a3c5a808bd358a11d0b6.tar.xz
kernel-qcow2-util-linux-4dcea3206121b430e5e8a3c5a808bd358a11d0b6.zip
libfdisk: clean up debug, add help debug mask
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/init.c')
-rw-r--r--libfdisk/src/init.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/libfdisk/src/init.c b/libfdisk/src/init.c
index 1c5008073..e147a17aa 100644
--- a/libfdisk/src/init.c
+++ b/libfdisk/src/init.c
@@ -4,16 +4,15 @@
UL_DEBUG_DEFINE_MASK(libfdisk);
UL_DEBUG_DEFINE_MASKNAMES(libfdisk) =
{
- { "all", FDISK_DEBUG_ALL },
- { "ask", FDISK_DEBUG_ASK},
- { "cxt", FDISK_DEBUG_CXT },
- { "frontend", FDISK_DEBUG_FRONTEND },
- { "init", FDISK_DEBUG_INIT },
- { "label", FDISK_DEBUG_LABEL },
- { "part", FDISK_DEBUG_PART },
- { "parttype", FDISK_DEBUG_PARTTYPE },
- { "script", FDISK_DEBUG_SCRIPT},
- { "tab", FDISK_DEBUG_TAB},
+ { "all", LIBFDISK_DEBUG_ALL, "info about all subsystems" },
+ { "ask", LIBFDISK_DEBUG_ASK, "fdisk dialogs" },
+ { "help", LIBFDISK_DEBUG_HELP, "this help" },
+ { "cxt", LIBFDISK_DEBUG_CXT, "library context (handler)" },
+ { "label", LIBFDISK_DEBUG_LABEL, "disk label utils" },
+ { "part", LIBFDISK_DEBUG_PART, "partition utils" },
+ { "parttype", LIBFDISK_DEBUG_PARTTYPE,"partition type utils" },
+ { "script", LIBFDISK_DEBUG_SCRIPT, "sfdisk-like scripts" },
+ { "tab", LIBFDISK_DEBUG_TAB, "table utils"},
{ NULL, 0 }
};
/**
@@ -21,12 +20,25 @@ UL_DEBUG_DEFINE_MASKNAMES(libfdisk) =
* @mask: debug mask (0xffff to enable full debuging)
*
* If the @mask is not specified then this function reads
- * FDISK_DEBUG environment variable to get the mask.
+ * LIBFDISK_DEBUG environment variable to get the mask.
*
* Already initialized debugging stuff cannot be changed. It does not
* have effect to call this function twice.
*/
void fdisk_init_debug(int mask)
{
- __UL_INIT_DEBUG(libfdisk, FDISK_DEBUG_, mask, LIBFDISK_DEBUG);
+ if (libfdisk_debug_mask)
+ return;
+
+ __UL_INIT_DEBUG(libfdisk, LIBFDISK_DEBUG_, mask, LIBFDISK_DEBUG);
+
+
+ if (libfdisk_debug_mask != LIBFDISK_DEBUG_INIT
+ && libfdisk_debug_mask != (LIBFDISK_DEBUG_HELP|LIBFDISK_DEBUG_INIT)) {
+
+ DBG(INIT, ul_debug("library debug mask: 0x%04x", libfdisk_debug_mask));
+ }
+
+ ON_DBG(HELP, ul_debug_print_masks("LIBFDISK_DEBUG",
+ UL_DEBUG_MASKNAMES(libfdisk)));
}