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/include/fru_utils.hpp b/include/fru_utils.hpp
index f1d8e94..ed019ad 100644
--- a/include/fru_utils.hpp
+++ b/include/fru_utils.hpp
@@ -138,22 +138,22 @@
ssize_t getFieldLength(uint8_t fruFieldTypeLenValue);
/// \brief Find a FRU header.
-/// \param reader the FRUReader to read via
+/// \param reader the BaseFRUReader to read via
/// \param errorHelp and a helper string for failures
/// \param blockData buffer to return the last read block
/// \param baseOffset the offset to start the search at;
/// set to 0 to perform search;
/// returns the offset at which a header was found
/// \return whether a header was found
-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);
/// \brief Read and validate FRU contents.
-/// \param reader the FRUReader to read via
+/// \param reader the BaseFRUReader to read via
/// \param errorHelp and a helper string for failures
/// \return the FRU contents from the file
-std::vector<uint8_t> readFRUContents(FRUReader& reader,
+std::vector<uint8_t> readFRUContents(BaseFRUReader& reader,
const std::string& errorHelp);
/// \brief Validate an IPMI FRU common header