On 06/10/2016 14:55, Halil Pasic wrote: > > Let us simplify a couple of things and get rid of some code duplication. > > NOTE: This series is exploring the suggestions of Paolo (I did my best > to do everything as requested). I still think that we are better of with > a macro that with spelling out the VMStateDescription for each device > separately and redundantly. The LOC balance of the previous version was > -41, this version is at +14 because of the expanded macros. IMHO the > readability benefit of spelling out the vmsd definitions is questionabe > (but it is beneficial if using ctags or grep). I hope for a good > discussion, but I can live with this version too. > > v1 --> v2: > * export VMStateInfo instead of helpers > * change semantic of VMSTATE_VIRTIO_DEVICE > * drop VIRTIO_DEF_DEVICE_VMSD macro, use its expansion instead
Yes, this is what I meant... I personally like that everything is spelled out in +static const VMStateDescription vmstate_virtio_blk = { + .name = "virtio-blk", + .minimum_version_id = 2, + .version_id = 2, + .fields = (VMStateField[]) { + VMSTATE_VIRTIO_DEVICE, + VMSTATE_END_OF_LIST() + }, +}; but I understand that other's mileages may vary... Paolo