From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzpfx-0006kT-Kj for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:59:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uzpft-0002Sg-Ts for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:59:25 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:60024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzpft-0002SQ-OE for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:59:21 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Jul 2013 10:59:21 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 2DA8138C805E for ; Thu, 18 Jul 2013 10:59:16 -0400 (EDT) Received: from d01av05.pok.ibm.com (d01av05.pok.ibm.com [9.56.224.195]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6IExHu0158726 for ; Thu, 18 Jul 2013 10:59:17 -0400 Received: from d01av05.pok.ibm.com (loopback [127.0.0.1]) by d01av05.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6IExG3p019814 for ; Thu, 18 Jul 2013 10:59:16 -0400 From: Anthony Liguori In-Reply-To: <51E80060.5020709@redhat.com> References: <1374136063-24399-1-git-send-email-marcel.a@redhat.com> <1374136063-24399-2-git-send-email-marcel.a@redhat.com> <87ppugdjtb.fsf@codemonkey.ws> <1374158537.14214.12.camel@localhost.localdomain> <51E80060.5020709@redhat.com> Date: Thu, 18 Jul 2013 09:58:59 -0500 Message-ID: <87txjrzzgs.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [RFC PATCH 1/2] qemu-help: Sort devices by logical functionality List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Marcel Apfelbaum Cc: qemu-devel@nongnu.org, afaerber@suse.de Paolo Bonzini writes: > Il 18/07/2013 16:42, Marcel Apfelbaum ha scritto: >> On Thu, 2013-07-18 at 09:28 -0500, Anthony Liguori wrote: >>> Marcel Apfelbaum writes: >>> >>>> Categorize devices that appear as output to "-device ?" command >>>> by logical functionality. Sort the devices by logical categories >>>> before showing them to user. >>>> >>>> Signed-off-by: Marcel Apfelbaum >>>> Reviewed-by: Kevin Wolf >>>> --- >>>> include/hw/qdev-core.h | 7 +++++++ >>>> qdev-monitor.c | 23 ++++++++++++++++++++++- >>>> 2 files changed, 29 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h >>>> index 7fbffcb..4f7a9b8 100644 >>>> --- a/include/hw/qdev-core.h >>>> +++ b/include/hw/qdev-core.h >>>> @@ -17,6 +17,12 @@ enum { >>>> #define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE) >>>> #define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE) >>>> >>>> +#define DEVICE_CATEGORY_STORAGE "storage" >>>> +#define DEVICE_CATEGORY_NETWORK "network" >>>> +#define DEVICE_CATEGORY_INPUT "input" >>>> +#define DEVICE_CATEGORY_DISPLAY "display" >>>> +#define DEVICE_CATEGORY_SOUND "sound" >>>> + >>> >>> Looks reasonable, but please make this a bitmap. There are cases, >>> particularly if we start modeling multifunction PCI cards as a single >>> device, where a single device can support multiple types of >>> functionality. >> >> Antony, thanks for your review! >> The whole point was to find a way to differentiate them by >> functionality so they can be sorted... >> Is it possible that a multifunction pci card will be used >> for more then one category mentioned above? > > Yes, for example your laptop's GPU probably has an audio function too. Another example is a converged network adapter. It's a single device with an ethernet port but it exposes two physical functions--one NIC and one fibre channel device via FCoE. The PIIX chipset and ICH9 are multifunction devices but we model them as separate devices today. It's quite likely that in the very near future we'll fix that. >> I agree the list may not be exhaustive, but I really hope >> I'll find a way to sort them in such a way that a >> device will not fall under more than one category > > If you sort the bit definitions in alphabetic order (audio=bit 30, > display=bit 29, etc. for example), the resulting integer sort should > also yield alphabetic order. But perhaps it's not a smart idea if we > take into account future localization of the help text. I was thinking the same thing. Could also just cheat and make the sort function a bit more complicated. Regards, Anthony Liguori > > Paolo