Move getFRUInfo function to FruUtils.cpp file.
Moved the common function getFRUInfo from FruDevice.cpp to FruUtils.cpp
for handling fru deamon and ipmb-fru deamon to avoid code duplication
in entity-manager.
TESTED : Built Facebook YosemiteV2 images and loaded
on the target hardware. Verified all the fru's read and write.
Note : This patch is added as Dependent and follow up patch
for the below patch.
https://gerrit.openbmc-project.xyz/c/openbmc/entity-manager/+/50894
It should merge after the parent patch.
Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Change-Id: I186d750e397730c184fc3b59d1c6815408c7642f
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index 8d825a9..62d23c5 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -622,23 +622,6 @@
std::function<void(void)> _callback;
};
-std::vector<uint8_t>& getFRUInfo(const uint8_t& bus, const uint8_t& address)
-{
- auto deviceMap = busMap.find(bus);
- if (deviceMap == busMap.end())
- {
- throw std::invalid_argument("Invalid Bus.");
- }
- auto device = deviceMap->second->find(address);
- if (device == deviceMap->second->end())
- {
- throw std::invalid_argument("Invalid Address.");
- }
- std::vector<uint8_t>& ret = device->second;
-
- return ret;
-}
-
void addFruObjectToDbus(
std::vector<uint8_t>& device,
boost::container::flat_map<
diff --git a/src/FruUtils.cpp b/src/FruUtils.cpp
index 1152f87..7296aa8 100644
--- a/src/FruUtils.cpp
+++ b/src/FruUtils.cpp
@@ -773,3 +773,20 @@
{
return static_cast<unsigned int>(area) + 1;
}
+
+std::vector<uint8_t>& getFRUInfo(const uint8_t& bus, const uint8_t& address)
+{
+ auto deviceMap = busMap.find(bus);
+ if (deviceMap == busMap.end())
+ {
+ throw std::invalid_argument("Invalid Bus.");
+ }
+ auto device = deviceMap->second->find(address);
+ if (device == deviceMap->second->end())
+ {
+ throw std::invalid_argument("Invalid Address.");
+ }
+ std::vector<uint8_t>& ret = device->second;
+
+ return ret;
+}