Blame SOURCES/0069-findfs-add-ability-to-work-with-PART-UUID-LABEL-too.patch

531551
From 2555bd3bad9ea8e7ae40a727f59bb546d2aa2717 Mon Sep 17 00:00:00 2001
531551
From: Karel Zak <kzak@redhat.com>
531551
Date: Fri, 28 Mar 2014 10:36:05 +0100
531551
Subject: [PATCH 69/84] findfs: add ability to work with PART{UUID,LABEL}= too
531551
531551
Upstream: http://github.com/karelzak/util-linux/commit/c48508c2faa356c48c26d7d0070a6f20ae4ba9a0
531551
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1335671
531551
Signed-off-by: Karel Zak <kzak@redhat.com>
531551
---
531551
 misc-utils/findfs.8 | 51 +++++++++++++++++++++++++++++++++++++++------------
531551
 misc-utils/findfs.c | 17 +++++------------
531551
 2 files changed, 44 insertions(+), 24 deletions(-)
531551
531551
diff --git a/misc-utils/findfs.8 b/misc-utils/findfs.8
531551
index 8a6bca1..b92cd45 100644
531551
--- a/misc-utils/findfs.8
531551
+++ b/misc-utils/findfs.8
531551
@@ -7,19 +7,45 @@
531551
 findfs \- find a filesystem by label or UUID
531551
 .SH SYNOPSIS
531551
 .B findfs
531551
-.BI LABEL= label
531551
-.sp
531551
-.B findfs
531551
-.BI UUID= uuid
531551
+.BI NAME= value
531551
 .SH DESCRIPTION
531551
 .B findfs
531551
-will search the disks in the system looking for a filesystem which has
531551
-a label matching
531551
-.I label
531551
-or a UUID equal to
531551
-.IR uuid .
531551
-If the filesystem is found, the device name for the filesystem will
531551
-be printed on stdout.
531551
+will search the block devices in the system looking for a filesystem or
531551
+partition with specified tag. The currently supported tags are:
531551
+.TP
531551
+.B LABEL=<label>
531551
+Specifies filesystem label.
531551
+.TP
531551
+.B UUID=<uuid>
531551
+Specifies filesystem UUID.
531551
+.TP
531551
+.B PARTUUID=<uuid>
531551
+Specifies partition UUID. This partition identifier is supported for example for
531551
+GUID  Partition  Table (GPT) partition tables.
531551
+.TP
531551
+.B PARTLABEL=<label>
531551
+Specifies partition label (name). The partition labels are supported for example for
531551
+GUID Partition Table (GPT) or MAC partition tables.
531551
+.PP
531551
+If the filesystem or partition is found, the device name will be printed on
531551
+stdout.
531551
+
531551
+The complete overview about filesystems and partitions you can get for example
531551
+by
531551
+.RS
531551
+
531551
+.br
531551
+.BI "lsblk \-\-fs"
531551
+.br
531551
+
531551
+.BI "partx --show <disk>"
531551
+.br
531551
+
531551
+.BI blkid
531551
+.br
531551
+
531551
+.RE
531551
+
531551
 .PP
531551
 .SH AUTHOR
531551
 .B findfs
531551
@@ -30,7 +56,8 @@ the util-linux package by Karel Zak (kzak@redhat.com).
531551
 enables debug output.
531551
 .SH SEE ALSO
531551
 .BR blkid (8),
531551
-.BR fsck (8)
531551
+.BR lsblk (8),
531551
+.BR partx (8)
531551
 .SH AVAILABILITY
531551
 The findfs command is part of the util-linux package and is available from
531551
 ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
531551
diff --git a/misc-utils/findfs.c b/misc-utils/findfs.c
531551
index bc4a843..29ca1cb 100644
531551
--- a/misc-utils/findfs.c
531551
+++ b/misc-utils/findfs.c
531551
@@ -19,8 +19,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
531551
 {
531551
 	FILE *out = rc ? stderr : stdout;
531551
 	fputs(USAGE_HEADER, out);
531551
-	fprintf(out, _(" %1$s [options] LABEL=<label>\n"
531551
-		       " %1$s [options] UUID=<uuid>\n"),
531551
+	fprintf(out, _(" %s [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value>\n"),
531551
 		program_invocation_short_name);
531551
 	fputs(USAGE_OPTIONS, out);
531551
 	fputs(USAGE_HELP, out);
531551
@@ -31,7 +30,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
531551
 
531551
 int main(int argc, char **argv)
531551
 {
531551
-	char	*dev, *tk, *vl;
531551
+	char	*dev;
531551
 
531551
 	setlocale(LC_ALL, "");
531551
 	bindtextdomain(PACKAGE, LOCALEDIR);
531551
@@ -43,23 +42,17 @@ int main(int argc, char **argv)
531551
 		 * with version from e2fsprogs */
531551
 		usage(2);
531551
 
531551
-	if (!strncmp(argv[1], "LABEL=", 6)) {
531551
-		tk = "LABEL";
531551
-		vl = argv[1] + 6;
531551
-	} else if (!strncmp(argv[1], "UUID=", 5)) {
531551
-		tk = "UUID";
531551
-		vl = argv[1] + 5;
531551
-	} else if (strcmp(argv[1], "-V") == 0 ||
531551
+	if (strcmp(argv[1], "-V") == 0 ||
531551
 		   strcmp(argv[1], "--version") == 0) {
531551
 		printf(UTIL_LINUX_VERSION);
531551
 		return EXIT_SUCCESS;
531551
 	} else if (strcmp(argv[1], "-h") == 0 ||
531551
 		   strcmp(argv[1], "--help") == 0) {
531551
 		usage(EXIT_SUCCESS);
531551
-	} else
531551
+	} else if (argv[1][0] == '-')
531551
 		usage(2);
531551
 
531551
-	dev = blkid_evaluate_tag(tk, vl, NULL);
531551
+	dev = blkid_evaluate_tag(argv[1], NULL, NULL);
531551
 	if (!dev)
531551
 		errx(EXIT_FAILURE, _("unable to resolve '%s'"),	argv[1]);
531551
 
531551
-- 
531551
2.7.4
531551