Move global variable busMap to FruUtil.hpp
Moved the static global variable busMap from FruDevice.cpp to
FruUtil.hpp to make it accessible for fru and ipmb-fru daemons.
Seperating patches into small patches to achieve moving common
functions/Variables from FruDevice.cpp to FruUtils.cpp.
https://gerrit.openbmc-project.xyz/c/openbmc/entity-manager/+/47246
Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Change-Id: Ie424944edeb44c98a8996d0a8c898dd6140b53ee
diff --git a/include/FruUtils.hpp b/include/FruUtils.hpp
index 05a8bee..ea1233b 100644
--- a/include/FruUtils.hpp
+++ b/include/FruUtils.hpp
@@ -32,6 +32,11 @@
constexpr size_t fruBlockSize = 8;
+using DeviceMap = boost::container::flat_map<int, std::vector<uint8_t>>;
+using BusMap = boost::container::flat_map<int, std::shared_ptr<DeviceMap>>;
+
+inline BusMap busMap;
+
enum class DecodeState
{
ok,
@@ -138,8 +143,7 @@
/// returns the offset at which a header was found
/// \return whether a header was found
bool findFRUHeader(int flag, int file, uint16_t address,
- const ReadBlockFunc& readBlock,
- const std::string& errorHelp,
+ const ReadBlockFunc& readBlock, const std::string& errorHelp,
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX>& blockData,
uint16_t& baseOffset);