void hmp_pci_add(Monitor *mon, const QDict *qdict)

{

    PCIDevice *dev = NULL;

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

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

    const char *opts = qdict_get_try_str(qdict, "opts");



    /* strip legacy tag */

    if (!strncmp(pci_addr, "pci_addr=", 9)) {

        pci_addr += 9;

    }



    if (!opts) {

        opts = "";

    }



    if (!strcmp(pci_addr, "auto"))

        pci_addr = NULL;



    if (strcmp(type, "nic") == 0) {

        dev = qemu_pci_hot_add_nic(mon, pci_addr, opts);

    } else if (strcmp(type, "storage") == 0) {

        dev = qemu_pci_hot_add_storage(mon, pci_addr, opts);

    } else {

        monitor_printf(mon, "invalid type: %s\n", type);

    }



    if (dev) {

        monitor_printf(mon, "OK root bus %s, bus %d, slot %d, function %d\n",

                       pci_root_bus_path(dev),

                       pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),

                       PCI_FUNC(dev->devfn));

    } else

        monitor_printf(mon, "failed to add %s\n", opts);

}

void hmp_pci_add(Monitor *mon, const QDict *qdict)

{

    PCIDevice *dev = NULL;

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

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

    const char *opts = qdict_get_try_str(qdict, "opts");



    

    if (!strncmp(pci_addr, "pci_addr=", 9)) {

        pci_addr += 9;

    }



    if (!opts) {

        opts = "";

    }



    if (!strcmp(pci_addr, "auto"))

        pci_addr = NULL;



    if (strcmp(type, "nic") == 0) {

        dev = qemu_pci_hot_add_nic(mon, pci_addr, opts);

    } else if (strcmp(type, "storage") == 0) {

        dev = qemu_pci_hot_add_storage(mon, pci_addr, opts);

    } else {

        monitor_printf(mon, "invalid type: %s\n", type);

    }



    if (dev) {

        monitor_printf(mon, "OK root bus %s, bus %d, slot %d, function %d\n",

                       pci_root_bus_path(dev),

                       pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),

                       PCI_FUNC(dev->devfn));

    } else

        monitor_printf(mon, "failed to add %s\n", opts);

}

    if (!opts) {     const char *pci_addr = qdict_get_str(qdict, "pci_addr");     } else {     } else { void hmp_pci_add(Monitor *mon, const QDict *qdict)     PCIDevice *dev = NULL;     const char *pci_addr = qdict_get_str(qdict, "pci_addr");     const char *type = qdict_get_str(qdict, "type");     const char *opts = qdict_get_try_str(qdict, "opts");     if (!strncmp(pci_addr, "pci_addr=", 9)) {         pci_addr += 9;     if (!opts) {         opts = "";     if (!strcmp(pci_addr, "auto"))         pci_addr = NULL;     if (strcmp(type, "nic") == 0) {         dev = qemu_pci_hot_add_nic(mon, pci_addr, opts);     } else if (strcmp(type, "storage") == 0) {         dev = qemu_pci_hot_add_storage(mon, pci_addr, opts);     } else {         monitor_printf(mon, "invalid type: %s\n", type);     if (dev) {         monitor_printf(mon, "OK root bus %s, bus %d, slot %d, function %d\n",                        pci_root_bus_path(dev),                        pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),                        PCI_FUNC(dev->devfn));     } else         monitor_printf(mon, "failed to add %s\n", opts);
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)

{

    PCIDevice *dev = NULL;

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

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

    const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4");



    

    if (!strncmp(VAR_2, "VAR_2=", 9)) {

        VAR_2 += 9;

    }



    if (!VAR_4) {

        VAR_4 = "";

    }



    if (!strcmp(VAR_2, "auto"))

        VAR_2 = NULL;



    if (strcmp(VAR_3, "nic") == 0) {

        dev = qemu_pci_hot_add_nic(VAR_0, VAR_2, VAR_4);

    } else if (strcmp(VAR_3, "storage") == 0) {

        dev = qemu_pci_hot_add_storage(VAR_0, VAR_2, VAR_4);

    } else {

        monitor_printf(VAR_0, "invalid VAR_3: %s\n", VAR_3);

    }



    if (dev) {

        monitor_printf(VAR_0, "OK root bus %s, bus %d, slot %d, function %d\n",

                       pci_root_bus_path(dev),

                       pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),

                       PCI_FUNC(dev->devfn));

    } else

        monitor_printf(VAR_0, "failed to add %s\n", VAR_4);

}

void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{ PCIDevice *dev = NULL; const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3"); const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4"); if (!strncmp(VAR_2, "VAR_2=", 9)) { VAR_2 += 9; } if (!VAR_4) { VAR_4 = ""; } if (!strcmp(VAR_2, "auto"))
VAR_2 = NULL; if (strcmp(VAR_3, "nic") == 0) { dev = qemu_pci_hot_add_nic(VAR_0, VAR_2, VAR_4); } else if (strcmp(VAR_3, "storage") == 0) { dev = qemu_pci_hot_add_storage(VAR_0, VAR_2, VAR_4); } else { monitor_printf(VAR_0, "invalid VAR_3: %s\n", VAR_3); } if (dev) { monitor_printf(VAR_0, "OK root bus %s, bus %d, slot %d, function %d\n",
pci_root_bus_path(dev),
pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn)); } else monitor_printf(VAR_0, "failed to add %s\n", VAR_4); }