diff options
author | Karel Zak | 2012-11-30 15:27:41 +0100 |
---|---|---|
committer | Karel Zak | 2013-03-11 11:20:40 +0100 |
commit | d56a7c2330d2a361d3820f8ad9a5399fec47afae (patch) | |
tree | 79cb30cd341e869208dd79d74a45b2c7faedb815 /libfdisk/src/init.c | |
parent | tests: add fdisk GPT test (diff) | |
download | kernel-qcow2-util-linux-d56a7c2330d2a361d3820f8ad9a5399fec47afae.tar.gz kernel-qcow2-util-linux-d56a7c2330d2a361d3820f8ad9a5399fec47afae.tar.xz kernel-qcow2-util-linux-d56a7c2330d2a361d3820f8ad9a5399fec47afae.zip |
libfdisk: add basic library files
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/init.c')
-rw-r--r-- | libfdisk/src/init.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libfdisk/src/init.c b/libfdisk/src/init.c new file mode 100644 index 000000000..7d875ee8f --- /dev/null +++ b/libfdisk/src/init.c @@ -0,0 +1,33 @@ + +#include "fdiskP.h" + +int fdisk_debug_mask; + + +/** + * fdisk_init_debug: + * @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. + * + * Already initialized debugging stuff cannot be changed. It does not + * have effect to call this function twice. + */ +void fdisk_init_debug(int mask) +{ + if (fdisk_debug_mask & FDISK_DEBUG_INIT) + return; + if (!mask) { + char *str = getenv("LIBFDISK_DEBUG"); + if (str) + fdisk_debug_mask = strtoul(str, 0, 0); + } else + fdisk_debug_mask = mask; + + if (fdisk_debug_mask) + fprintf(stderr, "libfdisk: debug mask set to 0x%04x.\n", + fdisk_debug_mask); + + fdisk_debug_mask |= FDISK_DEBUG_INIT; +} |