fru-device: add offset variant of FRUReader abstraction
The caching FRUReader class is now joined by OffsetFRUReader, both of
which now derive from a common BaseFRUReader class. OffsetFRUReader is
constructed in terms of an existing BaseFRUReader (probably a FRUReader)
and simply applies a fixed offset to all reads performed on it.
Tested: on an ASRock Rack romed8hm3, fru-device successfully recognizes
and parses the baseboard FRU EEPROM as it did prior to this patch.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I13f3bc48110b8ffdf1d3f135c57ae9f0736a8e53
diff --git a/src/fru_utils.cpp b/src/fru_utils.cpp
index e030ac8..5e8e695 100644
--- a/src/fru_utils.cpp
+++ b/src/fru_utils.cpp
@@ -590,7 +590,7 @@
return true;
}
-bool findFRUHeader(FRUReader& reader, const std::string& errorHelp,
+bool findFRUHeader(BaseFRUReader& reader, const std::string& errorHelp,
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX>& blockData,
off_t& baseOffset)
{
@@ -634,7 +634,7 @@
return false;
}
-std::vector<uint8_t> readFRUContents(FRUReader& reader,
+std::vector<uint8_t> readFRUContents(BaseFRUReader& reader,
const std::string& errorHelp)
{
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};