opae-c: add back opae_plugin_mgr_register_plugin()
@@ -600,3 +600,36 @@ out_unlock:
return cb_res;
}
+
+int opae_plugin_mgr_register_plugin(const char *name, const char *cfg)
+{
+ int res;
+ int lock_res = 0;
+ opae_api_adapter_table *adapter;
+
+ adapter = opae_plugin_mgr_alloc_adapter(name);
+ if (!adapter) {
+ OPAE_ERR("malloc failed");
+ return 1;
+ }
+
+ res = opae_plugin_mgr_configure_plugin(adapter, cfg);
+ if (res) {
+ opae_plugin_mgr_free_adapter(adapter);
+ OPAE_ERR("failed to configure plugin \"%s\"", name);
+ return res;
+ }
+
+ if (opae_mutex_lock(lock_res, &adapter_list_lock))
+ return lock_res;
+ res = opae_plugin_mgr_register_adapter(adapter);
+ opae_mutex_unlock(lock_res, &adapter_list_lock);
+
+ if (res) {
+ opae_plugin_mgr_free_adapter(adapter);
+ OPAE_ERR("Failed to register \"%s\"", name);
+ return res;
+ }
+
+ return 0;
+}
