From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjARJ-0007Zt-Jf for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:11:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjARH-0005v7-8d for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:11:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjARG-0005uz-Vs for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:11:07 -0500 From: Kevin Wolf Date: Thu, 13 Dec 2012 16:10:19 +0100 Message-Id: <1355411450-12761-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1355411450-12761-1-git-send-email-kwolf@redhat.com> References: <1355411450-12761-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 12/43] block: simplify default_drive List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Christian Borntraeger 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 Reviewed-by: Markus Armbruster Signed-off-by: Stefan Hajnoczi --- vl.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-) diff --git a/vl.c b/vl.c index ee10d21..6b3827c 100644 --- 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); -- 1.7.6.5