diff options
author | Karel Zak | 2009-10-14 02:17:27 +0200 |
---|---|---|
committer | Karel Zak | 2009-10-14 02:51:30 +0200 |
commit | 2d71a929413c7afc25a836560243881b81e922c4 (patch) | |
tree | d1183200766ccd3891fa2cd6d1f2a2e241358da6 /misc-utils/blkid.c | |
parent | lib: import whole ismounted.c code from e2fsprogs (diff) | |
download | kernel-qcow2-util-linux-2d71a929413c7afc25a836560243881b81e922c4.tar.gz kernel-qcow2-util-linux-2d71a929413c7afc25a836560243881b81e922c4.tar.xz kernel-qcow2-util-linux-2d71a929413c7afc25a836560243881b81e922c4.zip |
blkid: add pretty output, document -L incompatibility with e2fsprogs
... sad story, I have temporary disabled pretty-output code
in very early version of blkid.c in u-l-ng. (It was also in
time when pretty-output was very new feature in e2fsprogs.)
Unfortunately, the -L option (shortcut to "-o list") in u-l-ng version
was reused for for any other functionality few months later.... this
stupid thing was released in u-l-ng 2.15 and 2.16 without any negative
feedback from users.
It means the blkid from u-l-ng is not backwardly compatible with
the original version from e2fsprogs. The -L option has a different
meaning there.
I'm sorry about this bug...
This patch:
* enable pretty-output (-o line)
* add a note about incompatibility between u-l-ng and e2fsprogs
to blkid.8 man page
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/blkid.c')
-rw-r--r-- | misc-utils/blkid.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index e9622c392..0182a9bb2 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -40,6 +40,8 @@ extern int optind; #include <blkid.h> +#include "ismounted.h" + const char *progname = "blkid"; static void print_version(FILE *out) @@ -186,16 +188,12 @@ static void pretty_print_line(const char *device, const char *fs_type, static void pretty_print_dev(blkid_dev dev) { - fprintf(stderr, "pretty print not implemented yet\n"); - -#ifdef NOT_IMPLEMENTED blkid_tag_iterate iter; const char *type, *value, *devname; const char *uuid = "", *fs_type = "", *label = ""; - char *cp; int len, mount_flags; char mtpt[80]; - errcode_t retval; + int retval; if (dev == NULL) { pretty_print_line("device", "fs_type", "label", @@ -224,20 +222,18 @@ static void pretty_print_dev(blkid_dev dev) /* Get the mount point */ mtpt[0] = 0; - retval = ext2fs_check_mount_point(devname, &mount_flags, - mtpt, sizeof(mtpt)); + retval = check_mount_point(devname, &mount_flags, mtpt, sizeof(mtpt)); if (retval == 0) { - if (mount_flags & EXT2_MF_MOUNTED) { + if (mount_flags & MF_MOUNTED) { if (!mtpt[0]) strcpy(mtpt, "(mounted, mtpt unknown)"); - } else if (mount_flags & EXT2_MF_BUSY) + } else if (mount_flags & MF_BUSY) strcpy(mtpt, "(in use)"); else strcpy(mtpt, "(not mounted)"); } pretty_print_line(devname, fs_type, label, mtpt, uuid); -#endif } static void print_udev_format(const char *name, const char *value, size_t sz) @@ -544,8 +540,14 @@ int main(int argc, char **argv) } err = 2; - if (output_format & OUTPUT_PRETTY_LIST) + if (eval == 0 && output_format & OUTPUT_PRETTY_LIST) { + if (lowprobe) { + fprintf(stderr, "The low-level probing mode does not " + "support 'list' output format\n"); + exit(4); + } pretty_print_dev(NULL); + } if (lowprobe) { /* @@ -554,7 +556,8 @@ int main(int argc, char **argv) blkid_probe pr; if (!numdev) { - fprintf(stderr, "The low-probe option requires a device\n"); + fprintf(stderr, "The low-level probing mode " + "requires a device\n"); exit(4); } pr = blkid_new_probe(); |