qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] savevm: add comments for qemu_file_get_error()
@ 2013-08-23 10:03 Lei Li
  2013-08-23 10:03 ` [Qemu-devel] [PATCH 2/3] savevm: wrong error set by ram_control_load_hook() Lei Li
  2013-08-23 10:03 ` [Qemu-devel] [PATCH 3/3] arch_init: right return for ram_save_iterate Lei Li
  0 siblings, 2 replies; 5+ messages in thread
From: Lei Li @ 2013-08-23 10:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lei Li, quintela, mrhines, anthony, lagarcia, pbonzini

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] 5+ messages in thread

* [Qemu-devel] [PATCH 2/3] savevm: wrong error set by ram_control_load_hook()
  2013-08-23 10:03 [Qemu-devel] [PATCH 1/3] savevm: add comments for qemu_file_get_error() Lei Li
@ 2013-08-23 10:03 ` Lei Li
  2013-08-23 10:12   ` Paolo Bonzini
  2013-08-23 10:03 ` [Qemu-devel] [PATCH 3/3] arch_init: right return for ram_save_iterate Lei Li
  1 sibling, 1 reply; 5+ messages in thread
From: Lei Li @ 2013-08-23 10:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lei Li, quintela, mrhines, anthony, lagarcia, pbonzini

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..fb17a6f 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] 5+ messages in thread

* [Qemu-devel] [PATCH 3/3] arch_init: right return for ram_save_iterate
  2013-08-23 10:03 [Qemu-devel] [PATCH 1/3] savevm: add comments for qemu_file_get_error() Lei Li
  2013-08-23 10:03 ` [Qemu-devel] [PATCH 2/3] savevm: wrong error set by ram_control_load_hook() Lei Li
@ 2013-08-23 10:03 ` Lei Li
  1 sibling, 0 replies; 5+ messages in thread
From: Lei Li @ 2013-08-23 10:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lei Li, quintela, mrhines, anthony, lagarcia, pbonzini

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
 arch_init.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 94d45e1..a34437c 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -709,16 +709,11 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
      */
     ram_control_after_iterate(f, RAM_CONTROL_ROUND);
 
-    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;
+    return qemu_file_get_error(f);
 }
 
 static int ram_save_complete(QEMUFile *f, void *opaque)
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] savevm: wrong error set by ram_control_load_hook()
  2013-08-23 10:03 ` [Qemu-devel] [PATCH 2/3] savevm: wrong error set by ram_control_load_hook() Lei Li
@ 2013-08-23 10:12   ` Paolo Bonzini
  2013-08-23 12:37     ` Lei Li
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2013-08-23 10:12 UTC (permalink / raw)
  To: Lei Li; +Cc: lagarcia, mrhines, qemu-devel, anthony, quintela

Il 23/08/2013 12:03, Lei Li ha scritto:
> 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..fb17a6f 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;

This should be "-EINVAL".

Paolo

>      if (f->ops->hook_ram_load) {
>          ret = f->ops->hook_ram_load(f, f->opaque, flags);
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] savevm: wrong error set by ram_control_load_hook()
  2013-08-23 10:12   ` Paolo Bonzini
@ 2013-08-23 12:37     ` Lei Li
  0 siblings, 0 replies; 5+ messages in thread
From: Lei Li @ 2013-08-23 12:37 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: lagarcia, anthony, qemu-devel, mrhines, quintela

On 08/23/2013 06:12 PM, Paolo Bonzini wrote:
> Il 23/08/2013 12:03, Lei Li ha scritto:
>> 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..fb17a6f 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;
> This should be "-EINVAL".

Ooops! Sorry for the rush as I was off line to go home...  :-[
Resend soon.

>
> Paolo
>
>>       if (f->ops->hook_ram_load) {
>>           ret = f->ops->hook_ram_load(f, f->opaque, flags);
>>
>


-- 
Lei

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-23 12:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-23 10:03 [Qemu-devel] [PATCH 1/3] savevm: add comments for qemu_file_get_error() Lei Li
2013-08-23 10:03 ` [Qemu-devel] [PATCH 2/3] savevm: wrong error set by ram_control_load_hook() Lei Li
2013-08-23 10:12   ` Paolo Bonzini
2013-08-23 12:37     ` Lei Li
2013-08-23 10:03 ` [Qemu-devel] [PATCH 3/3] arch_init: right return for ram_save_iterate 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).