#define ON_DBG(m, x) __UL_DBG_CALL(libblkid, BLKID_DEBUG_, m, x)
extern void blkid_debug_dump_dev(blkid_dev dev);
-extern void blkid_debug_dump_tag(blkid_tag tag);
/* devno.c */
blkid_init_debug(0);
- DBG(CACHE, ul_debug("creating blkid cache (using %s)",
- filename ? filename : "default cache"));
-
if (!(cache = calloc(1, sizeof(struct blkid_struct_cache))))
return -BLKID_ERR_MEM;
+ DBG(CACHE, ul_debugobj(cache, "alloc (from %s)", filename ? filename : "default cache"));
INIT_LIST_HEAD(&cache->bic_devs);
INIT_LIST_HEAD(&cache->bic_tags);
(void) blkid_flush_cache(cache);
- DBG(CACHE, ul_debug("freeing cache struct"));
+ DBG(CACHE, ul_debugobj(cache, "freeing cache struct"));
/* DBG(CACHE, ul_debug_dump_cache(cache)); */
blkid_free_dev(dev);
}
+ DBG(CACHE, ul_debugobj(cache, "freeing cache tag heads"));
while (!list_empty(&cache->bic_tags)) {
blkid_tag tag = list_entry(cache->bic_tags.next,
struct blkid_struct_tag,
struct blkid_struct_tag,
bit_names);
- DBG(CACHE, ul_debug("warning: unfreed tag %s=%s",
+ DBG(CACHE, ul_debugobj(cache, "warning: unfreed tag %s=%s",
bad->bit_name, bad->bit_val));
blkid_free_tag(bad);
}
list_for_each_safe(p, pnext, &cache->bic_devs) {
blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
if (stat(dev->bid_name, &st) < 0) {
- DBG(CACHE, ul_debug("freeing %s", dev->bid_name));
+ DBG(CACHE, ul_debugobj(cache, "freeing non-exiting %s", dev->bid_name));
blkid_free_dev(dev);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
} else {
if (!(dev = calloc(1, sizeof(struct blkid_struct_dev))))
return NULL;
+ DBG(DEV, ul_debugobj(dev, "alloc"));
INIT_LIST_HEAD(&dev->bid_devs);
INIT_LIST_HEAD(&dev->bid_tags);
if (!dev)
return;
- DBG(DEV,
- ul_debug(" freeing dev %s (%s)", dev->bid_name, dev->bid_type ?
- dev->bid_type : "(null)"));
- DBG(DEV, blkid_debug_dump_dev(dev));
+ DBG(DEV, ul_debugobj(dev, "freeing (%s)", dev->bid_name));
list_del(&dev->bid_devs);
while (!list_empty(&dev->bid_tags)) {
(ret = parse_xml(&name, &value, cp)) <= 0 */)
return ret;
+ DBG(READ, ul_debug("tag: %s=\"%s\"", name, value));
+
/* Some tags are stored directly in the device struct */
if (!strcmp(name, "DEVNO"))
dev->bid_devno = strtoull(value, 0, 0);
} else
ret = blkid_set_tag(dev, name, value, strlen(value));
- DBG(READ, ul_debug(" tag: %s=\"%s\"", name, value));
-
return ret < 0 ? ret : 1;
}
goto done;
}
- DBG(READ, blkid_debug_dump_dev(dev));
+ /*DBG(READ, blkid_debug_dump_dev(dev));*/
done:
return ret;
if (!(tag = calloc(1, sizeof(struct blkid_struct_tag))))
return NULL;
+ DBG(TAG, ul_debugobj(tag, "alloc"));
INIT_LIST_HEAD(&tag->bit_tags);
INIT_LIST_HEAD(&tag->bit_names);
return tag;
}
-void blkid_debug_dump_tag(blkid_tag tag)
-{
- if (!tag) {
- fprintf(stderr, " tag: NULL\n");
- return;
- }
-
- fprintf(stderr, " tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
-}
-
void blkid_free_tag(blkid_tag tag)
{
if (!tag)
return;
- DBG(TAG, ul_debug(" freeing tag %s=%s", tag->bit_name,
- tag->bit_val ? tag->bit_val : "(NULL)"));
- DBG(TAG, blkid_debug_dump_tag(tag));
+ DBG(TAG, ul_debugobj(tag, "freeing tag %s (%s)", tag->bit_name, tag->bit_val));
list_del(&tag->bit_tags); /* list of tags for this device */
list_del(&tag->bit_names); /* list of tags with this type */
list_for_each(p, &cache->bic_tags) {
tmp = list_entry(p, struct blkid_struct_tag, bit_tags);
if (!strcmp(tmp->bit_name, type)) {
- DBG(TAG, ul_debug(" found cache tag head %s", type));
+ DBG(TAG, ul_debug("found cache tag head %s", type));
head = tmp;
break;
}
free(val);
return 0;
}
+ DBG(TAG, ul_debugobj(t, "update (%s) '%s' -> '%s'", t->bit_name, t->bit_val, val));
free(t->bit_val);
t->bit_val = val;
} else {
t->bit_val = val;
t->bit_dev = dev;
+ DBG(TAG, ul_debugobj(t, "setting (%s) '%s'", t->bit_name, t->bit_val));
list_add_tail(&t->bit_tags, &dev->bid_tags);
if (dev->bid_cache) {
if (!head)
goto errout;
- DBG(TAG, ul_debug(" creating new cache tag head %s", name));
+ DBG(TAG, ul_debugobj(head, "creating new cache tag head %s", name));
head->bit_name = strdup(name);
if (!head->bit_name)
goto errout;