mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -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
|
@ -2257,16 +2257,6 @@ static const VMStateInfo usbredir_ep_bufpq_vmstate_info = {
|
|||
|
||||
|
||||
/* For endp_data migration */
|
||||
static const VMStateDescription usbredir_bulk_receiving_vmstate = {
|
||||
.name = "usb-redir-ep/bulk-receiving",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT8(bulk_receiving_started, struct endp_data),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static bool usbredir_bulk_receiving_needed(void *priv)
|
||||
{
|
||||
struct endp_data *endp = priv;
|
||||
|
@ -2274,12 +2264,13 @@ static bool usbredir_bulk_receiving_needed(void *priv)
|
|||
return endp->bulk_receiving_started;
|
||||
}
|
||||
|
||||
static const VMStateDescription usbredir_stream_vmstate = {
|
||||
.name = "usb-redir-ep/stream-state",
|
||||
static const VMStateDescription usbredir_bulk_receiving_vmstate = {
|
||||
.name = "usb-redir-ep/bulk-receiving",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = usbredir_bulk_receiving_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(max_streams, struct endp_data),
|
||||
VMSTATE_UINT8(bulk_receiving_started, struct endp_data),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
@ -2291,6 +2282,17 @@ static bool usbredir_stream_needed(void *priv)
|
|||
return endp->max_streams;
|
||||
}
|
||||
|
||||
static const VMStateDescription usbredir_stream_vmstate = {
|
||||
.name = "usb-redir-ep/stream-state",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = usbredir_stream_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(max_streams, struct endp_data),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static const VMStateDescription usbredir_ep_vmstate = {
|
||||
.name = "usb-redir-ep",
|
||||
.version_id = 1,
|
||||
|
@ -2318,16 +2320,10 @@ static const VMStateDescription usbredir_ep_vmstate = {
|
|||
VMSTATE_INT32(bufpq_target_size, struct endp_data),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
.subsections = (VMStateSubsection[]) {
|
||||
{
|
||||
.vmsd = &usbredir_bulk_receiving_vmstate,
|
||||
.needed = usbredir_bulk_receiving_needed,
|
||||
}, {
|
||||
.vmsd = &usbredir_stream_vmstate,
|
||||
.needed = usbredir_stream_needed,
|
||||
}, {
|
||||
/* empty */
|
||||
}
|
||||
.subsections = (const VMStateDescription*[]) {
|
||||
&usbredir_bulk_receiving_vmstate,
|
||||
&usbredir_stream_vmstate,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue