* [Qemu-devel] [PATCH 1/3 v2] savevm: add comments for qemu_file_get_error()
@ 2013-08-26 9:29 Lei Li
2013-08-26 9:29 ` [Qemu-devel] [PATCH 2/3 v2] savevm: fix wrong error set by ram_control_load_hook() Lei Li
2013-08-26 9:29 ` [Qemu-devel] [PATCH 3/3 v2] arch_init: right return for ram_save_iterate Lei Li
0 siblings, 2 replies; 4+ messages in thread
From: Lei Li @ 2013-08-26 9:29 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, anthony, mrhines, Lei Li
Add comments for qemu_file_get_error(), as its return value
is not very clear.
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
savevm.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/savevm.c b/savevm.c
index 03fc4d9..95a11f9 100644
--- a/savevm.c
+++ b/savevm.c
@@ -566,6 +566,13 @@ QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops)
return f;
}
+/*
+ * Get last error for stream f
+ *
+ * Return negative error value if there has been an error on previous
+ * operations, return 0 if no error happened.
+ *
+ */
int qemu_file_get_error(QEMUFile *f)
{
return f->last_error;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/3 v2] savevm: fix wrong error set by ram_control_load_hook()
2013-08-26 9:29 [Qemu-devel] [PATCH 1/3 v2] savevm: add comments for qemu_file_get_error() Lei Li
@ 2013-08-26 9:29 ` Lei Li
2013-08-26 9:29 ` [Qemu-devel] [PATCH 3/3 v2] arch_init: right return for ram_save_iterate Lei Li
1 sibling, 0 replies; 4+ messages in thread
From: Lei Li @ 2013-08-26 9:29 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, anthony, mrhines, Lei Li
It should set negative error value if there has been an error.
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
savevm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/savevm.c b/savevm.c
index 95a11f9..a0be109 100644
--- a/savevm.c
+++ b/savevm.c
@@ -649,7 +649,7 @@ void ram_control_after_iterate(QEMUFile *f, uint64_t flags)
void ram_control_load_hook(QEMUFile *f, uint64_t flags)
{
- int ret = 0;
+ int ret = -EINVAL;
if (f->ops->hook_ram_load) {
ret = f->ops->hook_ram_load(f, f->opaque, flags);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 3/3 v2] arch_init: right return for ram_save_iterate
2013-08-26 9:29 [Qemu-devel] [PATCH 1/3 v2] savevm: add comments for qemu_file_get_error() Lei Li
2013-08-26 9:29 ` [Qemu-devel] [PATCH 2/3 v2] savevm: fix wrong error set by ram_control_load_hook() Lei Li
@ 2013-08-26 9:29 ` Lei Li
2013-08-29 9:07 ` Lei Li
1 sibling, 1 reply; 4+ messages in thread
From: Lei Li @ 2013-08-26 9:29 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, anthony, mrhines, Lei Li
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Change since v1:
Return fixes and improvement from Paolo Bonzini.
arch_init.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 94d45e1..a26bc89 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -709,15 +709,20 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
*/
ram_control_after_iterate(f, RAM_CONTROL_ROUND);
+ bytes_transferred += total_sent;
+
+ /*
+ * Do not count these 8 bytes into total_sent, so that we can
+ * return 0 if no page had been dirtied.
+ */
+ qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
+ bytes_transferred += 8;
+
+ ret = qemu_file_get_error(f);
if (ret < 0) {
- bytes_transferred += total_sent;
return ret;
}
- qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
- total_sent += 8;
- bytes_transferred += total_sent;
-
return total_sent;
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 3/3 v2] arch_init: right return for ram_save_iterate
2013-08-26 9:29 ` [Qemu-devel] [PATCH 3/3 v2] arch_init: right return for ram_save_iterate Lei Li
@ 2013-08-29 9:07 ` Lei Li
0 siblings, 0 replies; 4+ messages in thread
From: Lei Li @ 2013-08-29 9:07 UTC (permalink / raw)
To: pbonzini, qemu-devel; +Cc: mrhines, anthony, Lei Li
Hi,
I have tested this series of changes, PING?
On 08/26/2013 05:29 PM, Lei Li wrote:
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>
> Change since v1:
> Return fixes and improvement from Paolo Bonzini.
>
> arch_init.c | 15 ++++++++++-----
> 1 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 94d45e1..a26bc89 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -709,15 +709,20 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
> */
> ram_control_after_iterate(f, RAM_CONTROL_ROUND);
>
> + bytes_transferred += total_sent;
> +
> + /*
> + * Do not count these 8 bytes into total_sent, so that we can
> + * return 0 if no page had been dirtied.
> + */
> + qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
> + bytes_transferred += 8;
> +
> + ret = qemu_file_get_error(f);
> if (ret < 0) {
> - bytes_transferred += total_sent;
> return ret;
> }
>
> - qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
> - total_sent += 8;
> - bytes_transferred += total_sent;
> -
> return total_sent;
> }
>
--
Lei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-29 9:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 9:29 [Qemu-devel] [PATCH 1/3 v2] savevm: add comments for qemu_file_get_error() Lei Li
2013-08-26 9:29 ` [Qemu-devel] [PATCH 2/3 v2] savevm: fix wrong error set by ram_control_load_hook() Lei Li
2013-08-26 9:29 ` [Qemu-devel] [PATCH 3/3 v2] arch_init: right return for ram_save_iterate Lei Li
2013-08-29 9:07 ` Lei Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).