From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSrTo-0000at-Qy for qemu-devel@nongnu.org; Mon, 08 Feb 2016 14:28:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSrTl-0003iK-Gf for qemu-devel@nongnu.org; Mon, 08 Feb 2016 14:28:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSrTl-0003iG-8o for qemu-devel@nongnu.org; Mon, 08 Feb 2016 14:28:09 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id D3FDCC0C2345 for ; Mon, 8 Feb 2016 19:28:08 +0000 (UTC) References: <1454931951-25212-1-git-send-email-marcel@redhat.com> <56B88890.8090000@redhat.com> <56B88996.1040004@redhat.com> <56B8C6BE.30802@redhat.com> <56B8E58C.30909@redhat.com> <56B8EB33.4030001@redhat.com> From: Marcel Apfelbaum Message-ID: <56B8EC45.9080908@redhat.com> Date: Mon, 8 Feb 2016 21:28:05 +0200 MIME-Version: 1.0 In-Reply-To: <56B8EB33.4030001@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vl.c: remove duplicate call to qemu_get_machine_opts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek , qemu-devel@nongnu.org Cc: pbonzini@redhat.com On 02/08/2016 09:23 PM, Laszlo Ersek wrote: > On 02/08/16 19:59, Marcel Apfelbaum wrote: >> On 02/08/2016 06:47 PM, Laszlo Ersek wrote: >>> On 02/08/16 13:27, Marcel Apfelbaum wrote: >>>> On 02/08/2016 02:22 PM, Laszlo Ersek wrote: >>>>> On 02/08/16 12:45, Marcel Apfelbaum wrote: >>>>>> Also we can use current machine properties instead of querying >>>>>> machine's opts. >>>>> >>>>> Why? :) For me at least, you'll have to spell it out. >>>> >>>> The theory would be that is cleaner to call an object property than use >>>> a string >>>> (when possible); compiler helps and so on... >>>> >>>> object->prop vs find_me_prop("prop") >>>> >>>> Since all machine properties have already been set with the command line >>>> options >>>> we really have no need to use them anymore and we can favor the machine. >>> >>> Yes; what I meant is, where exactly have these properties been set? >>> >> >> I didn't get it so I followed a theoretical line, sorry :) >> >> A few lines before: >> >> if (qemu_opt_foreach(qemu_get_machine_opts(), machine_set_property, >> current_machine, NULL)) { >> object_unref(OBJECT(current_machine)); >> exit(1); >> } > > Ah, right, the things I missed in that were: > - the object_property_parse() call > - machine_initfn() in "hw/core/machine.c", and the setters it sets up. > > FWIW, > > Reviewed-by: Laszlo Ersek Appreciated! Note for the maintainer, there is a V2 of this patch on the mailing list: https://www.mail-archive.com/qemu-devel@nongnu.org/msg351565.html Thanks, Marcel > > Thanks > Laszlo > > >>>>>> Signed-off-by: Marcel Apfelbaum >>>>>> --- >>>>>> vl.c | 9 ++++----- >>>>>> 1 file changed, 4 insertions(+), 5 deletions(-) >>>>>> >>>>>> diff --git a/vl.c b/vl.c >>>>>> index 5873248..c03a4fe 100644 >>>>>> --- a/vl.c >>>>>> +++ b/vl.c >>>>>> @@ -4353,11 +4353,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) { >>>>>> >>>>> >>>>> Thanks >>>>> Laszlo >>>>> >>>> >>> >> >