blob: bb6f950fb932b4e77bc9e2259d543bfa631541f7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* 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"
int libblkid_debug_mask;
/**
* 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 & BLKID_DEBUG_INIT)
return;
if (!mask) {
char *str = getenv("LIBBLKID_DEBUG");
if (str)
libblkid_debug_mask = strtoul(str, 0, 0);
} else
libblkid_debug_mask = mask;
libblkid_debug_mask |= BLKID_DEBUG_INIT;
if (libblkid_debug_mask != BLKID_DEBUG_INIT) {
const char *ver = NULL;
const char *date = NULL;
DBG(INIT, blkid_debug("library debug mask: 0x%04x",
libblkid_debug_mask));
blkid_get_library_version(&ver, &date);
DBG(INIT, blkid_debug("library version: %s [%s]", ver, date));
}
}
|