From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JzYwb-0000Mx-Cl for qemu-devel@nongnu.org; Fri, 23 May 2008 11:12:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JzYwZ-0000MW-Mt for qemu-devel@nongnu.org; Fri, 23 May 2008 11:12:32 -0400 Received: from [199.232.76.173] (port=34595 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JzYwZ-0000MS-IM for qemu-devel@nongnu.org; Fri, 23 May 2008 11:12:31 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:44193) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JzYwZ-0002bo-2h for qemu-devel@nongnu.org; Fri, 23 May 2008 11:12:31 -0400 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate02.web.de (Postfix) with ESMTP id 5497EDE0CA38 for ; Fri, 23 May 2008 17:12:29 +0200 (CEST) Received: from [88.64.30.47] (helo=[192.168.1.198]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1JzYwX-0006wH-00 for qemu-devel@nongnu.org; Fri, 23 May 2008 17:12:29 +0200 Message-ID: <4836DED7.6090706@web.de> Date: Fri, 23 May 2008 17:12:23 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <48336413.2060909@web.de> <18485.18619.634431.859466@mariner.uk.xensource.com> <48356BC4.3090805@web.de> <5d6222a80805230629u301fcc1cu7bdaeb25bc4dfb67@mail.gmail.com> In-Reply-To: <5d6222a80805230629u301fcc1cu7bdaeb25bc4dfb67@mail.gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCB4A53CD4FD0EC35755F64DE" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH 1/3] Modular command line options Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCB4A53CD4FD0EC35755F64DE Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Glauber Costa wrote: > On Thu, May 22, 2008 at 9:49 AM, Jan Kiszka wrote: >> Ian Jackson wrote: >>> Jan Kiszka writes ("[Qemu-devel] [PATCH 1/3] Modular command line opt= ions"): >>>> Following up on my earlier proposal to introduce per-machine command= >>>> line options, this version provides a more generic approach. It shou= ld >>>> also be usable for scenarios like per-arch or per-accelerator. >>> I approve of splitting the code up like this, and having a >>> table-driven parsing arrangement. But ideally we could get rid of >>> `index' and the giant switch() statements too. Something more like >>> >>> typedef void QEMUOptionParser(struct QEMUOption *option, const char= *optarg); >>> >>> typedef struct QEMUOption { >>> const char *name, *helpstring; >>> QEMUOptionParser handler; >>> int flags; >> Ack. This just enforces a bit more effort to convert the existing >> opts... :-> >> >>> int int_for_handler; >>> void *void_for_handler; >> I don't think there is an need for both. A plain >> >> void *parser_opaque; >> >> should suffice as the user can perfectly typecast the void to int. >> >>> } QEMUOption; >>> >>> qemu_register_option_set(const QEMUOption *options); >> Here I would then suggest >> >> qemu_register_option_set(const char *set_name, >> const QEMUOption *options); >> >> to save the chance for visually grouping options. >=20 > I don't follow the need for the set_name parameter. This should be in > the OptionSet structure. > You mean, joining two groups if they are registered with the same > name? This can be done by enforcing them to have > the same "name" parameter in the OptionSet structure. Am I failing to > understand anything here? Let's consider this hypothetical scenario: $ qemu -h =2E.. Options specific to KQEMU accelerator: -kernel-kqemu enable KQEMU full virtualization (default is user mode on= ly) -no-kqemu disable KQEMU kernel module usage =2E.. The registration will work like this: QEMUOption kqemu_options[] =3D { { "kernel-kqemu", "enable KQEMU...", kqemu_enable_kernel, 0, NULL }, { "no-kqemu", "disable KQEMU...", kqemu_disable, 0, NULL }, { NULL } }; =2E.. cpu_get_phys_page_debug("KQEMU accelerator", kqemu_options); The set name is then kept in the _private_ QEMUOptionSet structure that is created and hooked into the global list by cpu_get_phys_page_debug. Joining groups with identical names, at least for the help output, was not planned yet. Might be a useful extension, but I would wait for feedback on use cases first. Jan --------------enigCB4A53CD4FD0EC35755F64DE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFINt7cniDOoMHTA+kRAt2fAJ9XHuGDwmzJjSM5vp3rAwiWMDIDlwCfaVjx L5RsD4K7WEGqU0wT+oBILOk= =jMe/ -----END PGP SIGNATURE----- --------------enigCB4A53CD4FD0EC35755F64DE--