qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [Question] About object oriented programming in qemu


From: Li Qiang
Subject: [Qemu-devel] [Question] About object oriented programming in qemu
Date: Wed, 31 Oct 2018 00:08:21 +0800

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.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]