int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)

{

    int dom, pci_bus;

    unsigned slot;

    PCIDevice *dev;

    const char *pci_addr = qdict_get_str(qdict, "pci_addr");



    switch (dinfo->type) {

    case IF_SCSI:

        if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) {

            goto err;

        }

        dev = pci_find_device(pci_find_root_bus(dom), pci_bus,

                              PCI_DEVFN(slot, 0));

        if (!dev) {

            monitor_printf(mon, "no pci device with address %s\n", pci_addr);

            goto err;

        }

        if (scsi_hot_add(mon, &dev->qdev, dinfo, 1) != 0) {

            goto err;

        }

        break;

    default:

        monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);

        goto err;

    }



    return 0;

err:

    return -1;

}

int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)

{

    int dom, pci_bus;

    unsigned slot;

    PCIDevice *dev;

    const char *pci_addr = qdict_get_str(qdict, "pci_addr");



    switch (dinfo->type) {

    case IF_SCSI:

        if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) {

            goto err;

        }

        dev = pci_find_device(pci_find_root_bus(dom), pci_bus,

                              PCI_DEVFN(slot, 0));

        if (!dev) {

            monitor_printf(mon, "no pci device with address %s\n", pci_addr);

            goto err;

        }

        if (scsi_hot_add(mon, &dev->qdev, dinfo, 1) != 0) {

            goto err;

        }

        break;

    default:

        monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);

        goto err;

    }



    return 0;

err:

    return -1;

}

int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, DriveInfo *VAR_2)

{

    int VAR_3, VAR_4;

    unsigned VAR_5;

    PCIDevice *dev;

    const char *VAR_6 = qdict_get_str(VAR_1, "VAR_6");



    switch (VAR_2->type) {

    case IF_SCSI:

        if (pci_read_devaddr(VAR_0, VAR_6, &VAR_3, &VAR_4, &VAR_5)) {

            goto err;

        }

        dev = pci_find_device(pci_find_root_bus(VAR_3), VAR_4,

                              PCI_DEVFN(VAR_5, 0));

        if (!dev) {

            monitor_printf(VAR_0, "no pci device with address %s\n", VAR_6);

            goto err;

        }

        if (scsi_hot_add(VAR_0, &dev->qdev, VAR_2, 1) != 0) {

            goto err;

        }

        break;

    default:

        monitor_printf(VAR_0, "Can't hot-add drive to type %d\n", VAR_2->type);

        goto err;

    }



    return 0;

err:

    return -1;

}

int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, DriveInfo *VAR_2)
{ int VAR_3, VAR_4; unsigned VAR_5; PCIDevice *dev; const char *VAR_6 = qdict_get_str(VAR_1, "VAR_6"); switch (VAR_2->type) { case IF_SCSI:
if (pci_read_devaddr(VAR_0, VAR_6, &VAR_3, &VAR_4, &VAR_5)) { goto err; } dev = pci_find_device(pci_find_root_bus(VAR_3), VAR_4,
PCI_DEVFN(VAR_5, 0)); if (!dev) { monitor_printf(VAR_0, "no pci device with address %s\n", VAR_6); goto err; } if (scsi_hot_add(VAR_0, &dev->qdev, VAR_2, 1) != 0) { goto err; } break; default:
monitor_printf(VAR_0, "Can't hot-add drive to type %d\n", VAR_2->type); goto err; } return 0; err:
return -1; }