]> git.ipfire.org Git - thirdparty/util-linux.git/blame - libfdisk/src/init.c
misc: Fix various typos
[thirdparty/util-linux.git] / libfdisk / src / init.c
CommitLineData
d56a7c23
KZ
1
2#include "fdiskP.h"
3
5d54d9f5
KZ
4
5/**
6 * SECTION: init
7 * @title: Library initialization
8 * @short_description: initialize debug stuff
9 *
10 */
11
2618b9cc 12UL_DEBUG_DEFINE_MASK(libfdisk);
819d9a29 13UL_DEBUG_DEFINE_MASKNAMES(libfdisk) =
03e4220d 14{
4dcea320
KZ
15 { "all", LIBFDISK_DEBUG_ALL, "info about all subsystems" },
16 { "ask", LIBFDISK_DEBUG_ASK, "fdisk dialogs" },
17 { "help", LIBFDISK_DEBUG_HELP, "this help" },
18 { "cxt", LIBFDISK_DEBUG_CXT, "library context (handler)" },
19 { "label", LIBFDISK_DEBUG_LABEL, "disk label utils" },
20 { "part", LIBFDISK_DEBUG_PART, "partition utils" },
21 { "parttype", LIBFDISK_DEBUG_PARTTYPE,"partition type utils" },
22 { "script", LIBFDISK_DEBUG_SCRIPT, "sfdisk-like scripts" },
23 { "tab", LIBFDISK_DEBUG_TAB, "table utils"},
131e38a2 24 { "wipe", LIBFDISK_DEBUG_WIPE, "wipe area utils" },
40c9c3a6 25 { "item", LIBFDISK_DEBUG_WIPE, "disklabel items" },
14ad2353
OO
26 { NULL, 0 }
27};
5d54d9f5 28
d56a7c23
KZ
29/**
30 * fdisk_init_debug:
9e930041 31 * @mask: debug mask (0xffff to enable full debugging)
d56a7c23
KZ
32 *
33 * If the @mask is not specified then this function reads
4dcea320 34 * LIBFDISK_DEBUG environment variable to get the mask.
d56a7c23
KZ
35 *
36 * Already initialized debugging stuff cannot be changed. It does not
37 * have effect to call this function twice.
5d54d9f5
KZ
38 *
39 * It's strongly recommended to use fdisk_init_debug(0) in your code.
d56a7c23
KZ
40 */
41void fdisk_init_debug(int mask)
42{
4dcea320
KZ
43 if (libfdisk_debug_mask)
44 return;
45
46 __UL_INIT_DEBUG(libfdisk, LIBFDISK_DEBUG_, mask, LIBFDISK_DEBUG);
47
48
49 if (libfdisk_debug_mask != LIBFDISK_DEBUG_INIT
50 && libfdisk_debug_mask != (LIBFDISK_DEBUG_HELP|LIBFDISK_DEBUG_INIT)) {
51
52 DBG(INIT, ul_debug("library debug mask: 0x%04x", libfdisk_debug_mask));
53 }
54
55 ON_DBG(HELP, ul_debug_print_masks("LIBFDISK_DEBUG",
56 UL_DEBUG_MASKNAMES(libfdisk)));
d56a7c23 57}