diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-22 14:40:54 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-02-03 10:41:07 -0600 |
commit | 5eeee3fa2e646dadeea2c10515956b11ed0de877 (patch) | |
tree | 77a45e043e2afad81005d12009c24146b125319c /qmp.c | |
parent | 6acbe4c6f18e7de00481ff30574262b58526de45 (diff) | |
download | qemu-5eeee3fa2e646dadeea2c10515956b11ed0de877.tar.gz qemu-5eeee3fa2e646dadeea2c10515956b11ed0de877.tar.bz2 qemu-5eeee3fa2e646dadeea2c10515956b11ed0de877.zip |
qom: add new command to search for types
This adds a command that allows searching for types that implement a property.
This allows you to do things like search for all available PCIDevices. In the
future, we'll also have a standard interface for things with a BlockDriverState
property that a PCIDevice could implement.
This will enable search queries like, "any type that implements the BlockDevice
interface" which would allow management tools to present available block devices
without having to hard code device names. Since an object can implement
multiple interfaces, one device could act both as a BlockDevice and a
NetworkDevice.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qmp.c')
-rw-r--r-- | qmp.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -395,3 +395,30 @@ void qmp_change(const char *device, const char *target, qmp_change_blockdev(device, target, has_arg, arg, err); } } + +static void qom_list_types_tramp(ObjectClass *klass, void *data) +{ + ObjectTypeInfoList *e, **pret = data; + ObjectTypeInfo *info; + + info = g_malloc0(sizeof(*info)); + info->name = g_strdup(object_class_get_name(klass)); + + e = g_malloc0(sizeof(*e)); + e->value = info; + e->next = *pret; + *pret = e; +} + +ObjectTypeInfoList *qmp_qom_list_types(bool has_implements, + const char *implements, + bool has_abstract, + bool abstract, + Error **errp) +{ + ObjectTypeInfoList *ret = NULL; + + object_class_foreach(qom_list_types_tramp, implements, abstract, &ret); + + return ret; +} |