Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LZi2A-0006Va-6z for qemu-devel@nongnu.org; Wed, 18 Feb 2009 03:43:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LZi27-0006Us-QV for qemu-devel@nongnu.org; Wed, 18 Feb 2009 03:43:57 -0500 Received: from [199.232.76.173] (port=37858 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LZi27-0006Ul-Lf for qemu-devel@nongnu.org; Wed, 18 Feb 2009 03:43:55 -0500 Received: from mx2.redhat.com ([66.187.237.31]:49351) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LZi26-0006Ae-Ur for qemu-devel@nongnu.org; Wed, 18 Feb 2009 03:43:55 -0500 Subject: Re: [Qemu-devel] Machine description as data prototype, take 2 References: <87iqnh6kyv.fsf@pike.pond.sub.org> <87zlgmwdut.fsf@pike.pond.sub.org> <200902171732.29531.paul@codesourcery.com> From: Markus Armbruster Date: Wed, 18 Feb 2009 09:42:51 +0100 In-Reply-To: <200902171732.29531.paul@codesourcery.com> (Paul Brook's message of "Tue\, 17 Feb 2009 17\:32\:29 +0000") Message-ID: <87skmci19w.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org Paul Brook writes: > On Monday 16 February 2009, Markus Armbruster wrote: >> + =C2=A0 =C2=A0{ "vga", sizeof(struct dt_device_vga), dt_vga_props, >> + =C2=A0 =C2=A0 =C2=A0dt_vga_config, dt_vga_init, NULL }, >> + =C2=A0 =C2=A0{ "nic", sizeof(struct dt_device_nic), dt_nic_props, >> + =C2=A0 =C2=A0 =C2=A0dt_nic_config, dt_nic_init, NULL }, > > I think this is doing things the wrong way. We shouldn't have a "nic" dev= ice=20 > that mutates into one of several devices based on magic options. Instead = each=20 > nic/display adapter/HBA should be registered, and we instantiate those=20 > directly. For devices that have a common set of properties (e.g. nics) it= =20 > probably makes sense to have common helper functions. It should be possib= le=20 > to have a single device that is (say) both a SCSI HBA and a NIC. > > Paul Fair point. File it under "short cut". My machine configuration tree is hard-coded, then modified according to command line options. The way that's done is not the way I think it should be done. I've concentrated on what to do with the configuration, not so much on how to assemble it.