summaryrefslogtreecommitdiffstats
path: root/libblkid/src/init.c
diff options
context:
space:
mode:
authorbigbiff <bigbiff@teamw.in>2015-01-02 01:44:14 +0100
committerDees Troy <dees_troy@teamw.in>2015-01-05 04:38:42 +0100
commit7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de (patch)
treefb69cb515cb4ab675d5850684cc402100b7a2a22 /libblkid/src/init.c
parentcrypto: remove unused libs and clean up makefile (diff)
downloadandroid_bootable_recovery-7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de.tar
android_bootable_recovery-7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de.tar.gz
android_bootable_recovery-7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de.tar.bz2
android_bootable_recovery-7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de.tar.lz
android_bootable_recovery-7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de.tar.xz
android_bootable_recovery-7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de.tar.zst
android_bootable_recovery-7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de.zip
Diffstat (limited to 'libblkid/src/init.c')
-rw-r--r--libblkid/src/init.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/libblkid/src/init.c b/libblkid/src/init.c
new file mode 100644
index 000000000..eead6c7df
--- /dev/null
+++ b/libblkid/src/init.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2008-2013 Karel Zak <kzak@redhat.com>
+ *
+ * This file may be redistributed under the terms of the
+ * GNU Lesser General Public License.
+ */
+
+/**
+ * SECTION: init
+ * @title: Library initialization
+ * @short_description: initialize debuging
+ */
+
+#include <stdarg.h>
+
+#include "blkidP.h"
+
+UL_DEBUG_DEFINE_MASK(libblkid);
+UL_DEBUG_DEFINE_MASKNAMES(libblkid) =
+{
+ { "all", BLKID_DEBUG_ALL, "info about all subsystems" },
+ { "cache", BLKID_DEBUG_CACHE, "blkid tags cache" },
+ { "config", BLKID_DEBUG_CONFIG, "config file utils" },
+ { "dev", BLKID_DEBUG_DEV, "device utils" },
+ { "devname", BLKID_DEBUG_DEVNAME, "/proc/partitions evaluation" },
+ { "devno", BLKID_DEBUG_DEVNO, "convertions to device name" },
+ { "evaluate", BLKID_DEBUG_EVALUATE, "tags resolving" },
+ { "help", BLKID_DEBUG_HELP, "this help" },
+ { "lowprobe", BLKID_DEBUG_LOWPROBE, "superblock/raids/partitions probing" },
+ { "probe", BLKID_DEBUG_PROBE, "devices verification" },
+ { "read", BLKID_DEBUG_READ, "cache parsing" },
+ { "save", BLKID_DEBUG_SAVE, "cache writing" },
+ { "tag", BLKID_DEBUG_TAG, "tags utils" },
+ { NULL, 0, NULL }
+};
+
+/**
+ * blkid_init_debug:
+ * @mask: debug mask (0xffff to enable full debuging)
+ *
+ * If the @mask is not specified then this function reads
+ * LIBBLKID_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 blkid_init_debug(int mask)
+{
+ if (libblkid_debug_mask)
+ return;
+
+ __UL_INIT_DEBUG(libblkid, BLKID_DEBUG_, mask, LIBBLKID_DEBUG);
+
+ if (libblkid_debug_mask != BLKID_DEBUG_INIT
+ && libblkid_debug_mask != (BLKID_DEBUG_HELP|BLKID_DEBUG_INIT)) {
+ const char *ver = NULL;
+ const char *date = NULL;
+
+ blkid_get_library_version(&ver, &date);
+ DBG(INIT, ul_debug("library debug mask: 0x%04x", libblkid_debug_mask));
+ DBG(INIT, ul_debug("library version: %s [%s]", ver, date));
+
+ }
+ ON_DBG(HELP, ul_debug_print_masks("LIBBLKID_DEBUG",
+ UL_DEBUG_MASKNAMES(libblkid)));
+}