diff mbox series

[v2,10/12] vl: handle -object help

Message ID 20180907075948.26917-11-marcandre.lureau@redhat.com
State New
Headers show
Series Various qemu command line options help improvements | expand

Commit Message

Marc-André Lureau Sept. 7, 2018, 7:59 a.m. UTC
List the user creatable objects.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 vl.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Paolo Bonzini Oct. 3, 2018, 1:02 p.m. UTC | #1
On 07/09/2018 09:59, Marc-André Lureau wrote:
> List the user creatable objects.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  vl.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/vl.c b/vl.c
> index 5ba06adf78..71765a2982 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2731,6 +2731,19 @@ static int machine_set_property(void *opaque,
>   */
>  static bool object_create_initial(const char *type)
>  {
> +    if (is_help_option(type)) {
> +        GSList *l, *list;
> +
> +        printf("List of user creatable objects:\n");
> +        list = object_class_get_list_sorted(TYPE_USER_CREATABLE, false);
> +        for (l = list; l != NULL; l = l->next) {
> +            ObjectClass *oc = OBJECT_CLASS(l->data);
> +            printf("%s\n", object_class_get_name(oc));
> +        }
> +        g_slist_free(list);
> +        exit(0);
> +    }
> +
>      if (g_str_equal(type, "rng-egd") ||
>          g_str_has_prefix(type, "pr-manager-")) {
>          return false;
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff mbox series

Patch

diff --git a/vl.c b/vl.c
index 5ba06adf78..71765a2982 100644
--- a/vl.c
+++ b/vl.c
@@ -2731,6 +2731,19 @@  static int machine_set_property(void *opaque,
  */
 static bool object_create_initial(const char *type)
 {
+    if (is_help_option(type)) {
+        GSList *l, *list;
+
+        printf("List of user creatable objects:\n");
+        list = object_class_get_list_sorted(TYPE_USER_CREATABLE, false);
+        for (l = list; l != NULL; l = l->next) {
+            ObjectClass *oc = OBJECT_CLASS(l->data);
+            printf("%s\n", object_class_get_name(oc));
+        }
+        g_slist_free(list);
+        exit(0);
+    }
+
     if (g_str_equal(type, "rng-egd") ||
         g_str_has_prefix(type, "pr-manager-")) {
         return false;