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:
Juan Quintela 2014-09-23 14:09:54 +02:00
parent 0163a2e025
commit 5cd8cadae8
32 changed files with 266 additions and 402 deletions

View file

@ -272,11 +272,11 @@ static void dump_vmstate_vmsf(FILE *out_file, const VMStateField *field,
}
static void dump_vmstate_vmss(FILE *out_file,
const VMStateSubsection *subsection,
const VMStateDescription **subsection,
int indent)
{
if (subsection->vmsd != NULL) {
dump_vmstate_vmsd(out_file, subsection->vmsd, indent, true);
if (*subsection != NULL) {
dump_vmstate_vmsd(out_file, *subsection, indent, true);
}
}
@ -317,12 +317,12 @@ static void dump_vmstate_vmsd(FILE *out_file,
fprintf(out_file, "\n%*s]", indent, "");
}
if (vmsd->subsections != NULL) {
const VMStateSubsection *subsection = vmsd->subsections;
const VMStateDescription **subsection = vmsd->subsections;
bool first;
fprintf(out_file, ",\n%*s\"Subsections\": [\n", indent, "");
first = true;
while (subsection->vmsd != NULL) {
while (*subsection != NULL) {
if (!first) {
fprintf(out_file, ",\n");
}