From 6a2f2f58a428890a33b382876bab78c608cc7c1c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 21 Oct 2011 00:12:47 +0200 Subject: [PATCH] blkid: print ID_PART_ENTRY_* for small devices The current optimization for small devices (1.4MiB) is broken. It checks for partition table, but if nothing is detected then details (ID_PART_ENTRY_*) about the current partition are not gathered. The optimization should be enabled for small *whole* disks only. Reported-by: David Zeuthen Signed-off-by: Karel Zak --- misc-utils/blkid.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 3608304a5c..0ff89d66f5 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -454,9 +454,9 @@ static int lowprobe_superblocks(blkid_probe pr) return -1; blkid_probe_enable_partitions(pr, 1); - blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); - if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440) { + if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440 && + blkid_probe_is_wholedisk(pr)) { /* * check if the small disk is partitioned, if yes then * don't probe for filesystems. @@ -469,11 +469,9 @@ static int lowprobe_superblocks(blkid_probe pr) if (blkid_probe_lookup_value(pr, "PTTYPE", NULL, NULL) == 0) return 0; /* partition table detected */ - - /* small whole-disk is unpartitioned, probe for filesystems only */ - blkid_probe_enable_partitions(pr, 0); } + blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); blkid_probe_enable_superblocks(pr, 1); return blkid_do_safeprobe(pr); -- 2.47.2