On 2012-01-25 11:15, Paolo Bonzini wrote: > On 01/25/2012 09:37 AM, Jan Kiszka wrote: >>> > They're exactly the same size (16 lines). If you embed TypeInfo into >>> > DeviceTypeInfo, and introduce a Device specific type registration >>> > function, then you could do: >>> > >>> > static DeviceTypeInfo my_device_type_info = { >>> > .type.name = TYPE_MY_DEVICE, >>> > .type.parent = TYPE_PARENT_DEVICE, >>> > .reset = my_device_reset, >> And if you introduce some >> >> #define TYPE_UNIMPLEMENTED (void *)&dummy_variable >> >> you can easily express >> >> [.field = NULL] => use parent >> .field = UNIMPLEMENTED => don't run any handler >> > > I agree with Anthony, this would get really ugly where you are calling > the functions and doing the class initialization.
I think we need to try it first. There is a lot of repetition, and that gets boring at beat and ugly at worst when doing it for hundreds of devices - compared to the number of base classes we will have. > It's a different > style from what we're used to, granted, but the difference in code size > is not relevant (not enough to introduce a level of macro magic, at > least) and the diffstat in this series is misleading because qdev is > left with temporary duplication for now. I was looking at the final version Anthony pointed at. Jan
signature.asc
Description: OpenPGP digital signature