summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/cache.c
diff options
context:
space:
mode:
authorKarel Zak2010-09-13 17:06:18 +0200
committerKarel Zak2011-01-03 12:28:42 +0100
commit3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d (patch)
tree5813da0ccbd778cb7e79f42eb39de43aadd1d000 /shlibs/mount/src/cache.c
parentlibmount: add new psetudo filesystems (diff)
downloadkernel-qcow2-util-linux-3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d.tar.gz
kernel-qcow2-util-linux-3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d.tar.xz
kernel-qcow2-util-linux-3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d.zip
libmount: rewrite DBG() macro
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/cache.c')
-rw-r--r--shlibs/mount/src/cache.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c
index 7e5c4afeb..a341efd4f 100644
--- a/shlibs/mount/src/cache.c
+++ b/shlibs/mount/src/cache.c
@@ -69,7 +69,11 @@ struct _mnt_cache {
*/
mnt_cache *mnt_new_cache(void)
{
- return calloc(1, sizeof(struct _mnt_cache));
+ mnt_cache *cache = calloc(1, sizeof(struct _mnt_cache));
+ if (!cache)
+ return NULL;
+ DBG(CACHE, mnt_debug_h(cache, "alloc"));
+ return cache;
}
/**
@@ -84,6 +88,9 @@ void mnt_free_cache(mnt_cache *cache)
if (!cache)
return;
+
+ DBG(CACHE, mnt_debug_h(cache, "free"));
+
for (i = 0; i < cache->nents; i++) {
struct mnt_cache_entry *e = &cache->ents[i];
if (e->real != e->native)
@@ -122,8 +129,7 @@ static int mnt_cache_add_entry(mnt_cache *cache, char *native,
e->flag = flag;
cache->nents++;
- DBG(DEBUG_CACHE,
- printf("cache: add entry[%2zd] (%s): %s: %s\n",
+ DBG(CACHE, mnt_debug_h(cache, "add entry [%2zd] (%s): %s: %s",
cache->nents,
(flag & MNT_CACHE_ISPATH) ? "path" : "tag",
real, native));
@@ -249,7 +255,7 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname)
if (!cache || !devname)
return -EINVAL;
- DBG(DEBUG_CACHE, printf("cache: tags for %s requested\n", devname));
+ DBG(CACHE, mnt_debug_h(cache, "tags for %s requested", devname));
/* check is device is already cached */
for (i = 0; i < cache->nents; i++) {
@@ -261,8 +267,7 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname)
return 0;
}
- DBG(DEBUG_CACHE,
- printf("cache: reading tags for: %s\n", devname));
+ DBG(CACHE, mnt_debug_h(cache, "reading tags for: %s", devname));
pr = blkid_new_probe_from_filename(devname);
if (!pr)