From b13154de3eca5ba28fbb4854d916cd0be5febeed Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Fri, 2 Nov 2012 20:15:39 +0400 Subject: Imported Upstream version 2.22 --- libmount/src/init.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 libmount/src/init.c (limited to 'libmount/src/init.c') diff --git a/libmount/src/init.c b/libmount/src/init.c new file mode 100644 index 0000000..58d4c18 --- /dev/null +++ b/libmount/src/init.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2008 Karel Zak + * + * 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 + +#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 & MNT_DEBUG_INIT) + return; + if (!mask) { + char *str = getenv("LIBMOUNT_DEBUG"); + if (str) + libmount_debug_mask = strtoul(str, 0, 0); + } else + libmount_debug_mask = mask; + + if (libmount_debug_mask) + fprintf(stderr, "libmount: debug mask set to 0x%04x.\n", + libmount_debug_mask); + libmount_debug_mask |= MNT_DEBUG_INIT; +} -- cgit v1.2.3