qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] qom: Sorted class enumeration


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC] qom: Sorted class enumeration
Date: Wed, 22 Feb 2012 07:25:55 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Lightning/1.0b2 Thunderbird/3.1.15

On 02/22/2012 03:44 AM, Andreas Färber wrote:
Hello,

For listing registered CPU classes I needed a way to sort classes in a
custom (i.e., non-hashtable) order. I found it easiest to sort the classes
using the existing foreach infrastructure, on the go via GLib's binary tree.

Patch is still missing documentation, but do you think this is the right
direction, Anthony?

I think it might be better to have an object_class_search() function that acts like object_class_foreach() but returns a GSList. You can then call g_list_sort() on the resulting data structure.

I've been wondering if it might make sense to replace the current filtering
mechanism (abstract and type) with another callback function or whether that
would be overkill - currently the only other filtering I needed to do was
to ignore the "host" CPU class, which can be done by simple if in the callback.

I'd prefer not to do callbacks because this interface gets exposed via QMP and callbacks can't be modeled via QMP.

Regards,

Anthony Liguori


Regards,
Andreas

Andreas Färber (1):
   qom: Introduce object_class_foreach_ordered()

  include/qemu/object.h |    6 ++++++
  qom/object.c          |   43 +++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 49 insertions(+), 0 deletions(-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]