]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findfs: add ability to work with PART{UUID,LABEL}= too
authorKarel Zak <kzak@redhat.com>
Fri, 28 Mar 2014 09:36:05 +0000 (10:36 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 28 Mar 2014 09:36:05 +0000 (10:36 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findfs.8
misc-utils/findfs.c

index 1469df2dc80eb02cb0990ce50f5af4f832a7c5b9..32b74b423f8db69361996427af9131832376b096 100644 (file)
@@ -7,19 +7,45 @@
 findfs \- find a filesystem by label or UUID
 .SH SYNOPSIS
 .B findfs
-.BI LABEL= label
-.sp
-.B findfs
-.BI UUID= uuid
+.BI NAME= value
 .SH DESCRIPTION
 .B findfs
-will search the disks in the system looking for a filesystem which has
-a label matching
-.I label
-or a UUID equal to
-.IR uuid .
-If the filesystem is found, the device name for the filesystem will
-be printed on stdout.
+will search the block devices in the system looking for a filesystem or
+partition with specified tag. The currently supported tags are:
+.TP
+.B LABEL=<label>
+Specifies filesystem label.
+.TP
+.B UUID=<uuid>
+Specifies filesystem UUID.
+.TP
+.B PARTUUID=<uuid>
+Specifies partition UUID. This partition identifier is supported for example for
+GUID  Partition  Table (GPT) partition tables.
+.TP
+.B PARTLABEL=<label>
+Specifies partition label (name). The partition labels are supported for example for
+GUID Partition Table (GPT) or MAC partition tables.
+.PP
+If the filesystem or partition is found, the device name will be printed on
+stdout.
+
+The complete overview about filesystems and partitions you can get for example
+by
+.RS
+
+.br
+.BI "lsblk \-\-fs"
+.br
+
+.BI "partx --show <disk>"
+.br
+
+.BI blkid
+.br
+
+.RE
+
 .PP
 .SH "EXIT STATUS"
 .RS
@@ -50,7 +76,8 @@ Karel Zak
 enables debug output.
 .SH SEE ALSO
 .BR blkid (8),
-.BR fsck (8)
+.BR lsblk (8),
+.BR partx (8)
 .SH AVAILABILITY
 The findfs command is part of the util-linux package and is available from
 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
index 23d121b0bd2245b247b3ea1fc1341d9a9ae99d09..59f9ce072032900402536d1d28a599046339104b 100644 (file)
@@ -25,8 +25,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
 {
        FILE *out = rc ? stderr : stdout;
        fputs(USAGE_HEADER, out);
-       fprintf(out, _(" %1$s [options] LABEL=<label>\n"
-                      " %1$s [options] UUID=<uuid>\n"),
+       fprintf(out, _(" %s [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value>\n"),
                program_invocation_short_name);
        fputs(USAGE_OPTIONS, out);
        fputs(USAGE_HELP, out);
@@ -37,7 +36,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
 
 int main(int argc, char **argv)
 {
-       char    *dev, *tk, *vl;
+       char    *dev;
 
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
@@ -49,23 +48,17 @@ int main(int argc, char **argv)
                 * with version from e2fsprogs */
                usage(FINDFS_USAGE_ERROR);
 
-       if (!strncmp(argv[1], "LABEL=", 6)) {
-               tk = "LABEL";
-               vl = argv[1] + 6;
-       } else if (!strncmp(argv[1], "UUID=", 5)) {
-               tk = "UUID";
-               vl = argv[1] + 5;
-       } else if (strcmp(argv[1], "-V") == 0 ||
+       if (strcmp(argv[1], "-V") == 0 ||
                   strcmp(argv[1], "--version") == 0) {
                printf(UTIL_LINUX_VERSION);
                return FINDFS_SUCCESS;
        } else if (strcmp(argv[1], "-h") == 0 ||
                   strcmp(argv[1], "--help") == 0) {
                usage(FINDFS_SUCCESS);
-       } else
+       } else if (argv[1][0] == '-')
                usage(FINDFS_USAGE_ERROR);
 
-       dev = blkid_evaluate_tag(tk, vl, NULL);
+       dev = blkid_evaluate_tag(argv[1], NULL, NULL);
        if (!dev)
                errx(FINDFS_NOT_FOUND, _("unable to resolve '%s'"), argv[1]);