summaryrefslogtreecommitdiffstats
path: root/misc-utils/blkid.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils/blkid.c')
-rw-r--r--misc-utils/blkid.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
index 8179a6ac4..e94edfcf2 100644
--- a/misc-utils/blkid.c
+++ b/misc-utils/blkid.c
@@ -58,6 +58,7 @@ struct blkid_control {
lowprobe:1,
lowprobe_superblocks:1,
lowprobe_topology:1,
+ no_part_details:1,
raw_chars:1;
};
@@ -101,6 +102,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_( " -O, --offset <offset> probe at the given offset\n"), out);
fputs(_( " -u, --usages <list> filter by \"usage\" (e.g. -u filesystem,raid)\n"), out);
fputs(_( " -n, --match-types <list> filter by filesystem type (e.g. -n vfat,ext3)\n"), out);
+ fputs(_( " -D, --no-part-details don't print info from partition table\n"), out);
fputs(USAGE_SEPARATOR, out);
printf(USAGE_HELP_OPTIONS(28));
@@ -444,7 +446,7 @@ done:
return rc;
}
-static int lowprobe_superblocks(blkid_probe pr)
+static int lowprobe_superblocks(blkid_probe pr, struct blkid_control *ctl)
{
struct stat st;
int rc, fd = blkid_probe_get_fd(pr);
@@ -470,7 +472,8 @@ static int lowprobe_superblocks(blkid_probe pr)
return 0; /* partition table detected */
}
- blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS);
+ if (!ctl->no_part_details)
+ blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS);
blkid_probe_enable_superblocks(pr, 1);
return blkid_do_safeprobe(pr);
@@ -509,7 +512,7 @@ static int lowprobe_device(blkid_probe pr, const char *devname,
if (ctl->lowprobe_topology)
rc = lowprobe_topology(pr);
if (rc >= 0 && ctl->lowprobe_superblocks)
- rc = lowprobe_superblocks(pr);
+ rc = lowprobe_superblocks(pr, ctl);
if (rc < 0)
goto done;
@@ -530,8 +533,8 @@ static int lowprobe_device(blkid_probe pr, const char *devname,
continue;
if (ctl->show[0] && !has_item(ctl, name))
continue;
- len = strnlen((char *) data, len);
- print_value(ctl, num++, devname, (char *) data, name, len);
+ len = strnlen(data, len);
+ print_value(ctl, num++, devname, data, name, len);
}
if (first)
@@ -661,6 +664,7 @@ int main(int argc, char **argv)
static const struct option longopts[] = {
{ "cache-file", required_argument, NULL, 'c' },
{ "no-encoding", no_argument, NULL, 'd' },
+ { "no-part-details", no_argument, NULL, 'D' },
{ "garbage-collect", no_argument, NULL, 'g' },
{ "output", required_argument, NULL, 'o' },
{ "list-filesystems", no_argument, NULL, 'k' },
@@ -694,7 +698,7 @@ int main(int argc, char **argv)
strutils_set_exitcode(BLKID_EXIT_OTHER);
while ((c = getopt_long (argc, argv,
- "c:dghilL:n:ko:O:ps:S:t:u:U:w:Vv", longopts, NULL)) != -1) {
+ "c:DdghilL:n:ko:O:ps:S:t:u:U:w:Vv", longopts, NULL)) != -1) {
err_exclusive_options(c, NULL, excl, excl_st);
@@ -705,6 +709,9 @@ int main(int argc, char **argv)
case 'd':
ctl.raw_chars = 1;
break;
+ case 'D':
+ ctl.no_part_details = 1;
+ break;
case 'L':
ctl.eval = 1;
search_value = xstrdup(optarg);