diff options
author | Juan Quintela <quintela@redhat.com> | 2023-10-20 11:07:28 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-11-01 16:13:58 +0100 |
commit | 5b146be3e78d0290670cfc60179218e539a7774f (patch) | |
tree | 687374165022c98008b335fdee3321d6601cf746 | |
parent | caa91b3c44cdb2d2921e25eda554d38c527e6c47 (diff) | |
download | qemu-5b146be3e78d0290670cfc60179218e539a7774f.zip qemu-5b146be3e78d0290670cfc60179218e539a7774f.tar.gz qemu-5b146be3e78d0290670cfc60179218e539a7774f.tar.bz2 |
migration: Improve example and documentation of vmstate_register()
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231020090731.28701-11-quintela@redhat.com>
-rw-r--r-- | docs/devel/migration.rst | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index be91363..240eb16 100644 --- a/docs/devel/migration.rst +++ b/docs/devel/migration.rst @@ -167,13 +167,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: |