[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/13] migration: Create vmstate_register_any()
From: |
Juan Quintela |
Subject: |
[PATCH 01/13] migration: Create vmstate_register_any() |
Date: |
Thu, 19 Oct 2023 21:08:19 +0200 |
We have lots of cases where we are using an instance_id==0 when we
should be using VMSTATE_INSTANCE_ID_ANY (-1). Basically everything
that can have more than one needs to have a proper instance_id or -1
and the system will take one for it.
vmstate_register_any(): We register with -1.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
include/migration/vmstate.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 1a31fb7293..9ca7e9cc48 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -1230,6 +1230,23 @@ static inline int vmstate_register(VMStateIf *obj, int
instance_id,
opaque, -1, 0, NULL);
}
+/**
+ * vmstate_register_any() - legacy function to register state
+ * serialisation description and let the function choose the id
+ *
+ * New code shouldn't be using this function as QOM-ified devices have
+ * dc->vmsd to store the serialisation description.
+ *
+ * Returns: 0 on success, -1 on failure
+ */
+static inline int vmstate_register_any(VMStateIf *obj,
+ const VMStateDescription *vmsd,
+ void *opaque)
+{
+ return vmstate_register_with_alias_id(obj, VMSTATE_INSTANCE_ID_ANY, vmsd,
+ opaque, -1, 0, NULL);
+}
+
void vmstate_unregister(VMStateIf *obj, const VMStateDescription *vmsd,
void *opaque);
--
2.41.0
- [PATCH 00/13] migration: Check for duplicates on vmstate_register(), Juan Quintela, 2023/10/19
- [PATCH 03/13] migration: Use vmstate_register_any() for isa-ide, Juan Quintela, 2023/10/19
- [PATCH 01/13] migration: Create vmstate_register_any(),
Juan Quintela <=
- [PATCH 04/13] migration: Use vmstate_register_any() for ipmi-bt*, Juan Quintela, 2023/10/19
- [PATCH 02/13] migration: Use vmstate_register_any(), Juan Quintela, 2023/10/19
- [PATCH 05/13] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp, Juan Quintela, 2023/10/19
- [PATCH 06/13] migration: Use VMSTATE_INSTANCE_ID_ANY for s390 devices, Juan Quintela, 2023/10/19
- [PATCH 07/13] RFC migration: icp/server is a mess, Juan Quintela, 2023/10/19