qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 11/16] block: simplify drive-backup


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v6 11/16] block: simplify drive-backup
Date: Thu, 21 Jul 2016 17:21:32 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 07/21/2016 01:40 PM, Denis V. Lunev wrote:
> From: Pavel Butsykin <address@hidden>
> 
> Now that we can support boxed commands, use it to greatly reduce the
> number of parameters (and likelihood of getting out of sync) when
> adjusting drive-backup parameters..

s/.././

> 
> Signed-off-by: Pavel Butsykin <address@hidden>
> Reviewed-by: Stefan Hajnoczi <address@hidden>
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Jeff Cody <address@hidden>
> CC: Markus Armbruster <address@hidden>
> CC: Eric Blake <address@hidden>
> CC: John Snow <address@hidden>
> CC: Stefan Hajnoczi <address@hidden>
> CC: Kevin Wolf <address@hidden>
> ---
>  blockdev.c           | 115 
> +++++++++++++++++----------------------------------
>  hmp.c                |  29 ++++++++-----
>  qapi/block-core.json |   3 +-
>  3 files changed, 58 insertions(+), 89 deletions(-)
> 

> +++ b/hmp.c
> @@ -1109,8 +1109,24 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)
>      const char *format = qdict_get_try_str(qdict, "format");
>      bool reuse = qdict_get_try_bool(qdict, "reuse", false);
>      bool full = qdict_get_try_bool(qdict, "full", false);
> -    enum NewImageMode mode;
>      Error *err = NULL;
> +    DriveBackup backup = {
> +        .device = (char *)device,
> +        .target = (char *)filename,
> +        .has_format = !!format,
> +        .format = (char *)format,
> +        .sync = full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
> +        .has_mode = true,
> +        .mode = reuse ? NEW_IMAGE_MODE_EXISTING : 
> NEW_IMAGE_MODE_ABSOLUTE_PATHS,

Good.

> +        .has_speed = false,
> +        .speed = 0,
> +        .has_bitmap = false,
> +        .bitmap = NULL,
> +        .has_on_source_error = false,
> +        .on_source_error = 0,
> +        .has_on_target_error = false,
> +        .on_target_error = 0,

I'd drop these. C guarantees that they'll be zero-initialized, and
unless HMP has a way to set them to non-default values, it's not worth
wasting the lines of code.

With those fixups,
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]