int pci_piix3_xen_ide_unplug(DeviceState *dev)

{

    PCIIDEState *pci_ide;

    DriveInfo *di;

    int i = 0;



    pci_ide = PCI_IDE(dev);



    for (; i < 3; i++) {

        di = drive_get_by_index(IF_IDE, i);

        if (di != NULL && !di->media_cd) {

            BlockBackend *blk = blk_by_legacy_dinfo(di);

            DeviceState *ds = blk_get_attached_dev(blk);

            if (ds) {

                blk_detach_dev(blk, ds);

            }

            pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;

            blk_unref(blk);

        }

    }

    qdev_reset_all(DEVICE(dev));

    return 0;

}

int pci_piix3_xen_ide_unplug(DeviceState *dev)

{

    PCIIDEState *pci_ide;

    DriveInfo *di;

    int i = 0;



    pci_ide = PCI_IDE(dev);



    for (; i < 3; i++) {

        di = drive_get_by_index(IF_IDE, i);

        if (di != NULL && !di->media_cd) {

            BlockBackend *blk = blk_by_legacy_dinfo(di);

            DeviceState *ds = blk_get_attached_dev(blk);

            if (ds) {

                blk_detach_dev(blk, ds);

            }

            pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;

            blk_unref(blk);

        }

    }

    qdev_reset_all(DEVICE(dev));

    return 0;

}

    int i = 0;     for (; i < 3; i++) {
int FUNC_0(DeviceState *VAR_0)

{

    PCIIDEState *pci_ide;

    DriveInfo *di;

    int VAR_1 = 0;



    pci_ide = PCI_IDE(VAR_0);



    for (; VAR_1 < 3; VAR_1++) {

        di = drive_get_by_index(IF_IDE, VAR_1);

        if (di != NULL && !di->media_cd) {

            BlockBackend *blk = blk_by_legacy_dinfo(di);

            DeviceState *ds = blk_get_attached_dev(blk);

            if (ds) {

                blk_detach_dev(blk, ds);

            }

            pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;

            blk_unref(blk);

        }

    }

    qdev_reset_all(DEVICE(VAR_0));

    return 0;

}

int FUNC_0(DeviceState *VAR_0)
{ PCIIDEState *pci_ide; DriveInfo *di; int VAR_1 = 0; pci_ide = PCI_IDE(VAR_0); for (; VAR_1 < 3; VAR_1++) { di = drive_get_by_index(IF_IDE, VAR_1); if (di != NULL && !di->media_cd) { BlockBackend *blk = blk_by_legacy_dinfo(di); DeviceState *ds = blk_get_attached_dev(blk); if (ds) { blk_detach_dev(blk, ds); } pci_ide->bus[di->bus].ifs[di->unit].blk = NULL; blk_unref(blk); } } qdev_reset_all(DEVICE(VAR_0)); return 0; }