]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
dumpe2fs: add support for LABEL= and UUID= specifiers for the device
authorTheodore Ts'o <tytso@mit.edu>
Thu, 5 Dec 2024 05:23:09 +0000 (00:23 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 5 Dec 2024 05:23:09 +0000 (00:23 -0500)
The e2mmpstatus man page claims that it will support LABEL= and UUID=
specifiers, and these days e2mmpstatus is implemented in terms of
dumpe2fs.  So teach dumpe2fs to handle these specifiers so we can make
the e2mmpstatus man page be true.

https://github.com/tytso/e2fsprogs/issues/106

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/dumpe2fs.8.in
misc/dumpe2fs.c

index dd27804ee48df7d4419bd1b40a3f351ece774d05..2806a2b7676ec6099638a8176ca3d6f6d40c8a45 100644 (file)
@@ -23,6 +23,12 @@ prints the super block and blocks group information for the file system
 present on
 .I device.
 .PP
+The
+.I device
+specifier can either be a filename (i.e., /dev/sda1), or a LABEL or UUID
+specifier: "\fBLABEL=\fIvolume-label\fR" or "\fBUUID=\fIuuid\fR".  (i.e.,
+LABEL=home or UUID=e40486c6-84d5-4f2f-b99c-032281799c9d).
+.PP
 .B Note:
 When used with a mounted file system, the printed
 information may be old or inconsistent.
index d2d57fb0a731d43ac7cc957d357d0d74520c2070..b56d15d98caa473e9d70066b0016c4532a57507a 100644 (file)
@@ -40,6 +40,7 @@ extern int optind;
 #include "ext2fs/kernel-jbd.h"
 #include <uuid/uuid.h>
 
+#include "support/devname.h"
 #include "support/nls-enable.h"
 #include "support/plausible.h"
 #include "../version.h"
@@ -673,7 +674,12 @@ int main (int argc, char ** argv)
        if (optind != argc - 1)
                usage();
 
-       device_name = argv[optind++];
+       device_name = get_devname(NULL, argv[optind++], NULL);
+       if (!device_name) {
+               com_err(program_name, 0, _("Unable to resolve '%s'"),
+                       argv[1]);
+               exit(1);
+       }
        flags = EXT2_FLAG_JOURNAL_DEV_OK | EXT2_FLAG_SOFTSUPP_FEATURES |
                EXT2_FLAG_64BITS | EXT2_FLAG_THREADS;
        if (force)