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

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