From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4W8K-0004rB-0O for qemu-devel@nongnu.org; Thu, 23 Aug 2012 08:03:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4W8H-0008LV-G5 for qemu-devel@nongnu.org; Thu, 23 Aug 2012 08:03:31 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58455 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4W8H-0008LN-6g for qemu-devel@nongnu.org; Thu, 23 Aug 2012 08:03:29 -0400 Message-ID: <50361C0C.3060503@suse.de> Date: Thu, 23 Aug 2012 14:03:24 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1345667067-24298-1-git-send-email-aliguori@us.ibm.com> <87k3wqo8f6.fsf@codemonkey.ws> In-Reply-To: <87k3wqo8f6.fsf@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] boards: add a 'none' machine type to all platforms List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Peter Maydell , qemu-devel@nongnu.org, Markus Armbruster Am 23.08.2012 00:42, schrieb Anthony Liguori: > Peter Maydell writes: >=20 >> On 22 August 2012 21:24, Anthony Liguori wrote: >>> This allows any QEMU binary to be executed with: >>> >>> $QEMU_BINARY -qmp stdio >> >> ...presumably you mean -qmp stdio -M none ? >> >>> >>> Without errors from missing options that are required by various boar= ds. This >>> also provides a mode that we can use in the future to construct machi= nes >>> entirely through QMP commands. >> >> How about documenting this machine (and its purpose) somewhere? >=20 > Okay, but where? I don't know an obvious place. >=20 >>> Cc: Daniel Berrange >>> Cc: Markus Armbruster >>> Signed-off-by: Anthony Liguori >>> --- >>> hw/Makefile.objs | 2 ++ >>> hw/null-machine.c | 40 ++++++++++++++++++++++++++++++++++++++++ >>> 2 files changed, 42 insertions(+), 0 deletions(-) >>> create mode 100644 hw/null-machine.c >>> >>> diff --git a/hw/Makefile.objs b/hw/Makefile.objs >>> index 7f57ed5..6dfebd2 100644 >>> --- a/hw/Makefile.objs >>> +++ b/hw/Makefile.objs >>> @@ -134,6 +134,8 @@ hw-obj-$(CONFIG_DP8393X) +=3D dp8393x.o >>> hw-obj-$(CONFIG_DS1225Y) +=3D ds1225y.o >>> hw-obj-$(CONFIG_MIPSNET) +=3D mipsnet.o >>> >>> +hw-obj-y +=3D null-machine.o >>> + >>> # Sound >>> sound-obj-y =3D >>> sound-obj-$(CONFIG_SB16) +=3D sb16.o >>> diff --git a/hw/null-machine.c b/hw/null-machine.c >>> new file mode 100644 >>> index 0000000..69910d3 >>> --- /dev/null >>> +++ b/hw/null-machine.c >>> @@ -0,0 +1,40 @@ >>> +/* >>> + * Empty machine >>> + * >>> + * Copyright IBM, Corp. 2012 >>> + * >>> + * Authors: >>> + * Anthony Liguori >>> + * >>> + * This work is licensed under the terms of the GNU GPL, version 2 o= r later. >>> + * See the COPYING file in the top-level directory. >>> + * >>> + */ >>> + >>> +#include "qemu-common.h" >>> +#include "hw/hw.h" >>> +#include "hw/boards.h" >>> + >>> +static void machine_none_init(ram_addr_t ram_size, >>> + const char *boot_device, >>> + const char *kernel_filename, >>> + const char *kernel_cmdline, >>> + const char *initrd_filename, >>> + const char *cpu_model) >>> +{ >>> +} >>> + >>> +static QEMUMachine machine_none =3D { >>> + .name =3D "none", >>> + .desc =3D "empty machine", >>> + .init =3D machine_none_init, >>> + .max_cpus =3D 0, >>> +}; >>> + >>> +static void register_machines(void) >>> +{ >>> + qemu_register_machine(&machine_none); >>> +} >>> + >>> +machine_init(register_machines); >> >> We seem to be about evenly split about whether machine_init() >> should have a trailing semicolon (it doesn't need one >> but it doesn't hurt either...) >=20 > It's obviously superior to use a semicolon... C is completely > consistent synactically about the usage of semicolons afterall :-) I disagree. This macro does not turn into a statement but a full function definition. Neither our Coding Style nor any other that I know does void foo(bar baz) { }; with a trailing semicolon. For type_init() I cleaned this up, and I attribute the existing semicolons to people's ignorance of what these macros actually do. You might remember that Eduardo and I wanted to QOM'ify machines so that machine_init() would get replaced with type_init() but you stopped us at the time, leaving it untouched. So there's no strict need to go through and change existing users, but I believe in setting good examples. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg