OSDN Git Service

hw/ide/piix: Move registration of VMStateDescription to DeviceClass
authorBernhard Beschow <shentey@gmail.com>
Wed, 31 May 2023 21:10:43 +0000 (23:10 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Mon, 10 Jul 2023 22:11:25 +0000 (00:11 +0200)
commit752dfff5ecf35a38145c2dfbb842224177fd1afd
treebaba28882c7faa0773f17fc9b184e89207464e47
parent17d6a4a32589c54d16ecb27c5116c2e4aca1b742
hw/ide/piix: Move registration of VMStateDescription to DeviceClass

The modern, declarative way to set up VM state handling is to assign to
DeviceClass::vmsd attribute.

There shouldn't be any change in behavior since dc->vmsd causes
vmstate_register_with_alias_id() to be called on the instance during
the instance init phase. vmstate_register() was also called during the
instance init phase which forwards to vmstate_register_with_alias_id()
internally. Checking the migration schema before and after this patch confirms:

before:
> qemu-system-x86_64 -S
> qemu > migrate -d exec:cat>before.mig

after:
> qemu-system-x86_64 -S
> qemu > migrate -d exec:cat>after.mig

> analyze-migration.py -d desc -f before.mig > before.json
> analyze-migration.py -d desc -f after.mig > after.json
> diff before.json after.json
-> empty

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20230531211043.41724-8-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/ide/piix.c