From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NBUO5-0003Hr-FL for qemu-devel@nongnu.org; Fri, 20 Nov 2009 09:23:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NBUO0-0003El-RW for qemu-devel@nongnu.org; Fri, 20 Nov 2009 09:23:01 -0500 Received: from [199.232.76.173] (port=56804 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBUO0-0003EZ-JT for qemu-devel@nongnu.org; Fri, 20 Nov 2009 09:22:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64564) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NBUO0-00061u-6x for qemu-devel@nongnu.org; Fri, 20 Nov 2009 09:22:56 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAKEMs04030969 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 Nov 2009 09:22:55 -0500 From: Mark McLoughlin In-Reply-To: <4B011B40.2080800@redhat.com> References: <1258057742-18699-1-git-send-email-markmc@redhat.com> <1258057742-18699-6-git-send-email-markmc@redhat.com> <4B011B40.2080800@redhat.com> Content-Type: text/plain Date: Fri, 20 Nov 2009 14:20:16 +0000 Message-Id: <1258726816.11496.7.camel@blaa> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 5/7] qdev: add qdev_foreach() Reply-To: Mark McLoughlin List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, quintela@redhat.com Hi Gerd, Thanks for looking, you're absolutely right that this approach just isn't right with e.g. -device On Mon, 2009-11-16 at 10:28 +0100, Gerd Hoffmann wrote: > On 11/12/09 21:29, Mark McLoughlin wrote: > > No doubt this is the worst idea ever, but the requirement is simple - > > some way to iterate all NICs in the system. > > Doesn't have net.c a list of all vlanclientstates it could use instead? It does, but there's currently no way of getting at each NIC's MAC address. I've pushed a series of patches to the fix-announce-self-rfc.v2 branch on my tree: http://repo.or.cz/w/qemu/markmc.git The idea is to have a NICState struct: struct NICState { VLANClientState nc; MACAddr *macaddr; void *opaque; }; and similar structs for each net backend. This way we can have a qemu_foreach_nic() which iterates over each client, checks whether it's a NIC and upcast to NICState. Still a WIP, but how does that sound? Thanks, Mark.