* virDriverLoadModuleFull:
* @path: filename of module to load
* @regfunc: name of the function that registers the module
- * @handle: Returns handle of the loaded library if not NULL
*
* Loads a loadable module named @path and calls the
- * registration function @regfunc. If @handle is not NULL the handle is returned
- * in the variable. Otherwise the handle is leaked so that the module stays
- * loaded forever.
+ * registration function @regfunc. The module will never
+ * be unloaded because unloading is not safe in a multi-threaded
+ * application.
*
* The module is automatically looked up in the appropriate place (git or
* installed directory).
*/
int
virDriverLoadModuleFull(const char *path,
- const char *regfunc,
- void **handle)
+ const char *regfunc)
{
void *rethandle = NULL;
int (*regsym)(void);
goto cleanup;
}
- if (handle)
- VIR_STEAL_PTR(*handle, rethandle);
- else
- rethandle = NULL;
-
+ rethandle = NULL;
ret = 0;
cleanup:
#else /* ! HAVE_DLFCN_H */
int
virDriverLoadModuleFull(const char *path ATTRIBUTE_UNUSED,
- const char *regfunc ATTRIBUTE_UNUSED,
- void **handle)
+ const char *regfunc ATTRIBUTE_UNUSED)
{
VIR_DEBUG("dlopen not available on this platform");
- if (handle)
- *handle = NULL;
return -1;
}
#endif /* ! HAVE_DLFCN_H */
"LIBVIRT_DRIVER_DIR")))
return 1;
- ret = virDriverLoadModuleFull(modfile, regfunc, NULL);
+ ret = virDriverLoadModuleFull(modfile, regfunc);
VIR_FREE(modfile);
int virDriverLoadModule(const char *name,
const char *regfunc);
-int virDriverLoadModuleFull(const char *name,
- const char *regfunc,
- void **handle);
+int virDriverLoadModuleFull(const char *path,
+ const char *regfunc);
virConnectPtr virGetConnectInterface(void);
virConnectPtr virGetConnectNetwork(void);
"LIBVIRT_STORAGE_BACKEND_DIR")))
return 1;
- if ((ret = virDriverLoadModuleFull(modfile, regfunc, NULL)) != 0) {
+ if ((ret = virDriverLoadModuleFull(modfile, regfunc)) != 0) {
if (forceload) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to load storage backend module '%s'"),