From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzpWB-0001Yu-18 for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:49:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzpW8-0007zh-3A for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:49:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzpW7-0007zX-Nl for qemu-devel@nongnu.org; Thu, 18 Jul 2013 10:49:15 -0400 Message-ID: <51E80060.5020709@redhat.com> Date: Thu, 18 Jul 2013 16:49:04 +0200 From: Paolo Bonzini MIME-Version: 1.0 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> In-Reply-To: <1374158537.14214.12.camel@localhost.localdomain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Marcel Apfelbaum Cc: Anthony Liguori , qemu-devel@nongnu.org, afaerber@suse.de 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. > 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. Paolo