Blame SOURCES/0057-libparted-Don-t-warn-if-no-HDIO_GET_IDENTITY-ioctl.patch

003ee8
From a6612fb6dd3746cfc9138ebc84210945a8fffa10 Mon Sep 17 00:00:00 2001
003ee8
From: Sebastian Parschauer <sparschauer@suse.de>
003ee8
Date: Tue, 4 Oct 2016 11:37:30 +0200
003ee8
Subject: [PATCH 57/75] libparted: Don't warn if no HDIO_GET_IDENTITY ioctl
003ee8
003ee8
Fully virtualized Xen VMs (HVM) use Linux IDE devices which don't
003ee8
support the HDIO_GET_IDENTITY ioctl. EINVAL is returned, a warning
003ee8
is printed and the device model is set to "Generic IDE" in that
003ee8
case. The problem is seeing the warning all the time. So drop it
003ee8
for this case.
003ee8
003ee8
Signed-off-by: Brian C. Lane <bcl@redhat.com>
003ee8
---
003ee8
 libparted/arch/linux.c | 7 ++++++-
003ee8
 1 file changed, 6 insertions(+), 1 deletion(-)
003ee8
003ee8
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
003ee8
index b7ba5de..2058697 100644
003ee8
--- a/libparted/arch/linux.c
003ee8
+++ b/libparted/arch/linux.c
003ee8
@@ -931,6 +931,7 @@ init_ide (PedDevice* dev)
003ee8
         PedExceptionOption      ex_status;
003ee8
         char                    hdi_buf[41];
003ee8
         int                     sector_multiplier = 0;
003ee8
+        int                     r;
003ee8
 
003ee8
         if (!_device_stat (dev, &dev_stat))
003ee8
                 goto error;
003ee8
@@ -938,7 +939,11 @@ init_ide (PedDevice* dev)
003ee8
         if (!_device_open_ro (dev))
003ee8
                 goto error;
003ee8
 
003ee8
-        if (ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi)) {
003ee8
+        r = ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi);
003ee8
+        if (r && errno == EINVAL) {
003ee8
+                /* silently ignore unsupported ioctl */
003ee8
+                dev->model = strdup(_("Generic IDE"));
003ee8
+        } else if (r) {
003ee8
                 ex_status = ped_exception_throw (
003ee8
                                 PED_EXCEPTION_WARNING,
003ee8
                                 PED_EXCEPTION_IGNORE_CANCEL,
003ee8
-- 
003ee8
2.9.3
003ee8