[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.10 06/10] hmp: Clean up and simplify hmp_m
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [PATCH for-2.10 06/10] hmp: Clean up and simplify hmp_migrate_set_parameter() |
Date: |
Tue, 18 Jul 2017 16:54:30 +0100 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
On Tue, Jul 18, 2017 at 03:41:22PM +0200, Markus Armbruster wrote:
> The bulk of hmp_migrate_set_parameter()'s code sets one member of
> MigrationParameters according to the command's arguments. It uses a
> string visitor for integer and boolean members, but not for string and
> size members. It calls visit_type_bool() right away, but delays
> visit_type_int() some. The delaying requires a flag variable and a
> bit of trickery: we set all integer members instead of just the one we
> want, and rely on the has_FOOs to mask the unwanted ones.
>
> Clean this up as follows. Don't delay calling visit_type_int(). Use
> the string visitor for strings, too. This involves extra allocations
> and cleanup, but doing them is simpler and cleaner than avoiding them.
>
> Sadly, using the string visitor for sizes isn't possible, because it
> defaults to Bytes rather than Mebibytes. Add a comment explaining
> that.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> hmp.c | 78
> ++++++++++++++++++++++++++++---------------------------------------
> 1 file changed, 32 insertions(+), 46 deletions(-)
Reviewed-by: Daniel P. Berrange <address@hidden>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|