summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-09-11 12:52:56 +0530
committerTom Joseph <tomjoseph@in.ibm.com>2017-09-11 12:52:56 +0530
commit7c78adf6bef735e0cf98744b3e470020456f18c1 (patch)
tree5b1455287b1536df868da7065b007657f65bbdc1
parent694fc0cf579eac378df87400a7ba90d6f416de97 (diff)
downloadphosphor-net-ipmid-7c78adf6bef735e0cf98744b3e470020456f18c1.tar.gz
phosphor-net-ipmid-7c78adf6bef735e0cf98744b3e470020456f18c1.zip
settings: handle multiple objects/interfaces
Handle the fact that a settings object can now implement multiple interfaces, and also the fact that multiple settings objects can implement the same interface. Change-Id: If8a3e20fb2e1d53515d96ceabce6326d91e8eb3e Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
-rw-r--r--settings.cpp15
-rw-r--r--settings.hpp6
2 files changed, 14 insertions, 7 deletions
diff --git a/settings.cpp b/settings.cpp
index cb86d99..59f9f33 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -46,8 +46,19 @@ Objects::Objects(sdbusplus::bus::bus& bus,
for (auto& iter : result)
{
const auto& path = iter.first;
- auto& interface = iter.second.begin()->second[0];
- map.emplace(std::move(interface), path);
+ for (auto& interface : iter.second.begin()->second)
+ {
+ auto found = map.find(interface);
+ if (map.end() != found)
+ {
+ auto& paths = found->second;
+ paths.push_back(path);
+ }
+ else
+ {
+ map.emplace(std::move(interface), std::vector<Path>({path}));
+ }
+ }
}
}
diff --git a/settings.hpp b/settings.hpp
index 60ee4d4..ec1d913 100644
--- a/settings.hpp
+++ b/settings.hpp
@@ -42,12 +42,8 @@ struct Objects
*/
Service service(const Path& path, const Interface& interface) const;
- // TODO openbmc/openbmc#2058 - This will break when multiple settings,
- // or in general multiple objects implement a single setting interface.
- // For instance this will break for a 2-blade server, because we'd have
- // 2 sets of settings objects. Need to revisit and fix this.
/** @brief map of settings objects */
- std::map<Interface, Path> map;
+ std::map<Interface, std::vector<Path>> map;
/** @brief The Dbus bus object */
sdbusplus::bus::bus& bus;
OpenPOWER on IntegriCloud