Introduce new APIs, returning bool. The analysis https://lore.kernel.org/qemu-devel/[email protected]/ shows, that vmstate_load_state() return value actually only used to check for success, specific errno values doesn't make sense.
With this commit we introduce new functions with modern bool interface, and in following commits we'll update the whole code base to use them, and finally remove old vmstate_load_state() and vmstate_save_state(). During this update, we'll see, that return values of both functions is not significantly used, other then to check for success. Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> --- include/migration/vmstate.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index dbe330dd5f..0aac3b7a66 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1228,6 +1228,20 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, JSONWriter *vmdesc, int version_id, Error **errp); +static inline bool vmstate_load_vmsd( + QEMUFile *f, const VMStateDescription *vmsd, + void *opaque, int version_id, Error **errp) +{ + return vmstate_load_state(f, vmsd, opaque, version_id, errp) >= 0; +} + +static inline bool vmstate_save_vmsd( + QEMUFile *f, const VMStateDescription *vmsd, + void *opaque, JSONWriter *vmdesc, Error **errp) +{ + return vmstate_save_state(f, vmsd, opaque, vmdesc, errp) >= 0; +} + bool vmstate_section_needed(const VMStateDescription *vmsd, void *opaque); #define VMSTATE_INSTANCE_ID_ANY -1 -- 2.48.1
