Received: from eggs.gnu.org ([2001:4830:134:3::10]:50355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEvcv-0008J9-35 for qemu-devel@nongnu.org; Wed, 06 Aug 2014 03:27:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEvco-0000iG-VK for qemu-devel@nongnu.org; Wed, 06 Aug 2014 03:27:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEvco-0000i2-Ni for qemu-devel@nongnu.org; Wed, 06 Aug 2014 03:27:06 -0400 From: Markus Armbruster References: <874mxs32vv.fsf@blackfin.pond.sub.org> <20140804114500.GP18947@grmbl.mre> Date: Wed, 06 Aug 2014 09:27:02 +0200 In-Reply-To: <20140804114500.GP18947@grmbl.mre> (Amit Shah's message of "Mon, 4 Aug 2014 17:15:00 +0530") Message-ID: <874mxqyt6h.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: Amit Shah Cc: Amos Kong , qemu list , Andreas =?utf-8?Q?F=C3=A4rber?= Amit Shah writes: > 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 the >> > 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. > > > >> > +struct VirtIOSerialDevices { >> > + QLIST_HEAD(, VirtIOSerial) devices; >> > +} vserdevices; >> > + >> >> Any particular reason for stuffing the list into a struct? > > Not strictly needed for this patch alone, but I think it's cleaner to > keep it this way, and when something else comes up that needs a > per-device variable, this list will be around. Adding the struct when it's needed will be easy, so why pay the notational overhead now? > Also, this is also the > way it's done in the kernel, so that uniformity helps as well. Two uglies make a pretty? Anyway, matter of taste. [...]