On 09/10/2010 10:00 AM, Daniel P. Berrange wrote:
typedef struct _virLockManagerDriver virLockManagerDriver; typedef virLockManagerDriver *virLockManagerDriverPtr; /* Which callbacks are supported */ typedef enum { VIR_LOCK_MANAGER_DRIVER_RESOURCES = (1<< 0), VIR_LOCK_MANAGER_DRIVER_MIGRATE = (1<< 0),
Same value?
VIR_LOCK_MANAGER_DRIVER_HOTPLUG = (1<< 1), }; struct _virLockManagerDriver { /** * @version: the newest implemented plugin ABI version * @flags: the implemented plugin optional extras */ unsigned int version; unsigned int flags; /** * load_drv: * @version: the libvirt requested plugin ABI version * @flags: the libvirt requested plugin optional extras * * Allow the plugin to validate the libvirt requested * plugin version / flags. This allows it to reject * use of versions which are too old. A plugin may * be loaded multiple times, for different libvirt * drivers * * Returns -1 if the requested version/flags were inadequate */ int (*load_drv)(unsigned int version, unsigned int flags); /** * unload_drv: * * Called to release any resources prior to the plugin * being unloaded from memory. Returns -1 to prevent * plugin unloading. */ int (*load_drv)(void);
s/load_drv/unload_drv/ or this won't compile. Are these two callbacks mandatory, or can they be NULL in the case that the driver only supports exactly what it recorded in version/flags?
/** * virLockManagerPluginLoad: * @name: the name of the plugin * * Attempt to load the plugin $(libdir)/libvirt/lock-manager/@name.so * The plugin driver entry point will be resolved& invoked to obtain * the lock manager driver
Returns NULL on failure, but is there any way to distinguish between levels of failure (file not found vs. plugin_init failed vs. load_drv callback failed), since that might be useful in diagnosing the problem?
*/ virLockManagerPluginPtr virLockManagerPluginLoad(const char *name);
No documentation for virLockMAnagerPluginUnload?
int virLockManagerPluginUnload(virLockManagerPluginPtr);
-- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list