
On Wed, Jun 13, 2018 at 10:22 AM +0200, Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
On Mon, Jun 04, 2018 at 06:25 PM +0200, "Daniel P. Berrangé" <berrange@redhat.com> wrote:
On Thu, Apr 26, 2018 at 08:16:54PM -0400, John Ferlan wrote:
[…snip…]
If the application wants to access 'opaque' outside the context of the callback function, it must take steps to ensure it is still alive in whatever thread it using it. This implies the data passed for 'opaque' should be ref-counted and they must hold a reference for their own usage, separately from the reference assoicated with the callback that will be released by @freecb.
That all said, we could take a slightly different approach if we want to be paranoid about this
eg move the
virConnectCloseCallbackDataPtr closeCallback;
out of the driver specific private structs, and put it in the main struct _virConnect instead.
This sound like a revert of commit “close callback: move it to driver” (88f09b75eb99415c). Shall we really do this?
Polite ping.
The main libvirt-host.c can add the callback to this itself. THe driver code only needs to worry about actually invoking the callback
That would allow us to have freecb() called at the right time for all drivers, even if they don't ever use the close callback.
I'm still not sure I understand why the API cannot return a failure, but Daniel says it cannot.
It can break existing applications using hypervisors that don't implement this API, becasue its a change in behaviour. In retrospect I wouldn't have written the API in this way today, but we must live with the design we have.
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
-- Beste Grüße / Kind regards Marc Hartmayer
IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
-- Beste Grüße / Kind regards Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294