Whamcloud - gitweb
Clean up the debugging code in the blkid library so that we don't use
authorTheodore Ts'o <tytso@mit.edu>
Sat, 7 May 2005 18:22:38 +0000 (14:22 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 7 May 2005 18:22:38 +0000 (14:22 -0400)
the inline functions DEB_DUMP_* and instead use the private functions
blkid_debug_dump_*().

lib/blkid/ChangeLog
lib/blkid/blkidP.h
lib/blkid/cache.c
lib/blkid/dev.c
lib/blkid/read.c
lib/blkid/tag.c

index f558da8..6bb62b2 100644 (file)
@@ -1,5 +1,9 @@
 2005-05-07  Theodore Ts'o  <tytso@mit.edu>
 
+       * blkidP.h, cache.c, dev.c, read.c, tag.c: Clean up the debugging
+               code so that we don't use the inline functions DEB_DUMP_*
+               and instead use the private functions blkid_debug_dump_*().
+
        * tag.c (blkid_dev_has_tag): New function which returns 1 if a tag
                has a particular type and possibly value.
 
index 1bb9490..e6d8e27 100644 (file)
@@ -148,65 +148,8 @@ extern int blkid_debug_mask;
 #endif
 
 #ifdef CONFIG_BLKID_DEBUG
-static inline void DEB_DUMP_TAG(int mask, blkid_tag tag)
-{
-       if (!(mask & blkid_debug_mask))
-               return;
-       
-       if (!tag) {
-               printf("    tag: NULL\n");
-               return;
-       }
-
-       printf("    tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
-}
-
-static inline void DEB_DUMP_DEV(int mask, blkid_dev dev)
-{
-       struct list_head *p;
-
-       if (!(mask & blkid_debug_mask))
-               return;
-       
-       if (!dev) {
-               printf("  dev: NULL\n");
-               return;
-       }
-
-       printf("  dev: name = %s\n", dev->bid_name);
-       printf("  dev: DEVNO=\"0x%0Lx\"\n", dev->bid_devno);
-       printf("  dev: TIME=\"%lu\"\n", dev->bid_time);
-       printf("  dev: PRI=\"%d\"\n", dev->bid_pri);
-       printf("  dev: flags = 0x%08X\n", dev->bid_flags);
-
-       list_for_each(p, &dev->bid_tags) {
-               blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
-               DEB_DUMP_TAG(mask, tag);
-       }
-       printf("\n");
-}
-
-static inline void DEB_DUMP_CACHE(int mask, blkid_cache cache)
-{
-       struct list_head *p;
-
-       if (!cache || !(mask & blkid_debug_mask)) {
-               printf("cache: NULL\n");
-               return;
-       }
-
-       printf("cache: time = %lu\n", cache->bic_time);
-       printf("cache: flags = 0x%08X\n", cache->bic_flags);
-
-       list_for_each(p, &cache->bic_devs) {
-               blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
-               DEB_DUMP_DEV(mask, dev);
-       }
-}
-#else
-#define DEB_DUMP_TAG(mask, tag) do {} while (0)
-#define DEB_DUMP_DEV(mask, dev) do {} while (0)
-#define DEB_DUMP_CACHE(mask, cache) do {} while (0)
+extern void blkid_debug_dump_dev(blkid_dev dev);
+extern void blkid_debug_dump_tag(blkid_tag tag);
 #endif
 
 /* lseek.c */
index 0ecaa2d..497b0fe 100644 (file)
@@ -52,6 +52,26 @@ static char *safe_getenv(const char *arg)
 #endif
 }
 
+#if 0 /* ifdef CONFIG_BLKID_DEBUG */
+static blkid_debug_dump_cache(int mask, blkid_cache cache)
+{
+       struct list_head *p;
+
+       if (!cache) {
+               printf("cache: NULL\n");
+               return;
+       }
+
+       printf("cache: time = %lu\n", cache->bic_time);
+       printf("cache: flags = 0x%08X\n", cache->bic_flags);
+
+       list_for_each(p, &cache->bic_devs) {
+               blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
+               blkid_debug_dump_dev(dev);
+       }
+}
+#endif
+
 int blkid_get_cache(blkid_cache *ret_cache, const char *filename)
 {
        blkid_cache cache;
@@ -98,7 +118,7 @@ void blkid_put_cache(blkid_cache cache)
 
        DBG(DEBUG_CACHE, printf("freeing cache struct\n"));
        
-       /* DEB_DUMP_CACHE(cache); */
+       /* DBG(DEBUG_CACHE, blkid_debug_dump_cache(cache)); */
 
        while (!list_empty(&cache->bic_devs)) {
                blkid_dev dev = list_entry(cache->bic_devs.next,
index 081bedf..3ac3195 100644 (file)
@@ -35,7 +35,7 @@ void blkid_free_dev(blkid_dev dev)
 
        DBG(DEBUG_DEV,
            printf("  freeing dev %s (%s)\n", dev->bid_name, dev->bid_type));
-       DEB_DUMP_DEV(DEBUG_DEV, dev);
+       DBG(DEBUG_DEV, blkid_debug_dump_dev(dev));
 
        list_del(&dev->bid_devs);
        while (!list_empty(&dev->bid_tags)) {
@@ -57,6 +57,30 @@ extern const char *blkid_dev_devname(blkid_dev dev)
        return dev->bid_name;
 }
 
+#ifdef CONFIG_BLKID_DEBUG
+void blkid_debug_dump_dev(blkid_dev dev)
+{
+       struct list_head *p;
+
+       if (!dev) {
+               printf("  dev: NULL\n");
+               return;
+       }
+
+       printf("  dev: name = %s\n", dev->bid_name);
+       printf("  dev: DEVNO=\"0x%0Lx\"\n", dev->bid_devno);
+       printf("  dev: TIME=\"%lu\"\n", dev->bid_time);
+       printf("  dev: PRI=\"%d\"\n", dev->bid_pri);
+       printf("  dev: flags = 0x%08X\n", dev->bid_flags);
+
+       list_for_each(p, &dev->bid_tags) {
+               blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
+               blkid_debug_dump_tag(tag);
+       }
+       printf("\n");
+}
+#endif
+
 /*
  * dev iteration routines for the public libblkid interface.
  *
index 358554c..7ea8e84 100644 (file)
@@ -359,7 +359,7 @@ static int blkid_parse_line(blkid_cache cache, blkid_dev *dev_p, char *cp)
                blkid_free_dev(dev);
        }
 
-       DEB_DUMP_DEV(DEBUG_READ, dev);
+       DBG(DEBUG_READ, blkid_debug_dump_dev(dev));
 
        return ret;
 }
index e3df150..9470ac0 100644 (file)
@@ -29,6 +29,18 @@ static blkid_tag blkid_new_tag(void)
        return tag;
 }
 
+#ifdef CONFIG_BLKID_DEBUG
+void blkid_debug_dump_tag(blkid_tag tag)
+{
+       if (!tag) {
+               printf("    tag: NULL\n");
+               return;
+       }
+
+       printf("    tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
+}
+#endif
+
 void blkid_free_tag(blkid_tag tag)
 {
        if (!tag)
@@ -36,7 +48,7 @@ void blkid_free_tag(blkid_tag tag)
 
        DBG(DEBUG_TAG, printf("    freeing tag %s=%s\n", tag->bit_name,
                   tag->bit_val ? tag->bit_val : "(NULL)"));
-       DEB_DUMP_TAG(DEBUG_TAG, tag);
+       DBG(DEBUG_TAG, blkid_debug_dump_tag(tag));
 
        list_del(&tag->bit_tags);       /* list of tags for this device */
        list_del(&tag->bit_names);      /* list of tags with this type */