]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - libblkid/src/init.c
2 * Copyright (C) 2008-2013 Karel Zak <kzak@redhat.com>
4 * This file may be redistributed under the terms of the
5 * GNU Lesser General Public License.
10 * @title: Library initialization
11 * @short_description: initialize debugging
18 UL_DEBUG_DEFINE_MASK(libblkid
);
19 UL_DEBUG_DEFINE_MASKNAMES(libblkid
) =
21 { "all", BLKID_DEBUG_ALL
, "info about all subsystems" },
22 { "cache", BLKID_DEBUG_CACHE
, "blkid tags cache" },
23 { "config", BLKID_DEBUG_CONFIG
, "config file utils" },
24 { "dev", BLKID_DEBUG_DEV
, "device utils" },
25 { "devname", BLKID_DEBUG_DEVNAME
, "/proc/partitions evaluation" },
26 { "devno", BLKID_DEBUG_DEVNO
, "conversions to device name" },
27 { "evaluate", BLKID_DEBUG_EVALUATE
, "tags resolving" },
28 { "help", BLKID_DEBUG_HELP
, "this help" },
29 { "lowprobe", BLKID_DEBUG_LOWPROBE
, "superblock/raids/partitions probing" },
30 { "buffer", BLKID_DEBUG_BUFFER
, "low-probing buffers" },
31 { "probe", BLKID_DEBUG_PROBE
, "devices verification" },
32 { "read", BLKID_DEBUG_READ
, "cache parsing" },
33 { "save", BLKID_DEBUG_SAVE
, "cache writing" },
34 { "tag", BLKID_DEBUG_TAG
, "tags utils" },
40 * @mask: debug mask (0xffff to enable full debugging)
42 * If the @mask is not specified then this function reads
43 * LIBBLKID_DEBUG environment variable to get the mask.
45 * Already initialized debugging stuff cannot be changed. It does not
46 * have effect to call this function twice.
48 void blkid_init_debug(int mask
)
50 if (libblkid_debug_mask
)
53 __UL_INIT_DEBUG_FROM_ENV(libblkid
, BLKID_DEBUG_
, mask
, LIBBLKID_DEBUG
);
55 if (libblkid_debug_mask
!= BLKID_DEBUG_INIT
56 && libblkid_debug_mask
!= (BLKID_DEBUG_HELP
|BLKID_DEBUG_INIT
)) {
57 const char *ver
= NULL
;
58 const char *date
= NULL
;
60 blkid_get_library_version(&ver
, &date
);
61 DBG(INIT
, ul_debug("library debug mask: 0x%04x", libblkid_debug_mask
));
62 DBG(INIT
, ul_debug("library version: %s [%s]", ver
, date
));
65 ON_DBG(HELP
, ul_debug_print_masks("LIBBLKID_DEBUG",
66 UL_DEBUG_MASKNAMES(libblkid
)));
69 static void __attribute__ ((constructor
)) blkid_init_default_debug(void)