[libvirt] [PATCH v2 06/10] Make qemu attach/detach functions public

Tomasz Flendrich t.flendrich at gmail.com
Tue Jul 26 23:08:17 UTC 2016


>
> +int qemuDomainAttachDeviceLiveAndConfig(virConnectPtr conn,
>> +                                        virDomainObjPtr vm,
>> +                                        virQEMUDriverPtr driver,
>> +                                        const char *xml,
>> +                                        unsigned int flags);
>> +
>> +int qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
>> +                                        virDomainObjPtr vm,
>> +                                        const char *xml,
>> +                                        unsigned int flags);
>> +
>> #endif /* __QEMU_DRIVER_H__ */
>>
>
> This should not be exposed in qemu_driver.h, instead the functions
> should be moved to qemu_domain.h if possible, but they now fit there.
>
> If that's not possible, we need to do similar thing as we now have with
> qemu_processpriv.h, so this could be called qemu_domainpriv.h I guess

Did you mean qemu_driverpriv.h?


As you predicted, it's not easily done.

qemuDomainAttachDeviceLiveAndConfig() indirectly uses a few functions
from qemu_hotplug. It would be pointless to move them all to
qemu_domain.h, because then we would have to drag the whole
qemu_hotplug.[hc]
along.


What can be done is moving these to qemu_hotplug.h:
- qemuDomainAttachDeviceLive()
- qemuDomainDetachDeviceLive(),

and these to qemu_domain.h:
- qemuDomainAttachDeviceConfig()
- qemuDomainDetachDeviceConfig()
- qemuDomainChrPreInsert()
- qemuDomainChrInsertPreAlloced()
- qemuDomainChrInsertPreAllocCleanup()
- qemuDomainChrInsert()
- qemuDomainChrRemove().

But then where should qemuDomainAttachDeviceLiveAndConfig() and
qemuDomainDetachDeviceLiveAndConfig() be? In that
qemu_domainpriv/qemu_driverpriv.h? And should their definitions
still be in qemu_driver.c, or in a brand new .c file?


Btw qemuDomainUpdateDeviceFlags() is still unsplit and it deserves
the same treatment as the other two *DeviceFlags functions. It will
be done in v3.


Thank you again for such thorough reviews! I really appreciate it.
Tomasz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160727/7fa19830/attachment-0001.htm>


More information about the libvir-list mailing list