dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/Detail-Stop-bothering1-about-md-drivers-older-than-0..patch

2c1b57
From 901d5ee6da145033ac30fee68f4fec0e8af9eddc Mon Sep 17 00:00:00 2001
2c1b57
From: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
Date: Wed, 5 Apr 2017 15:26:53 -0400
2c1b57
Subject: [RHEL7.5 PATCH 057/169] Detail: Stop bothering about md drivers
2c1b57
 older than 0.90.00
2c1b57
2c1b57
Remove further handling of md driver version older than 0.90.00
2c1b57
2c1b57
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
---
2c1b57
 Detail.c | 27 +++++++--------------------
2c1b57
 1 file changed, 7 insertions(+), 20 deletions(-)
2c1b57
2c1b57
diff --git a/Detail.c b/Detail.c
2c1b57
index fa6d4c7..d4e6204 100644
2c1b57
--- a/Detail.c
2c1b57
+++ b/Detail.c
2c1b57
@@ -54,7 +54,6 @@ int Detail(char *dev, struct context *c)
2c1b57
 	 * Print out details for an md array
2c1b57
 	 */
2c1b57
 	int fd = open(dev, O_RDONLY);
2c1b57
-	int vers;
2c1b57
 	mdu_array_info_t array;
2c1b57
 	mdu_disk_info_t *disks;
2c1b57
 	int next;
2c1b57
@@ -88,22 +87,14 @@ int Detail(char *dev, struct context *c)
2c1b57
 			dev, strerror(errno));
2c1b57
 		return rv;
2c1b57
 	}
2c1b57
-	vers = md_get_version(fd);
2c1b57
-	if (vers < 0) {
2c1b57
-		pr_err("%s does not appear to be an md device\n",
2c1b57
-			dev);
2c1b57
-		close(fd);
2c1b57
-		return rv;
2c1b57
-	}
2c1b57
-	if (vers < 9000) {
2c1b57
-		pr_err("cannot get detail for md device %s: driver version too old.\n",
2c1b57
-			dev);
2c1b57
+	sra = sysfs_read(fd, NULL, GET_VERSION|GET_DEVS);
2c1b57
+	if (!sra) {
2c1b57
+		pr_err("%s does not appear to be an md device\n", dev);
2c1b57
 		close(fd);
2c1b57
 		return rv;
2c1b57
 	}
2c1b57
-	sra = sysfs_read(fd, NULL, GET_VERSION|GET_DEVS);
2c1b57
-	external = (sra != NULL && sra->array.major_version == -1
2c1b57
-		    && sra->array.minor_version == -2);
2c1b57
+	external = (sra != NULL && sra->array.major_version == -1 &&
2c1b57
+		    sra->array.minor_version == -2);
2c1b57
 	st = super_by_fd(fd, &subarray);
2c1b57
 	if (md_get_array_info(fd, &array) == 0) {
2c1b57
 		inactive = 0;
2c1b57
@@ -378,9 +369,7 @@ int Detail(char *dev, struct context *c)
2c1b57
 		}
2c1b57
 
2c1b57
 		/* Only try GET_BITMAP_FILE for 0.90.01 and later */
2c1b57
-		if (vers >= 9001 &&
2c1b57
-		    ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 &&
2c1b57
-		    bmf.pathname[0]) {
2c1b57
+		if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) {
2c1b57
 			printf(" bitmap=%s", bmf.pathname);
2c1b57
 		}
2c1b57
 	} else {
2c1b57
@@ -449,9 +438,7 @@ int Detail(char *dev, struct context *c)
2c1b57
 			       array.not_persistent?"not ":"");
2c1b57
 		printf("\n");
2c1b57
 		/* Only try GET_BITMAP_FILE for 0.90.01 and later */
2c1b57
-		if (vers >= 9001 &&
2c1b57
-		    ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 &&
2c1b57
-		    bmf.pathname[0]) {
2c1b57
+		if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) {
2c1b57
 			printf("     Intent Bitmap : %s\n", bmf.pathname);
2c1b57
 			printf("\n");
2c1b57
 		} else if (array.state & (1<
2c1b57
-- 
2c1b57
2.7.4
2c1b57