On 30/10/2018 17:08, Li Qiang wrote: > Hello all, > > > > Today I read the BusClass’ definition. > > > > The comment > > /* FIXME first arg should be BusState */ > > remind me that OOP in qemu is not very OOP.
It is not "not very OOP", it is not language-supported and so it can take a few more liberties. Perhaps these functions should be moved to DeviceClass instead. That would make sense, I think. Paolo > Maybe we should take the first arg as the Object pointer, just as the > cpp’s this pointer. > > For example, we can define the BusClass function as this > > void (*print_dev)(BusState*, Monitor *mon, DeviceState *dev, int indent); > char *(*get_dev_path)(BusState*, DeviceState *dev); > char *(*get_fw_dev_path)(BusState*, DeviceState *dev); > > So we don’t need get the BusState in the callback function, such as > ‘usb_bus_dev_print’. > > > > I want to know do do you think it make senses? > > If not I will not spend time to write the patch. > > > > Thanks, > > Li Qiang >
