Received: from eggs.gnu.org ([2001:4830:134:3::10]:48287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baKLL-0006xq-D8 for qemu-devel@nongnu.org; Thu, 18 Aug 2016 06:14:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1baKLG-0003pr-Vo for qemu-devel@nongnu.org; Thu, 18 Aug 2016 06:14:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:40086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baKLG-0003pI-Jk for qemu-devel@nongnu.org; Thu, 18 Aug 2016 06:14:30 -0400 References: <20160816171316.16959-1-lma@suse.com> <20160816171316.16959-1-lma@suse.com> <87d1l7vqjq.fsf@dusky.pond.sub.org> <57B5F6F30200006200090694@prv-mh.provo.novell.com> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: Date: Thu, 18 Aug 2016 12:14:28 +0200 MIME-Version: 1.0 In-Reply-To: <57B5F6F30200006200090694@prv-mh.provo.novell.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] =?utf-8?b?562U5aSN77yaIFJlOiAgW1BBVENIXSBvYmplY3Q6?= =?utf-8?q?_Add_=27help=27_option_to_print_all_available_object_backend_ty?= =?utf-8?q?pes?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lin Ma Cc: Markus Armbruster , qemu-devel@nongnu.org Am 18.08.2016 um 11:57 schrieb Lin Ma: >>>> Markus Armbruster 2016/8/17 =E6=98=9F=E6=9C=9F=E4= =B8=89 =E4=B8=8B=E5=8D=88 2:48 >>> >>Lin Ma writes: >> >>> Signed-off-by: Lin Ma >>> --- >>> qemu-options.hx | 5 ++++- >>> qom/object_interfaces.c | 16 ++++++++++++++++ >>> 2 files changed, 20 insertions(+), 1 deletion(-) >>> >>> diff --git a/qemu-options.hx b/qemu-options.hx >>> index a71aaf8..c5f4a12 100644 >>> --- a/qemu-options.hx >>> +++ b/qemu-options.hx >>> @@ -3752,7 +3752,8 @@ DEF("object", HAS_ARG, QEMU_OPTION_object, >>> " create a new object of type TYPENAME setting > properties\n" >>> " in the order they are specified. Note that the > 'id'\n" >>> " property must be set. These objects are placed > in the\n" >>> - " '/objects' path.\n", >>> + " '/objects' path.\n" >>> + " Use '-object help' to print available backend > types.\n", >>> QEMU_ARCH_ALL) >>> STEXI >>> @item -object @var{typename}[,@var{prop1}=3D@var{value1},...] >>> @@ -3762,6 +3763,8 @@ in the order they are specified. Note that the > 'id' >>> property must be set. These objects are placed in the >>> '/objects' path. >>>=20 >>> +Use '-object help' to print available backend types. >>> + >>> @table @option >>>=20 >>> @item -object > memory-backend-file,id=3D@var{id},size=3D@var{size},mem-path=3D@var{dir= },share=3D@var{on|off} >>> diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c >>> index bf59846..8f820a4 100644 >>> --- a/qom/object_interfaces.c >>> +++ b/qom/object_interfaces.c >>> @@ -58,6 +58,22 @@ Object *user_creatable_add(const QDict *qdict, >>> goto out_visit; >>> } >>>=20 >>> + if (!strcmp(type, "help")) { >> >>Please use is_help_option(). > ok, will do it. Thanks, otherwise looks good to me. However, I am not really the maintainer of object_interfaces.c, please check the git log and also CC Stefan/Paolo or whomever it was for review. > btw, Should I add the behaviour like -device argument T,help > to show additional help for type T ? Not necessarily in this patch, could be done as follow-up. Cheers, Andreas >>> + printf("Available object backend types:\n"); >>> + GSList *list =3D object_class_get_list(TYPE_USER_CREATABLE, > false); >>> + while (list) { >>> + const char *name; >>> + name =3D object_class_get_name(OBJECT_CLASS(list->data))= ; >>> + /* Ignore user-creatable. */ >>> + if (strcmp(name, TYPE_USER_CREATABLE)) { >>> + printf("%s\n", name); >>> + } >>> + list =3D list->next; >>> + } >>> + g_slist_free(list); >>> + exit(0); >>> + } >>> + >>> qdict_del(pdict, "id"); >>> visit_type_str(v, "id", &id, &local_err); >>> if (local_err) { --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton HRB 21284 (AG N=C3=BCrnberg)