
On 07/01/2014 02:35 AM, Daniel P. Berrange wrote:
1. A custom callback to run per API
typedef (void)(*virDomainBlockInfoCallback)(virDomainPtr dom, bool isError, virDomainBlockInfoPtr info, void *opaque);
It might be nice to require the callback to return an int; 0 to keep going, non-zero to stop immediately.
int virDomainGetBlockInfoAsync(virDomainPtr dom, const char *disk, virDomainBlockInfoCallback cb, void *opaque, unsigned int flags);
What should this function return on success, 0 or the number of times the callback was reached? However, even if we add a callback return value (non-zero to quit immediately), I don't think feeding it directly to the return value is nice; we still want to reserve negative values for errors (couldn't even invoke callbacks, perhaps because dom was a bad pointer). Besides, a user can always use opaque to collect counts of how many times the callback was invoked, and/or a specific return value on early exit. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org