File 0073-Query-Remove-all-references-to-md_get_version.patch of Package mdadm.7989

From 5cb859962febacba3bb9257fc6ed9553ecc16752 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@gmail.com>
Date: Wed, 5 Apr 2017 15:37:38 -0400
Subject: [PATCH] Query: Remove all references to md_get_version()
Git-commit: 5cb859962febacba3bb9257fc6ed9553ecc16752
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

More legacy code removed

Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 Query.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/Query.c b/Query.c
index a2c839c..bea273f 100644
--- a/Query.c
+++ b/Query.c
@@ -33,7 +33,6 @@ int Query(char *dev)
 	 * a superblock
 	 */
 	int fd = open(dev, O_RDONLY);
-	int vers;
 	int ioctlerr;
 	int superror;
 	struct mdinfo info;
@@ -52,7 +51,6 @@ int Query(char *dev)
 		return 1;
 	}
 
-	vers = md_get_version(fd);
 	if (md_get_array_info(fd, &array) < 0)
 		ioctlerr = errno;
 	else
@@ -60,16 +58,12 @@ int Query(char *dev)
 
 	fstat(fd, &stb);
 
-	if (vers>=9000 && !ioctlerr) {
+	if (!ioctlerr) {
 		if (!get_dev_size(fd, NULL, &larray_size))
 			larray_size = 0;
 	}
 
-	if (vers < 0)
-		printf("%s: is not an md array\n", dev);
-	else if (vers < 9000)
-		printf("%s: is an md device, but kernel cannot provide details\n", dev);
-	else if (ioctlerr == ENODEV)
+	if (ioctlerr == ENODEV)
 		printf("%s: is an md device which is not active\n", dev);
 	else if (ioctlerr)
 		printf("%s: is an md device, but gives \"%s\" when queried\n",
@@ -100,8 +94,7 @@ int Query(char *dev)
 			disc.number = info.disk.number;
 			activity = "undetected";
 			if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
-				if (md_get_version(fd) >= 9000 &&
-				    md_get_array_info(fd, &array) >= 0) {
+				if (md_get_array_info(fd, &array) >= 0) {
 					if (md_get_disk_info(fd, &disc) >= 0 &&
 					    makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev)
 						activity = "active";
-- 
2.13.6
openSUSE Build Service is sponsored by