qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v2 3/5] vmstate: add VMS_MUST_EXIST


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [RFC v2 3/5] vmstate: add VMS_MUST_EXIST
Date: Mon, 24 Mar 2014 18:21:25 +0200

On Mon, Mar 24, 2014 at 04:38:01PM +0200, Michael S. Tsirkin wrote:
> Can be used to verify a required field exists or validate
> state in some other way.
> 
> Signed-off-by: Michael S. Tsirkin <address@hidden>

Sent a wrong patch. this is RFC in any case so not resending
everything, but this is needed on top both to build and make the intent
clear:


diff --git a/vmstate.c b/vmstate.c
index 4943b83..974c618 100644
--- a/vmstate.c
+++ b/vmstate.c
@@ -105,11 +105,11 @@ int vmstate_load_state(QEMUFile *f, const 
VMStateDescription *vmsd,
                     return ret;
                 }
             }
+        } else if (field->flags & VMS_MUST_EXIST) {
+            fprintf(stderr, "Input validation failed: %s/%s\n", vmsd->name, 
field->name);
+            return -1;
         }
         field++;
-    } else if (field->flags & VMS_MUST_EXIST) {
-        fprintf(stderr, "Input validation failed: %s/%s\n", vmsd->name, 
field->name);
-        return -1;
     }
     ret = vmstate_subsection_load(f, vmsd, opaque);
     if (ret != 0) {



reply via email to

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