]> Git Repo - qemu.git/commitdiff
block: simplify default_drive
authorChristian Borntraeger <[email protected]>
Thu, 22 Nov 2012 20:02:55 +0000 (21:02 +0100)
committerKevin Wolf <[email protected]>
Tue, 11 Dec 2012 10:05:10 +0000 (11:05 +0100)
Markus Armbruster pointed out that there is only one caller
to default_drive with IF_DEFAULT as a type. Lets get rid
of the block_default_type parameter and adopt the caller
to do the right thing (asking the machine struct).

Signed-off-by: Christian Borntraeger <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
vl.c

diff --git a/vl.c b/vl.c
index ee10d21c784309959e9dd0c8c167558ed272daa7..6b3827cf06a42576eb27dfc8bc037186c30cc78b 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -899,17 +899,11 @@ static int drive_enable_snapshot(QemuOpts *opts, void *opaque)
     return 0;
 }
 
-static void default_drive(int enable, int snapshot,
-                          BlockInterfaceType block_default_type,
-                          BlockInterfaceType type, int index,
-                          const char *optstr)
+static void default_drive(int enable, int snapshot, BlockInterfaceType type,
+                          int index, const char *optstr)
 {
     QemuOpts *opts;
 
-    if (type == IF_DEFAULT) {
-        type = block_default_type;
-    }
-
     if (!enable || drive_get_by_index(type, index)) {
         return;
     }
@@ -3776,12 +3770,10 @@ int main(int argc, char **argv, char **envp)
         exit(1);
     }
 
-    default_drive(default_cdrom, snapshot, machine->block_default_type,
-                  IF_DEFAULT, 2, CDROM_OPTS);
-    default_drive(default_floppy, snapshot, machine->block_default_type,
-                  IF_FLOPPY, 0, FD_OPTS);
-    default_drive(default_sdcard, snapshot, machine->block_default_type,
-                  IF_SD, 0, SD_OPTS);
+    default_drive(default_cdrom, snapshot, machine->block_default_type, 2,
+                  CDROM_OPTS);
+    default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
+    default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
 
     register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL);
 
This page took 0.03401 seconds and 4 git commands to generate.