blkid_evaluate_spec
</SECTION>
+<SECTION>
+<FILE>init</FILE>
+blkid_init_debug
+</SECTION>
+
<SECTION>
<FILE>cache</FILE>
blkid_cache
include/list.h \
\
libblkid/src/blkidP.h \
+ libblkid/src/init.c \
libblkid/src/cache.c \
libblkid/src/config.c \
libblkid/src/dev.c \
#endif
/* cache.c */
+extern void blkid_init_debug(int mask);
extern void blkid_put_cache(blkid_cache cache);
extern int blkid_get_cache(blkid_cache *cache, const char *filename);
extern void blkid_gc_cache(blkid_cache cache);
global:
blkid_probe_step_back;
blkid_parttable_get_id;
+ blkid_init_debug;
} BLKID_2.21;
#ifdef CONFIG_BLKID_DEBUG
# include <stdio.h>
# include <stdarg.h>
-extern int blkid_debug_mask;
-extern void blkid_init_debug(int mask);
+extern int libblkid_debug_mask;
extern void blkid_debug_dump_dev(blkid_dev dev);
extern void blkid_debug_dump_tag(blkid_tag tag);
# define DBG(m,x) do { \
- if ((BLKID_DEBUG_ ## m) & blkid_debug_mask) { \
+ if ((BLKID_DEBUG_ ## m) & libblkid_debug_mask) { \
fprintf(stderr, "%d: libblkid: %8s: ", getpid(), # m); \
x; \
} \
#else /* !CONFIG_BLKID_DEBUG */
# define DBG(m,x) do { ; } while (0)
-# define blkid_init_debug(x)
#endif /* CONFIG_BLKID_DEBUG */
/* devno.c */
#include "blkidP.h"
#include "env.h"
-int blkid_debug_mask = 0;
-
/**
* SECTION:cache
* @title: Cache
* locate these devices without enumerating only visible devices, so the use of
* the cache file is required in this situation.
*/
-#ifdef CONFIG_BLKID_DEBUG
-void blkid_init_debug(int mask)
-{
- if (blkid_debug_mask & BLKID_DEBUG_INIT)
- return;
-
- if (!mask)
- {
- char *dstr = getenv("LIBBLKID_DEBUG");
- if (dstr)
- blkid_debug_mask = strtoul(dstr, 0, 0);
- } else
- blkid_debug_mask = mask;
-
- if (blkid_debug_mask)
- fprintf(stderr, "libblkid: debug mask set to 0x%04x.\n", blkid_debug_mask);
-
- blkid_debug_mask |= BLKID_DEBUG_INIT;
-}
-#endif
-
static const char *get_default_cache_filename(void)
{
struct stat st;
--- /dev/null
+/*
+ * 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 && 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));
+ }
+}