qemu_opt_set(opts, "if", "none");
/* create host drive */
- dinfo = drive_init(opts, NULL, &fatal_error);
+ dinfo = drive_init(opts, 0, &fatal_error);
if (!dinfo) {
qemu_opts_del(opts);
return NULL;
BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type);
extern QemuOpts *drive_add(const char *file, const char *fmt, ...);
-extern DriveInfo *drive_init(QemuOpts *arg, void *machine, int *fatal_error);
+extern DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi,
+ int *fatal_error);
/* device-hotplug */
}
}
-DriveInfo *drive_init(QemuOpts *opts, void *opaque,
- int *fatal_error)
+DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error)
{
const char *buf;
const char *file = NULL;
int bus_id, unit_id;
int cyls, heads, secs, translation;
BlockDriver *drv = NULL;
- QEMUMachine *machine = opaque;
int max_devs;
int index;
int ro = 0;
translation = BIOS_ATA_TRANSLATION_AUTO;
- if (machine && machine->use_scsi) {
+ if (default_to_scsi) {
type = IF_SCSI;
max_devs = MAX_SCSI_DEVS;
pstrcpy(devname, sizeof(devname), "scsi");
static int drive_init_func(QemuOpts *opts, void *opaque)
{
- QEMUMachine *machine = opaque;
+ int *use_scsi = opaque;
int fatal_error = 0;
- if (drive_init(opts, machine, &fatal_error) == NULL) {
+ if (drive_init(opts, *use_scsi, &fatal_error) == NULL) {
if (fatal_error)
return 1;
}
/* open the virtual block devices */
if (snapshot)
qemu_opts_foreach(&qemu_drive_opts, drive_enable_snapshot, NULL, 0);
- if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, machine, 1) != 0)
+ if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, &machine->use_scsi, 1) != 0)
exit(1);
register_savevm_live("ram", 0, 3, NULL, ram_save_live, NULL,