[parted-devel] [PATCH] libparted: Don't warn if no HDIO_GET_IDENTITY ioctl

Sebastian Parschauer sparschauer at suse.de
Tue Oct 18 07:33:24 UTC 2016


On 04.10.2016 23:01, Brian C. Lane wrote:
> On Tue, Oct 04, 2016 at 11:37:30AM +0200, Sebastian Parschauer wrote:
>> Fully virtualized Xen VMs (HVM) use Linux IDE devices which don't
>> support the HDIO_GET_IDENTITY ioctl. EINVAL is returned, a warning
>> is printed and the device model is set to "Generic IDE" in that
>> case. The problem is seeing the warning all the time. So drop it
>> for this case.
>> ---
>>  libparted/arch/linux.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
>> index a22b1d7..d87fe9c 100644
>> --- a/libparted/arch/linux.c
>> +++ b/libparted/arch/linux.c
>> @@ -931,6 +931,7 @@ init_ide (PedDevice* dev)
>>          PedExceptionOption      ex_status;
>>          char                    hdi_buf[41];
>>          int                     sector_multiplier = 0;
>> +        int                     r;
>>  
>>          if (!_device_stat (dev, &dev_stat))
>>                  goto error;
>> @@ -938,7 +939,11 @@ init_ide (PedDevice* dev)
>>          if (!_device_open_ro (dev))
>>                  goto error;
>>  
>> -        if (ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi)) {
>> +        r = ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi);
>> +        if (r && errno == EINVAL) {
>> +                /* silently ignore unsupported ioctl */
>> +                dev->model = strdup(_("Generic IDE"));
>> +        } else if (r) {
>>                  ex_status = ped_exception_throw (
>>                                  PED_EXCEPTION_WARNING,
>>                                  PED_EXCEPTION_IGNORE_CANCEL,
>> -- 
>> 2.6.6
>>
>>
> 
> Looks ok to me, thanks!

I've submitted this patch two weeks ago. No objections.
Brian, is this patch queued somewhere?
Could you commit it to the git repo please?

Cheers,
Sebastian



More information about the parted-devel mailing list