aboutsummaryrefslogtreecommitdiffstats
path: root/vl.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-12-23 02:54:08 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-01-02 22:31:27 +0100
commitcb42a1b1461e02efb034582ac5d8f71534723b92 (patch)
tree5dbd619671d4591d33834488f1c15690dabf50ba /vl.c
parentca6a2e034bce665a08d9d748ac11d6a7cfcd7c48 (diff)
downloadexternal_qemu-cb42a1b1461e02efb034582ac5d8f71534723b92.zip
external_qemu-cb42a1b1461e02efb034582ac5d8f71534723b92.tar.gz
external_qemu-cb42a1b1461e02efb034582ac5d8f71534723b92.tar.bz2
upstream: integrate block changes
This large patch upgrades the block support code to the upstream version available in ba5e7f82169f32ab8163c707d97c799ca09f8924 dated 2010-08-08 Change-Id: I8b24df0c287e72f6620650a4d6a62e1bb315453e
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/vl.c b/vl.c
index 03cc9ae..97c3aa3 100644
--- a/vl.c
+++ b/vl.c
@@ -743,6 +743,26 @@ static int bt_parse(const char *opt)
#define MTD_ALIAS "if=mtd"
#define SD_ALIAS "index=0,if=sd"
+static int drive_init_func(QemuOpts *opts, void *opaque)
+{
+ int *use_scsi = opaque;
+ int fatal_error = 0;
+
+ if (drive_init(opts, *use_scsi, &fatal_error) == NULL) {
+ if (fatal_error)
+ return 1;
+ }
+ return 0;
+}
+
+static int drive_enable_snapshot(QemuOpts *opts, void *opaque)
+{
+ if (NULL == qemu_opt_get(opts, "snapshot")) {
+ qemu_opt_set(opts, "snapshot", "on");
+ }
+ return 0;
+}
+
static int drive_opt_get_free_idx(void)
{
int index;
@@ -4427,14 +4447,15 @@ int main(int argc, char **argv, char **envp)
/* we always create one sd slot, even if no card is in it */
- if (nb_drives_opt < MAX_DRIVES)
+ if (nb_drives_opt < MAX_DRIVES) {
drive_add(NULL, SD_ALIAS);
+ }
/* open the virtual block devices */
-
- for(i = 0; i < nb_drives_opt; i++)
- if (drive_init(&drives_opt[i], snapshot, machine) == -1)
- exit(1);
+ if (snapshot)
+ qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, 0);
+ if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func, &machine->use_scsi, 1) != 0)
+ exit(1);
//register_savevm("timer", 0, 2, timer_save, timer_load, NULL);
register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL);