mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
migration: Use normal VMStateDescriptions for Subsections
We create optional sections with this patch. But we already have optional subsections. Instead of having two mechanism that do the same, we can just generalize it. For subsections we just change: - Add a needed function to VMStateDescription - Remove VMStateSubsection (after removal of the needed function it is just a VMStateDescription) - Adjust the whole tree, moving the needed function to the corresponding VMStateDescription Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
0163a2e025
commit
5cd8cadae8
32 changed files with 266 additions and 402 deletions
|
@ -283,6 +283,7 @@ static const VMStateDescription vmstate_hpet_rtc_irq_level = {
|
|||
.name = "hpet/rtc_irq_level",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = hpet_rtc_irq_level_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT8(rtc_irq_level, HPETState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
|
@ -322,13 +323,9 @@ static const VMStateDescription vmstate_hpet = {
|
|||
vmstate_hpet_timer, HPETTimer),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
.subsections = (VMStateSubsection[]) {
|
||||
{
|
||||
.vmsd = &vmstate_hpet_rtc_irq_level,
|
||||
.needed = hpet_rtc_irq_level_needed,
|
||||
}, {
|
||||
/* empty */
|
||||
}
|
||||
.subsections = (const VMStateDescription*[]) {
|
||||
&vmstate_hpet_rtc_irq_level,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -733,22 +733,23 @@ static int rtc_post_load(void *opaque, int version_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_rtc_irq_reinject_on_ack_count = {
|
||||
.name = "mc146818rtc/irq_reinject_on_ack_count",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT16(irq_reinject_on_ack_count, RTCState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static bool rtc_irq_reinject_on_ack_count_needed(void *opaque)
|
||||
{
|
||||
RTCState *s = (RTCState *)opaque;
|
||||
return s->irq_reinject_on_ack_count != 0;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_rtc_irq_reinject_on_ack_count = {
|
||||
.name = "mc146818rtc/irq_reinject_on_ack_count",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = rtc_irq_reinject_on_ack_count_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT16(irq_reinject_on_ack_count, RTCState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static const VMStateDescription vmstate_rtc = {
|
||||
.name = "mc146818rtc",
|
||||
.version_id = 3,
|
||||
|
@ -770,13 +771,9 @@ static const VMStateDescription vmstate_rtc = {
|
|||
VMSTATE_UINT64_V(next_alarm_time, RTCState, 3),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
.subsections = (VMStateSubsection[]) {
|
||||
{
|
||||
.vmsd = &vmstate_rtc_irq_reinject_on_ack_count,
|
||||
.needed = rtc_irq_reinject_on_ack_count_needed,
|
||||
}, {
|
||||
/* empty */
|
||||
}
|
||||
.subsections = (const VMStateDescription*[]) {
|
||||
&vmstate_rtc_irq_reinject_on_ack_count,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue