From: Theodore Ts'o Date: Mon, 27 Jun 2005 17:54:08 +0000 (-0400) Subject: Fix blkid's debugging/TEST_PROGRAM code so that it is sufficiently X-Git-Tag: E2FSPROGS-1_38~4 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=55080a7637172402c51eb4f2fb2b81870c04de3d;p=tools%2Fe2fsprogs.git Fix blkid's 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. --- diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog index d84c903..a3097b0 100644 --- a/lib/blkid/ChangeLog +++ b/lib/blkid/ChangeLog @@ -1,3 +1,10 @@ +2005-06-27 Theodore Ts'o + + * 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 * tag.c (blkid_find_dev_with_tag): If a device can't be found with diff --git a/lib/blkid/dev.c b/lib/blkid/dev.c index 66a3923..adb855a 100644 --- a/lib/blkid/dev.c +++ b/lib/blkid/dev.c @@ -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"); } diff --git a/lib/blkid/read.c b/lib/blkid/read.c index 7ea8e84..c823d30 100644 --- a/lib/blkid/read.c +++ b/lib/blkid/read.c @@ -37,6 +37,11 @@ #include #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;