From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0CCq-0007PH-V3 for qemu-devel@nongnu.org; Wed, 22 Feb 2012 08:26:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0CCl-0005OL-0S for qemu-devel@nongnu.org; Wed, 22 Feb 2012 08:26:04 -0500 Received: from mail-gx0-f173.google.com ([209.85.161.173]:37325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0CCk-0005OA-UH for qemu-devel@nongnu.org; Wed, 22 Feb 2012 08:25:58 -0500 Received: by ggni1 with SMTP id i1so16040ggn.4 for ; Wed, 22 Feb 2012 05:25:57 -0800 (PST) Message-ID: <4F44ECE3.6070206@codemonkey.ws> Date: Wed, 22 Feb 2012 07:25:55 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1329903875-3357-1-git-send-email-afaerber@suse.de> In-Reply-To: <1329903875-3357-1-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC] qom: Sorted class enumeration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: pbonzini@redhat.com, qemu-devel@nongnu.org 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(-) >