@@ -596,6 +596,29 @@ void KsPluginManager::unregisterPlugin(const QString &plugin)
}
}
+/** @brief Add to the list and initialize user-provided plugins. All other
+ * previously loaded plugins will be reinitialized and the data will be
+ * reloaded.
+ *
+ * @param fileNames: the library files (.so) of the plugins.
+*/
+void KsPluginManager::addPlugins(const QStringList &fileNames)
+{
+ kshark_context *kshark_ctx(nullptr);
+
+ if (!kshark_instance(&kshark_ctx))
+ return;
+
+ kshark_handle_plugins(kshark_ctx, KSHARK_PLUGIN_CLOSE);
+
+ for (auto const &p: fileNames)
+ registerPlugin(p);
+
+ kshark_handle_plugins(kshark_ctx, KSHARK_PLUGIN_INIT);
+
+ emit dataReload();
+}
+
/** Unload all plugins. */
void KsPluginManager::unloadAll()
{
@@ -210,6 +210,9 @@ public:
void registerPlugin(const QString &plugin);
void unregisterPlugin(const QString &plugin);
+
+ void addPlugins(const QStringList &fileNames);
+
void unloadAll();
void updatePlugins(QVector<int> pluginId);
The method can be used to register and load user-defined plugins. All other previously loaded plugins will be reinitialized and the data will be reloaded. Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> --- kernel-shark/src/KsUtils.cpp | 23 +++++++++++++++++++++++ kernel-shark/src/KsUtils.hpp | 3 +++ 2 files changed, 26 insertions(+)