Skip to content

Commit

Permalink
migration: Improve example and documentation of vmstate_register()
Browse files Browse the repository at this point in the history
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231020090731.28701-11-quintela@redhat.com>
  • Loading branch information
Juan Quintela committed Oct 24, 2023
1 parent 23c0efc commit 51fdd22
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/devel/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 51fdd22

Please sign in to comment.