From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXV3d-0007VT-5Y for qemu-devel@nongnu.org; Wed, 20 Jan 2010 02:32:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXV3Y-0007T9-HQ for qemu-devel@nongnu.org; Wed, 20 Jan 2010 02:32:52 -0500 Received: from [199.232.76.173] (port=47260 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXV3Y-0007T5-Cz for qemu-devel@nongnu.org; Wed, 20 Jan 2010 02:32:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39151) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXV3X-0005T7-St for qemu-devel@nongnu.org; Wed, 20 Jan 2010 02:32:48 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 3/5] PCI: Convert pci_info() to QObject References: <1262976136-31852-1-git-send-email-lcapitulino@redhat.com> <1262976136-31852-4-git-send-email-lcapitulino@redhat.com> <20100119182723.61569f7d@doriath> Date: Wed, 20 Jan 2010 08:32:43 +0100 In-Reply-To: <20100119182723.61569f7d@doriath> (Luiz Capitulino's message of "Tue, 19 Jan 2010 18:27:23 -0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, mst@redhat.com Luiz Capitulino writes: > On Mon, 18 Jan 2010 18:16:21 +0100 > Markus Armbruster wrote: [...] >> > +/** >> > + * do_pci_info(): PCI buses and devices information >> > + * >> > + * The returned QObject is a QList of all buses. Each bus is >> > + * represented by a QDict, which has a key with a QList of all >> > + * PCI devices attached to it. Each device is represented by >> > + * a QDict. >> > + * >> > + * The bus QDict contains the following: >> > + * >> > + * - "bus": bus number >> > + * - "devices": a QList of QDicts, each QDict represents a PCI >> > + * device >> > + * >> > + * The PCI device QDict contains the following: >> > + * >> > + * - "bus": bus number >> >> This is redundant, because a device QDict is always contained in a bus >> QDict, which has the bus number. > > Turns out I find this redundancy convenient for clients, because if > you pass the device dict down to a function you have the bus number > there if you need it (otherwise you'd need to pass the bus number > too). > > I'm writing a shell in Python and found this convenient, is it that > bad? It's not bad, it's redundant :) A little convenient redundancy is okay. I just don't want accidental redundancy. If you keep it, I'd suggest document that it's identical to the parent's bus member. [...]