xen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD"
authorMarkus Armbruster <armbru@redhat.com>
Wed, 3 Aug 2011 13:08:12 +0000 (15:08 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 6 Sep 2011 09:24:07 +0000 (11:24 +0200)
pci_piix3_xen_ide_unplug() unplugs only disks, not CD-ROMs.  It peeks
into the DriveInfo's BlockDriverState to distinguish between the two.
Unclean; use DriveInfo member media_cd, like xen_config_dev_blk().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/ide/piix.c

index b9cdcd6b75c5ff3b7cf858743596ea6d4c1346a8..88d318127c534e03d24e45dfe00cd867782c52aa 100644 (file)
@@ -27,7 +27,6 @@
 #include <hw/pci.h>
 #include <hw/isa.h>
 #include "block.h"
-#include "block_int.h"
 #include "sysemu.h"
 #include "dma.h"
 
@@ -176,7 +175,7 @@ static int pci_piix3_xen_ide_unplug(DeviceState *dev)
 
     for (; i < 3; i++) {
         di = drive_get_by_index(IF_IDE, i);
-        if (di != NULL && di->bdrv != NULL && !di->bdrv->removable) {
+        if (di != NULL && !di->media_cd) {
             DeviceState *ds = bdrv_get_attached_dev(di->bdrv);
             if (ds) {
                 bdrv_detach_dev(di->bdrv, ds);