* Jianjun Duan (du...@linux.vnet.ibm.com) wrote: > > > On 10/07/2016 09:32 AM, Paolo Bonzini wrote: > > > > > > On 07/10/2016 18:31, Jianjun Duan wrote: > >> > >> > >> On 10/07/2016 07:34 AM, Dr. David Alan Gilbert wrote: > >>> * Paolo Bonzini (pbonz...@redhat.com) wrote: > >>>> > >>>> > >>>> On 06/10/2016 21:01, Dr. David Alan Gilbert wrote: > >>>>>>>> + } else if (field->flags & VMS_LINKED) { > >>>>>>>> + ret = field->info->get(f, addr, size, field); > >>>>>>>> } else { > >>>>>>>> ret = field->info->get(f, addr, size, NULL); > >>>>>>>> > >>>>>>>> @@ -193,6 +197,8 @@ static const char > >>>>>>>> *vmfield_get_type_name(VMStateField *field) > >>>>>>>> > >>>>>>>> if (field->flags & VMS_STRUCT) { > >>>>>>>> type = "struct"; > >>>>>>>> + } else if (field->flags & VMS_LINKED) { > >>>>>>>> + type = "linked"; > >>>>>>>> } else if (field->info->name) { > >>>>>>>> type = field->info->name; > >>>>>>>> } > >>>>>>>> @@ -327,6 +333,8 @@ void vmstate_save_state(QEMUFile *f, const > >>>>>>>> VMStateDescription *vmsd, > >>>>>>>> } > >>>>>>>> if (field->flags & VMS_STRUCT) { > >>>>>>>> vmstate_save_state(f, field->vmsd, addr, > >>>>>>>> vmdesc_loop); > >>>>>>>> + } else if (field->flags & VMS_LINKED) { > >>>>>>>> + field->info->put(f, addr, size, field, > >>>>>>>> vmdesc_loop); > >>>>>>>> } else { > >>>>>>>> field->info->put(f, addr, size, NULL, NULL); > >>>>>>>> } > >>>> > >>>> Is VMS_LINKED needed at all, since the fields are unused for every > >>>> VMStateInfo except qtailq? > >>> > >>> No, I think you could easily drop the VMS_LINKED and just always pass > >>> them in. > >> > >> It is needed if we want to use vmdesc_loop. > > > > Just always pass it in, can't you? > > > Could that lead to repetition of array elements? I know it depends on > individual put details.
I don't think so; Paolo is just suggesting replacing: + } else if (field->flags & VMS_LINKED) { + field->info->put(f, addr, size, field, vmdesc_loop); } else { field->info->put(f, addr, size, NULL, NULL); } by: } else { - field->info->put(f, addr, size, NULL, NULL); + field->info->put(f, addr, size, field, vmdesc_loop); } most get/put won't use the field/vmdesc_loop so it wont matter. Dave > > Thanks, > Jianjun > > Paolo > > > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK