static int scsi_hot_add(Monitor *mon, DeviceState *adapter,

                        DriveInfo *dinfo, int printinfo)

{

    SCSIBus *scsibus;

    SCSIDevice *scsidev;



    scsibus = DO_UPCAST(SCSIBus, qbus, QLIST_FIRST(&adapter->child_bus));

    if (!scsibus || strcmp(scsibus->qbus.info->name, "SCSI") != 0) {

        error_report("Device is not a SCSI adapter");





    /*

     * drive_init() tries to find a default for dinfo->unit.  Doesn't

     * work at all for hotplug though as we assign the device to a

     * specific bus instead of the first bus with spare scsi ids.

     *

     * Ditch the calculated value and reload from option string (if

     * specified).

     */

    dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1);

    scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo, dinfo->unit);




    dinfo->unit = scsidev->id;



    if (printinfo)

        monitor_printf(mon, "OK bus %d, unit %d\n",

                       scsibus->busnr, scsidev->id);

    return 0;

static int scsi_hot_add(Monitor *mon, DeviceState *adapter,

                        DriveInfo *dinfo, int printinfo)

{

    SCSIBus *scsibus;

    SCSIDevice *scsidev;



    scsibus = DO_UPCAST(SCSIBus, qbus, QLIST_FIRST(&adapter->child_bus));

    if (!scsibus || strcmp(scsibus->qbus.info->name, "SCSI") != 0) {

        error_report("Device is not a SCSI adapter");





    















    dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1);

    scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo, dinfo->unit);




    dinfo->unit = scsidev->id;



    if (printinfo)

        monitor_printf(mon, "OK bus %d, unit %d\n",

                       scsibus->busnr, scsidev->id);

    return 0;

    return 0;
static int FUNC_0(Monitor *VAR_0, DeviceState *VAR_1,

                        DriveInfo *VAR_2, int VAR_3)

{

    SCSIBus *scsibus;

    SCSIDevice *scsidev;



    scsibus = DO_UPCAST(SCSIBus, qbus, QLIST_FIRST(&VAR_1->child_bus));

    if (!scsibus || strcmp(scsibus->qbus.info->name, "SCSI") != 0) {

        error_report("Device is not a SCSI VAR_1");





    















    VAR_2->unit = qemu_opt_get_number(VAR_2->opts, "unit", -1);

    scsidev = scsi_bus_legacy_add_drive(scsibus, VAR_2, VAR_2->unit);




    VAR_2->unit = scsidev->id;



    if (VAR_3)

        monitor_printf(VAR_0, "OK bus %d, unit %d\n",

                       scsibus->busnr, scsidev->id);

    return 0;

static int FUNC_0(Monitor *VAR_0, DeviceState *VAR_1,
DriveInfo *VAR_2, int VAR_3)
{ SCSIBus *scsibus; SCSIDevice *scsidev; scsibus = DO_UPCAST(SCSIBus, qbus, QLIST_FIRST(&VAR_1->child_bus)); if (!scsibus || strcmp(scsibus->qbus.info->name, "SCSI") != 0) { error_report("Device is not a SCSI VAR_1"); VAR_2->unit = qemu_opt_get_number(VAR_2->opts, "unit", -1); scsidev = scsi_bus_legacy_add_drive(scsibus, VAR_2, VAR_2->unit); VAR_2->unit = scsidev->id; if (VAR_3)
monitor_printf(VAR_0, "OK bus %d, unit %d\n",
scsibus->busnr, scsidev->id); return 0;