All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org,  Peter Xu <peterx@redhat.com>,
	 "Dr . David Alan Gilbert" <dave@treblig.org>
Subject: Re: [PATCH v3 15/20] migration: Rewrite migrate_set_parameter_completion using QDict
Date: Thu, 17 Sep 2026 14:02:44 +0200	[thread overview]
Message-ID: <87h5jot7a3.fsf@pond.sub.org> (raw)
In-Reply-To: <20260915000209.3692668-16-farosas@suse.de> (Fabiano Rosas's message of "Mon, 14 Sep 2026 21:02:03 -0300")

Fabiano Rosas <farosas@suse.de> writes:

> We're moving towards having no open-coded access to the
> MigrationParameters members. Instances of parameters enumeration are
> being removed.
>
> The migrate_set_parameter_completion function is one of the last users
> of the MigrationParameter enum. Rewrite that code using an output
> visitor and QDict instead.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>  migration/migration-hmp-cmds.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
> index 00d2d310af..c63d7f1ccb 100644
> --- a/migration/migration-hmp-cmds.c
> +++ b/migration/migration-hmp-cmds.c
> @@ -693,14 +693,20 @@ void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
>  void migrate_set_parameter_completion(ReadLineState *rs, int nb_args,
>                                        const char *str)
>  {
> +    g_autoptr(QDict) d = NULL;
> +    const QDictEntry *e;
>      size_t len;
>  
> +    /* Temporarily borrow the global parameters */

What do you mean by "borrow"?

> +    d = migrate_params_to_dict(&migrate_get_current()->parameters,
> +                               &error_abort);

@d is unused unless @nb_args == 2.  Move the call into the conditional?

> +
>      len = strlen(str);
>      readline_set_completion_index(rs, len);
>      if (nb_args == 2) {
> -        int i;
> -        for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
> -            readline_add_completion_of(rs, str, MigrationParameter_str(i));
> +        for (e = qdict_first(d); e; e = qdict_next(d, e)) {
> +            const char *key = qdict_entry_key(e);
> +            readline_add_completion_of(rs, str, key);
>          }
>      }
>  }

This relies on all parameters being present in the value of
migrate_get_current()->parameters.  Worth a comment?



  reply	other threads:[~2026-09-17 12:03 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  0:01 [PATCH v3 00/20] migration: MigrationParameters changes Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 01/20] checkpatch: Fix checking of newlines in error messages Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 02/20] migration/options.c: Don't export migrate_tls_opts_free Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 03/20] migration: Rename variables in qmp_migrate_set_parameters Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 04/20] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 05/20] migration: Merge parameter structs instead of assigning one by one Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 06/20] migration: Open code migrate_params_apply Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 07/20] migration: Stop freeing s->parameters members individually Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 08/20] migration: Use migrate_params_free during finalize Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 09/20] tests/qtest/migration: Add a test for HMP Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 10/20] tests/qtest/migration: Add a test for HMP completion Fabiano Rosas
2026-09-15  0:01 ` [PATCH v3 11/20] migration: HMP: Change bandwidth parameters expected input unit Fabiano Rosas
2026-09-15  0:02 ` [PATCH v3 12/20] migration: Change HMP 'info migrate_parameters' output Fabiano Rosas
2026-09-15 11:57   ` Markus Armbruster
2026-09-17 21:08   ` Dr. David Alan Gilbert
2026-09-15  0:02 ` [PATCH v3 13/20] migration: Use keyval input visitor in HMP set command Fabiano Rosas
2026-09-17 11:08   ` Markus Armbruster
2026-09-17 18:28     ` Peter Xu
2026-09-17 18:41       ` Markus Armbruster
2026-09-15  0:02 ` [PATCH v3 14/20] migration: Use output visitor in info command Fabiano Rosas
2026-09-17 11:53   ` Markus Armbruster
2026-09-17 11:58     ` Markus Armbruster
2026-09-17 18:41     ` Peter Xu
2026-09-17 20:57       ` Dr. David Alan Gilbert
2026-09-18  8:20         ` Markus Armbruster
2026-09-18 22:32           ` Fabiano Rosas
2026-09-18 22:41     ` Fabiano Rosas
2026-09-15  0:02 ` [PATCH v3 15/20] migration: Rewrite migrate_set_parameter_completion using QDict Fabiano Rosas
2026-09-17 12:02   ` Markus Armbruster [this message]
2026-09-15  0:02 ` [PATCH v3 16/20] migration: Add capabilities into MigrationParameters Fabiano Rosas
2026-09-15  0:02 ` [PATCH v3 17/20] migration: Remove s->capabilities Fabiano Rosas
2026-09-15  0:02 ` [PATCH v3 18/20] qapi/migration: Deprecate capabilities commands Fabiano Rosas
2026-09-15  0:02 ` [PATCH v3 19/20] migration: Set the parameters present flag with a clone visitor Fabiano Rosas
2026-09-17 14:10   ` Markus Armbruster
2026-09-15  0:02 ` [PATCH v3 20/20] qapi: Remove MigrationParameter Fabiano Rosas
2026-09-17 12:06   ` Markus Armbruster
2026-09-22 12:44 ` [PATCH v3 00/20] migration: MigrationParameters changes Fabiano Rosas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h5jot7a3.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=dave@treblig.org \
    --cc=farosas@suse.de \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.