diff options
author | Patrick Venture <venture@google.com> | 2018-10-20 09:48:08 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-10-20 09:48:08 -0700 |
commit | 17baa2715d688e5ad8065b9e38170078e762fa0a (patch) | |
tree | cebe174557904aa9624628220f04209ed60e236d | |
parent | de8ea5689932dfa266c3ac47dde35c4bdd450eaf (diff) | |
download | ipmi-fru-parser-17baa2715d688e5ad8065b9e38170078e762fa0a.tar.gz ipmi-fru-parser-17baa2715d688e5ad8065b9e38170078e762fa0a.zip |
style: move getService into anonymous namespace
Move getService into an anonymous namespace.
Change-Id: I75df449858bdc8347fafe3c0ab839ff18b5a2496
Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r-- | writefrudata.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/writefrudata.cpp b/writefrudata.cpp index 42ebd67..130f30f 100644 --- a/writefrudata.cpp +++ b/writefrudata.cpp @@ -105,6 +105,39 @@ std::string getFRUValue(const std::string& section, const std::string& key, return fruValue; } +// Get the inventory service from the mapper. +auto getService(sdbusplus::bus::bus& bus, const std::string& intf, + const std::string& path) +{ + auto mapperCall = + bus.new_method_call("xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetObject"); + + mapperCall.append(path); + mapperCall.append(std::vector<std::string>({intf})); + std::map<std::string, std::vector<std::string>> mapperResponse; + + try + { + auto mapperResponseMsg = bus.call(mapperCall); + mapperResponseMsg.read(mapperResponse); + } + catch (const sdbusplus::exception::SdBusError& ex) + { + log<level::ERR>("Exception from sdbus call", + entry("WHAT=%s", ex.what())); + throw; + } + + if (mapperResponse.begin() == mapperResponse.end()) + { + throw std::runtime_error("ERROR in reading the mapper response"); + } + + return mapperResponse.begin()->first; +} + } // namespace //---------------------------------------------------------------- @@ -282,39 +315,6 @@ int verify_fru_data(const uint8_t* data, const size_t len) return EXIT_SUCCESS; } -// Get the inventory service from the mapper. -auto getService(sdbusplus::bus::bus& bus, const std::string& intf, - const std::string& path) -{ - auto mapperCall = - bus.new_method_call("xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", "GetObject"); - - mapperCall.append(path); - mapperCall.append(std::vector<std::string>({intf})); - std::map<std::string, std::vector<std::string>> mapperResponse; - - try - { - auto mapperResponseMsg = bus.call(mapperCall); - mapperResponseMsg.read(mapperResponse); - } - catch (const sdbusplus::exception::SdBusError& ex) - { - log<level::ERR>("Exception from sdbus call", - entry("WHAT=%s", ex.what())); - throw; - } - - if (mapperResponse.begin() == mapperResponse.end()) - { - throw std::runtime_error("ERROR in reading the mapper response"); - } - - return mapperResponse.begin()->first; -} - //------------------------------------------------------------------------ // Takes FRU data, invokes Parser for each fru record area and updates // Inventory |