]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - libfdisk/src/init.c
b25a876b3dbbdf1f275c897eb5b137d7d19ba6e7
7 * @title: Library initialization
8 * @short_description: initialize debug stuff
12 UL_DEBUG_DEFINE_MASK(libfdisk
);
13 UL_DEBUG_DEFINE_MASKNAMES(libfdisk
) =
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"},
24 { "wipe", LIBFDISK_DEBUG_WIPE
, "wipe area utils" },
25 { "item", LIBFDISK_DEBUG_WIPE
, "disklabel items" },
31 * @mask: debug mask (0xffff to enable full debugging)
33 * If the @mask is not specified then this function reads
34 * LIBFDISK_DEBUG environment variable to get the mask.
36 * Already initialized debugging stuff cannot be changed. It does not
37 * have effect to call this function twice.
39 * It's strongly recommended to use fdisk_init_debug(0) in your code.
41 void fdisk_init_debug(int mask
)
43 if (libfdisk_debug_mask
)
46 __UL_INIT_DEBUG_FROM_ENV(libfdisk
, LIBFDISK_DEBUG_
, mask
, LIBFDISK_DEBUG
);
49 if (libfdisk_debug_mask
!= LIBFDISK_DEBUG_INIT
50 && libfdisk_debug_mask
!= (LIBFDISK_DEBUG_HELP
|LIBFDISK_DEBUG_INIT
)) {
51 const char *ver
= NULL
;
53 fdisk_get_library_version(&ver
);
55 DBG(INIT
, ul_debug("library debug mask: 0x%04x", libfdisk_debug_mask
));
56 DBG(INIT
, ul_debug("library version: %s", ver
));
59 ON_DBG(HELP
, ul_debug_print_masks("LIBFDISK_DEBUG",
60 UL_DEBUG_MASKNAMES(libfdisk
)));