From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJm42-0003dv-L1 for qemu-devel@nongnu.org; Tue, 19 Aug 2014 12:15:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJm3s-0005uP-2d for qemu-devel@nongnu.org; Tue, 19 Aug 2014 12:15:14 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36763 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJm3r-0005r5-S7 for qemu-devel@nongnu.org; Tue, 19 Aug 2014 12:15:03 -0400 Message-ID: <53F37806.3060809@suse.de> Date: Tue, 19 Aug 2014 18:15:02 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <874mxs32vv.fsf@blackfin.pond.sub.org> <20140804114500.GP18947@grmbl.mre> <53F23613.9090107@suse.de> <87egwcmqj6.fsf@blackfin.pond.sub.org> In-Reply-To: <87egwcmqj6.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] virtio-serial: create a linked list of all active devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Amit Shah , Amos Kong , qemu list Am 19.08.2014 17:45, schrieb Markus Armbruster: > Andreas F=C3=A4rber writes: >=20 >> Am 04.08.2014 13:45, schrieb Amit Shah: >>> On (Mon) 04 Aug 2014 [13:33:56], Markus Armbruster wrote: >>>> Amit Shah writes: >>>> >>>>> To ensure two virtserialports don't get added to the system with th= e >>>>> same 'name' parameter, we need to access all the ports on all the >>>>> devices added, and compare the names. >>>>> >>>>> We currently don't have a list of all VirtIOSerial devices added to= the >>>>> system. This commit adds a simple linked list in which devices are= put >>>>> when they're initialized, and removed when they go away. >> [...] >>>> Patch looks simple & safe to me, but I can't help to wonder whether = want >>>> (or already have?) more generic infrastructure offering "for all dev= ices >>>> of a certain kind" functionality, which is what 2/2 needs. Andreas? >>> >>> Yea; I didn't find any, but if there's already something it can be pu= t >>> to good use here. >> >> If you're looking for devices of the same QOM type, that can be done >> through some QOM path syntax that Paolo introduced. Someone used it in= a >> recent iommu series. >=20 > Possibly >=20 > object_class_foreach(fn, TYPE_VIRTIO_SERIAL_PORT, false, false, arg= ); That enumerates derived types (ObjectClass), not Object instances. Maybe it makes sense to add such an API for objects, too. However the only "registry" of objects we have is the QOM composition tree, i.e. it would be a tree-walking function. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg