[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/13] migration: Improve example and documentation of vmstate
From: |
Juan Quintela |
Subject: |
[PATCH v2 10/13] migration: Improve example and documentation of vmstate_register() |
Date: |
Fri, 20 Oct 2023 11:07:28 +0200 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
docs/devel/migration.rst | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst
index c3e1400c0c..bfd8710c95 100644
--- a/docs/devel/migration.rst
+++ b/docs/devel/migration.rst
@@ -165,13 +165,17 @@ An example (from hw/input/pckbd.c)
}
};
-We are declaring the state with name "pckbd".
-The ``version_id`` is 3, and the fields are 4 uint8_t in a KBDState structure.
-We registered this with:
+We are declaring the state with name "pckbd". The ``version_id`` is
+3, and there are 4 uint8_t fields in the KBDState structure. We
+registered this ``VMSTATEDescription`` with one of the following
+functions. The first one will generate a device ``instance_id``
+different for each registration. Use the second one if you already
+have an id that is different for each instance of the device:
.. code:: c
- vmstate_register(NULL, 0, &vmstate_kbd, s);
+ vmstate_register_any(NULL, &vmstate_kbd, s);
+ vmstate_register(NULL, instance_id, &vmstate_kbd, s);
For devices that are ``qdev`` based, we can register the device in the class
init function:
--
2.41.0
- Re: [PATCH v2 04/13] migration: Use vmstate_register_any() for ipmi-bt*, (continued)
- [PATCH v2 05/13] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp, Juan Quintela, 2023/10/20
- [PATCH v2 08/13] migration: vmstate_register() check that instance_id is valid, Juan Quintela, 2023/10/20
- [PATCH v2 07/13] migration: Hack to maintain backwards compatibility for ppc, Juan Quintela, 2023/10/20
- [PATCH v2 10/13] migration: Improve example and documentation of vmstate_register(),
Juan Quintela <=
- [PATCH v2 09/13] migration: Check in savevm_state_handler_insert for dups, Juan Quintela, 2023/10/20
- [PATCH v2 11/13] migration: Use vmstate_register_any() for audio, Juan Quintela, 2023/10/20
- [PATCH v2 12/13] migration: Use vmstate_register_any() for eeprom93xx, Juan Quintela, 2023/10/20
- [PATCH v2 13/13] migration: Use vmstate_register_any() for vmware_vga, Juan Quintela, 2023/10/20