qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.a@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [RFC PATCH 1/2] qemu-help: Sort devices by logical functionality
Date: Thu, 18 Jul 2013 18:23:04 +0300	[thread overview]
Message-ID: <1374160984.14214.23.camel@localhost.localdomain> (raw)
In-Reply-To: <87txjrzzgs.fsf@codemonkey.ws>

On Thu, 2013-07-18 at 09:58 -0500, Anthony Liguori wrote:
> Paolo Bonzini <pbonzini@redhat.com> 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 <marcel.a@redhat.com> 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 <marcel.a@redhat.com>
> >>>> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> >>>> ---
> >>>>  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.
I agree that these are different device types, but they have the same category:
"Network"
> 
> 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.
Interesting, thanks, in one hand I can call them both "Controller",
on the other hand the bitmap can be used for creating subcategories:
For example: "Storage, Controller" and "I/O, Controller"

> 
> >> 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.
The suggested solution works fair enough, thanks!
Marcel 

> 
> Regards,
> 
> Anthony Liguori
> 
> >
> > Paolo
> 

  reply	other threads:[~2013-07-18 15:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18  8:27 [Qemu-devel] [RFC PATCH 0/2] qemu-help: improve -device command line help Marcel Apfelbaum
2013-07-18  8:27 ` [Qemu-devel] [RFC PATCH 1/2] qemu-help: Sort devices by logical functionality Marcel Apfelbaum
2013-07-18 14:12   ` Michael S. Tsirkin
2013-07-18 14:28   ` Anthony Liguori
2013-07-18 14:42     ` Marcel Apfelbaum
2013-07-18 14:49       ` Paolo Bonzini
2013-07-18 14:58         ` Anthony Liguori
2013-07-18 15:23           ` Marcel Apfelbaum [this message]
2013-07-18 15:32             ` Paolo Bonzini
2013-07-21  8:03           ` Michael S. Tsirkin
2013-07-21 13:57     ` Ronen Hod
2013-07-18  8:27 ` [Qemu-devel] [RFC PATCH 2/2] devices: Associate devices to their logical category Marcel Apfelbaum
2013-07-18 13:56 ` [Qemu-devel] [RFC PATCH 0/2] qemu-help: improve -device command line help Paolo Bonzini
2013-07-18 14:02   ` Marcel Apfelbaum
2013-07-18 15:04   ` Eric Blake
2013-07-21 12:09 ` Andreas Färber
2013-07-21 12:49   ` Michael S. Tsirkin
2013-07-29 20:24 ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2013-07-18  9:06 Marcel Apfelbaum
2013-07-18  9:06 ` [Qemu-devel] [RFC PATCH 1/2] qemu-help: Sort devices by logical functionality Marcel Apfelbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374160984.14214.23.camel@localhost.localdomain \
    --to=marcel.a@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).