From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW6DE-0001GN-7m for qemu-devel@nongnu.org; Thu, 12 Mar 2015 12:43:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW6D5-0001KM-LM for qemu-devel@nongnu.org; Thu, 12 Mar 2015 12:43:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47914 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW6D5-0001Ju-FI for qemu-devel@nongnu.org; Thu, 12 Mar 2015 12:43:47 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 12 Mar 2015 17:43:37 +0100 Message-Id: <1426178624-32638-3-git-send-email-afaerber@suse.de> In-Reply-To: <1426178624-32638-1-git-send-email-afaerber@suse.de> References: <1426178624-32638-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 2/9] qom: Implement qom-list HMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Luiz Capitulino Implement it as a wrapper for QMP qom-list, but mimic the behavior of scripts/qmp/qom-list in making the path argument optional and listing the root if absent, to hint users what kind of path to pass. Signed-off-by: Andreas F=C3=A4rber --- hmp-commands.hx | 13 +++++++++++++ hmp.c | 26 ++++++++++++++++++++++++++ hmp.h | 1 + 3 files changed, 40 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index d5022d8..c3b93d6 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1658,6 +1658,19 @@ Add CPU with id @var{id} ETEXI =20 { + .name =3D "qom-list", + .args_type =3D "path:s?", + .params =3D "path", + .help =3D "list QOM properties", + .mhandler.cmd =3D hmp_qom_list, + }, + +STEXI +@item qom-list [@var{path}] +Print QOM properties of object at location @var{path} +ETEXI + + { .name =3D "info", .args_type =3D "item:s?", .params =3D "[subcommand]", diff --git a/hmp.c b/hmp.c index 71c28bc..f6df075 100644 --- a/hmp.c +++ b/hmp.c @@ -1852,3 +1852,29 @@ void hmp_info_memory_devices(Monitor *mon, const Q= Dict *qdict) =20 qapi_free_MemoryDeviceInfoList(info_list); } + +void hmp_qom_list(Monitor *mon, const QDict *qdict) +{ + const char *path =3D qdict_get_try_str(qdict, "path"); + ObjectPropertyInfoList *list; + Error *err =3D NULL; + + if (path =3D=3D NULL) { + monitor_printf(mon, "/\n"); + return; + } + + list =3D qmp_qom_list(path, &err); + if (err =3D=3D NULL) { + ObjectPropertyInfoList *start =3D list; + while (list !=3D NULL) { + ObjectPropertyInfo *value =3D list->value; + + monitor_printf(mon, "%s (%s)\n", + value->name, value->type); + list =3D list->next; + } + qapi_free_ObjectPropertyInfoList(start); + } + hmp_handle_error(mon, &err); +} diff --git a/hmp.h b/hmp.h index 81177b2..18c0f52 100644 --- a/hmp.h +++ b/hmp.h @@ -95,6 +95,7 @@ void hmp_object_add(Monitor *mon, const QDict *qdict); void hmp_object_del(Monitor *mon, const QDict *qdict); void hmp_info_memdev(Monitor *mon, const QDict *qdict); void hmp_info_memory_devices(Monitor *mon, const QDict *qdict); +void hmp_qom_list(Monitor *mon, const QDict *qdict); void object_add_completion(ReadLineState *rs, int nb_args, const char *s= tr); void object_del_completion(ReadLineState *rs, int nb_args, const char *s= tr); void device_add_completion(ReadLineState *rs, int nb_args, const char *s= tr); --=20 2.1.4