Received: from eggs.gnu.org ([208.118.235.92]:45804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKEgU-0006Nf-23 for qemu-devel@nongnu.org; Fri, 05 Oct 2012 16:39:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKEgT-0003nO-0a for qemu-devel@nongnu.org; Fri, 05 Oct 2012 16:39:45 -0400 Date: Fri, 5 Oct 2012 17:40:25 -0300 From: Eduardo Habkost Message-ID: <20121005204024.GF4362@otherpad.lan.raisama.net> References: <1349468535-14499-1-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [QEMU PATCH] create struct for machine initialization arguments (v2) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Filippov Cc: Peter Maydell , Anthony Liguori , xen-devel@lists.xensource.com, Igor Mitsyanko , Evgeny Voevodin , qemu-ppc@nongnu.org, Aurelien Jarno , qemu-devel@nongnu.org, Fabien Chouteau , Alexander Graf , Peter Crosthwaite , Maksim Kozlov , Michael Walle , =?iso-8859-1?Q?Herv=E9?= Poussineau , Paul Brook , Blue Swirl , "Edgar E. Iglesias" , Guan Xuetao , Jan Kiszka , Dmitry Solodkiy On Sat, Oct 06, 2012 at 12:33:09AM +0400, Max Filippov wrote: > On Sat, Oct 6, 2012 at 12:22 AM, Eduardo Habkost wrote: > > This should help us to: > > - More easily add or remove machine initialization arguments without > > having to change every single machine init function; > > - More easily make mechanical changes involving the machine init > > functions in the future; > > - Let machine initialization forward the init arguments to other > > functions more easily. > > > > This change was half-mechanical process: first the struct was added with > > the local ram_size, boot_device, kernel_*, initrd_*, and cpu_model local > > variable initialization to all functions. Then the compiler helped me > > locate the local variables that are unused, so they could be removed. > > > > Changes v1 -> v2: > > - Fix mistake on the conversion of pc_xen_hvm_init() and xen_init_pv() > > > > Signed-off-by: Eduardo Habkost > > [...] > > > diff --git a/vl.c b/vl.c > > index 8d305ca..f663e7c 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -3624,8 +3624,13 @@ int main(int argc, char **argv, char **envp) > > > > qdev_machine_init(); > > > > - machine->init(ram_size, boot_devices, > > - kernel_filename, kernel_cmdline, initrd_filename, cpu_model); > > + QEMUMachineInitArgs args = { .ram_size = ram_size, > > + .boot_device = boot_devices, > > + .kernel_filename = kernel_filename, > > + .kernel_cmdline = kernel_cmdline, > > + initrd_filename = initrd_filename, > > Missing dot? Funny, GCC didn't complain. Thanks for spotting it! I am fixing this (and another problem I have found) and submit v3. > > > + .cpu_model = cpu_model }; > > + machine->init(&args); > > > > cpu_synchronize_all_post_init(); > > -- > Thanks. > -- Max > -- Eduardo