Whamcloud - gitweb
Fix blkid's debugging/TEST_PROGRAM code so that it is sufficiently
authorTheodore Ts'o <tytso@mit.edu>
Mon, 27 Jun 2005 17:54:08 +0000 (13:54 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 27 Jun 2005 17:54:08 +0000 (13:54 -0400)
standalone that "make check" will compile without errors even
when configure "--enable-blkid-debug" is not specified.

lib/blkid/ChangeLog
lib/blkid/dev.c
lib/blkid/read.c

index d84c903..a3097b0 100644 (file)
@@ -1,3 +1,10 @@
+2005-06-27  Theodore Ts'o  <tytso@mit.edu>
+
+       * read.c, dev.c: Fix the debugging/TEST_PROGRAM code so that it is
+               sufficiently standalone that "make check" will compile
+               without errors even when configure "--enable-blkid-debug"
+               is not specified.
+
 2005-05-07  Theodore Ts'o  <tytso@mit.edu>
 
        * tag.c (blkid_find_dev_with_tag): If a device can't be found with
index 66a3923..adb855a 100644 (file)
@@ -75,7 +75,11 @@ void blkid_debug_dump_dev(blkid_dev dev)
 
        list_for_each(p, &dev->bid_tags) {
                blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
-               blkid_debug_dump_tag(tag);
+               if (tag)
+                       printf("    tag: %s=\"%s\"\n", tag->bit_name, 
+                              tag->bit_val);
+               else
+                       printf("    tag: NULL\n");
        }
        printf("\n");
 }
index 7ea8e84..c823d30 100644 (file)
 #include <stdlib.h>
 #endif
 
+#ifdef TEST_PROGRAM
+#define blkid_debug_dump_dev(dev)      (debug_dump_dev(dev))
+static void debug_dump_dev(blkid_dev dev);
+#endif
+
 /*
  * File format:
  *
@@ -437,6 +442,32 @@ errout:
 }
 
 #ifdef TEST_PROGRAM
+static void 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%0llx\"\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);
+               if (tag)
+                       printf("    tag: %s=\"%s\"\n", tag->bit_name, 
+                              tag->bit_val);
+               else
+                       printf("    tag: NULL\n");
+       }
+       printf("\n");
+}
+
 int main(int argc, char**argv)
 {
        blkid_cache cache = NULL;