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

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