From patchwork Mon Feb 8 12:15:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 580273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C7C2A140B93 for ; Mon, 8 Feb 2016 23:16:22 +1100 (AEDT) Received: from localhost ([::1]:44041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSkjs-0005Ww-Sp for incoming@patchwork.ozlabs.org; Mon, 08 Feb 2016 07:16:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSkjd-0005Ex-3z for qemu-devel@nongnu.org; Mon, 08 Feb 2016 07:16:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSkjZ-0007sv-SI for qemu-devel@nongnu.org; Mon, 08 Feb 2016 07:16:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSkjZ-0007sr-Mb for qemu-devel@nongnu.org; Mon, 08 Feb 2016 07:16:01 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 6869C91FCD for ; Mon, 8 Feb 2016 12:16:01 +0000 (UTC) Received: from work.redhat.com (vpn1-5-195.ams2.redhat.com [10.36.5.195]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u18CFxAi026455; Mon, 8 Feb 2016 07:16:00 -0500 From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Mon, 8 Feb 2016 14:15:59 +0200 Message-Id: <1454933759-31030-1-git-send-email-marcel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: marcel@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH V2] vl.c: remove machine_opts from main and the duplicate call to qemu_get_machine_opts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use current machine properties instead of querying machine's opts. Signed-off-by: Marcel Apfelbaum Reviewed-by: Igor Mammedov --- v1 -> v2: - Use the current machine also for dtb - Remove the machine_opts from main completely vl.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/vl.c b/vl.c index d4a8661..c8bc4bf 100644 --- a/vl.c +++ b/vl.c @@ -2991,7 +2991,7 @@ int main(int argc, char **argv, char **envp) const char *boot_once = NULL; DisplayState *ds; int cyls, heads, secs, translation; - QemuOpts *hda_opts = NULL, *opts, *machine_opts, *icount_opts = NULL; + QemuOpts *hda_opts = NULL, *opts, *icount_opts = NULL; QemuOptsList *olist; int optind; const char *optarg; @@ -4339,9 +4339,8 @@ int main(int argc, char **argv, char **envp) exit(0); } - machine_opts = qemu_get_machine_opts(); - if (qemu_opt_foreach(machine_opts, machine_set_property, current_machine, - NULL)) { + if (qemu_opt_foreach(qemu_get_machine_opts(), machine_set_property, + current_machine, NULL)) { object_unref(OBJECT(current_machine)); exit(1); } @@ -4352,11 +4351,10 @@ int main(int argc, char **argv, char **envp) qtest_init(qtest_chrdev, qtest_log, &error_fatal); } - machine_opts = qemu_get_machine_opts(); - kernel_filename = qemu_opt_get(machine_opts, "kernel"); - initrd_filename = qemu_opt_get(machine_opts, "initrd"); - kernel_cmdline = qemu_opt_get(machine_opts, "append"); - bios_name = qemu_opt_get(machine_opts, "firmware"); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL); if (opts) { @@ -4395,7 +4393,7 @@ int main(int argc, char **argv, char **envp) exit(1); } - if (!linux_boot && qemu_opt_get(machine_opts, "dtb")) { + if (!linux_boot && current_machine->dtb) { error_report("-dtb only allowed with -kernel option"); exit(1); }