diff options
author | Guillaume Denneulin <guillaumex.denneulin@intel.com> | 2012-02-17 14:38:14 +0100 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-10 17:15:02 +0100 |
commit | a4ec15d5d5e84fbee3faa46a66e7b1eb90816ce2 (patch) | |
tree | f9337905614685a6cc18036c56d477a5a6f83450 /parameter/SystemClass.cpp | |
parent | 19bb62917f765c3fa11d1d4c5f88c445e22f227a (diff) | |
download | external_parameter-framework-a4ec15d5d5e84fbee3faa46a66e7b1eb90816ce2.zip external_parameter-framework-a4ec15d5d5e84fbee3faa46a66e7b1eb90816ce2.tar.gz external_parameter-framework-a4ec15d5d5e84fbee3faa46a66e7b1eb90816ce2.tar.bz2 |
PFW: Enhance subsytem libraries load mechanism
BZ: 24093
If a subsystem library depends on another one, the libraries have to be loaded
in a predefined order.
the previous recovery mechanism on PFW was: When a subsystem library does not
load because of a missing dependency, it tries to load all the other subsystems
before trying one more time to load the failing library.
Unfortunately, Android linker does not allow several try when loading a
library.
In consequence, this patch implements a new mechanism to load its subsystem
libraries.
For this new mechanism, the PFW will load the subsystem libraries in the order
they are disposed in the file ParameterFrameworkConfiguration.xml
Change-Id: I39b97e33c77a6b4392c3813cd3d780e10e3b60f8
Signed-off-by: Guillaume Denneulin <guillaumex.denneulin@intel.com>
Reviewed-on: http://android.intel.com:8080/35903
Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/SystemClass.cpp')
-rw-r--r-- | parameter/SystemClass.cpp | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp index 6409c9b..d733dbd 100644 --- a/parameter/SystemClass.cpp +++ b/parameter/SystemClass.cpp @@ -38,6 +38,7 @@ #include "VirtualSubsystem.h" #include "NamedElementBuilderTemplate.h" #include <assert.h> +#include "PluginLocation.h" #define base CConfigurableElement @@ -76,22 +77,33 @@ string CSystemClass::getKind() const return "SystemClass"; } -bool CSystemClass::loadSubsystems(string& strError, const vector<string>& astrPluginFolderPaths) +bool CSystemClass::loadSubsystems(string& strError, const CSubsystemPlugins* pSubsystemPlugins) { CAutoLog autoLlog(this, "Loading subsystem plugins"); // Plugin list list<string> lstrPluginFiles; - uint32_t uiFolderLocation; + uint32_t uiPluginLocation; - for (uiFolderLocation = 0; uiFolderLocation < astrPluginFolderPaths.size(); uiFolderLocation++) { + for (uiPluginLocation = 0; uiPluginLocation < pSubsystemPlugins->getNbChildren(); uiPluginLocation++) { - // Folder for current SystemClass - string strPluginPath = astrPluginFolderPaths[uiFolderLocation] + "/"; + // Get Folder for current Plugin Location + const CPluginLocation* pPluginLocation = static_cast<const CPluginLocation*>(pSubsystemPlugins->getChild(uiPluginLocation)); + + const string& strFolder = pPluginLocation->getFolder(); + + // Iterator on Plugin List: + list<string>::const_iterator it; + + const list<string>& pluginList = pPluginLocation->getPluginList(); + + for (it = pluginList.begin(); it != pluginList.end(); ++it) { + + // Fill Plugin files list + lstrPluginFiles.push_back(strFolder + "/" + *it); + } - // Get plugin list - getPluginFiles(strPluginPath, lstrPluginFiles); } // Check at least one subsystem plugin available if (!lstrPluginFiles.size()) { @@ -132,41 +144,6 @@ bool CSystemClass::loadSubsystems(string& strError, const vector<string>& astrPl return true; } -// Subsystem plugins -bool CSystemClass::getPluginFiles(const string& strPluginPath, list<string>& lstrPluginFiles) const -{ - log("Seeking subsystem plugins from folder \"%s\"", strPluginPath.c_str()); - - DIR *dirp; - struct dirent *dp; - - if ((dirp = opendir(strPluginPath.c_str())) == NULL) { - - return false; - } - - const string strPluginPattern(gpcPluginPattern); - - // Parse it and load plugins - while ((dp = readdir(dirp)) != NULL) { - - string strFileName(dp->d_name); - - // Check file name ends with pattern - size_t uiPatternPos = strFileName.rfind(strPluginPattern, -1); - - if (uiPatternPos != (size_t)-1 && uiPatternPos == strFileName.size() - strPluginPattern.size()) { - // Found plugin - lstrPluginFiles.push_back(strPluginPath + strFileName); - } - } - - // Close plugin folder - closedir(dirp); - - return true; -} - // Plugin symbol computation string CSystemClass::getPluginSymbol(const string& strPluginPath) { |