qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 10/11] savevm: update return value from qemu_


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v4 10/11] savevm: update return value from qemu_savevm_state
Date: Tue, 09 Apr 2013 18:32:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Pavel Hrdina <address@hidden> writes:

> Signed-off-by: Pavel Hrdina <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> ---
>  savevm.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/savevm.c b/savevm.c
> index 6ac4ece..75f64d1 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1910,7 +1910,7 @@ void qemu_savevm_state_cancel(void)
>      }
>  }
>  
> -static int qemu_savevm_state(QEMUFile *f, Error **errp)
> +static void qemu_savevm_state(QEMUFile *f, Error **errp)
>  {
>      int ret;
>      MigrationParams params = {
> @@ -1919,7 +1919,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
>      };
>  
>      if (qemu_savevm_state_blocked(errp)) {
> -        return -EINVAL;
> +        return;
>      }
>  
>      qemu_mutex_unlock_iothread();
> @@ -1940,7 +1940,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
       ret = qemu_file_get_error(f);
       if (ret == 0) {
           qemu_savevm_state_complete(f, errp);
           ret = qemu_file_get_error(f);
       }
>      if (ret != 0) {
>          qemu_savevm_state_cancel();
>      }
> -    return ret;
>  }
>  

Could be simplified to:

    if (!qemu_file_get_error(f)) {
        qemu_savevm_state_complete(f, errp);
    }
    if (qemu_file_get_error(f)) {
        qemu_savevm_state_cancel();
    }

>  static int qemu_save_device_state(QEMUFile *f)
> @@ -2327,10 +2326,10 @@ SnapshotInfo *qmp_vm_snapshot_save(bool has_name, 
> const char *name,
>          error_setg(errp, "failed to open '%s' file", 
> bdrv_get_device_name(bs));
>          goto the_end;
>      }
> -    ret = qemu_savevm_state(f, &local_err);
> +    qemu_savevm_state(f, &local_err);
>      vm_state_size = qemu_ftell(f);
>      qemu_fclose(f);
> -    if (ret < 0) {
> +    if (error_is_set(&local_err)) {
>          error_propagate(errp, local_err);
>          goto the_end;
>      }



reply via email to

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