summaryrefslogtreecommitdiff
path: root/shlibs/mount/src/init.c
diff options
context:
space:
mode:
authorLaMont Jones <lamont@debian.org>2010-08-02 23:02:28 -0600
committerLaMont Jones <lamont@debian.org>2010-08-02 23:02:28 -0600
commit0864d694ca05ea9383ef09bc1bc3a182e15e2ffa (patch)
tree2e5237f1d4e2cac2efad97ce31abc386c1e37b6d /shlibs/mount/src/init.c
parent3cbdfd84fde6159d7778e70618fbbc8df219cafe (diff)
parent6c91f5e3e1de32c45ea0b38227ce35eb43eb2ebc (diff)
downloadutil-linux-old-0864d694ca05ea9383ef09bc1bc3a182e15e2ffa.tar.gz
Merge remote branch 'origin/master'
Conflicts: mount/Makefile.am sys-utils/ipcs.c tests/ts/blkid/images-fs/befs.img.bz2 tests/ts/blkid/images-fs/ddf-raid.img.bz2
Diffstat (limited to 'shlibs/mount/src/init.c')
-rw-r--r--shlibs/mount/src/init.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/shlibs/mount/src/init.c b/shlibs/mount/src/init.c
new file mode 100644
index 00000000..68c13f94
--- /dev/null
+++ b/shlibs/mount/src/init.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2008 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 <stdlib.h>
+
+#include "mountP.h"
+
+int libmount_debug_mask;
+
+/**
+ * mnt_init_debug:
+ * @mask: debug mask (0xffff to enable full debuging)
+ *
+ * If the @mask is not specified then this function reads
+ * LIBMOUNT_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 mnt_init_debug(int mask)
+{
+ if (libmount_debug_mask & DEBUG_INIT)
+ return;
+ if (!mask) {
+ char *str = mnt_getenv_safe("LIBMOUNT_DEBUG");
+ if (str)
+ libmount_debug_mask = strtoul(str, 0, 0);
+ } else
+ libmount_debug_mask = mask;
+
+ if (libmount_debug_mask)
+ printf("libmount: debug mask set to 0x%04x.\n",
+ libmount_debug_mask);
+ libmount_debug_mask |= DEBUG_INIT;
+}