PEL: Make FRUIdentity::flattenedSize() calc size
This function was just returning the _size property, but in the future
_size will instead be set to what this function returns.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I5e5c2cefb595aa07c55c7d32de66372037f79c77
diff --git a/extensions/openpower-pels/fru_identity.cpp b/extensions/openpower-pels/fru_identity.cpp
index 8c81e88..73b4200 100644
--- a/extensions/openpower-pels/fru_identity.cpp
+++ b/extensions/openpower-pels/fru_identity.cpp
@@ -42,6 +42,28 @@
}
}
+size_t FRUIdentity::flattenedSize() const
+{
+ size_t size = sizeof(_type) + sizeof(_size) + sizeof(_flags);
+
+ if (hasPN() || hasMP())
+ {
+ size += _pnOrProcedureID.size();
+ }
+
+ if (hasCCIN())
+ {
+ size += _ccin.size();
+ }
+
+ if (hasSN())
+ {
+ size += _sn.size();
+ }
+
+ return size;
+}
+
std::optional<std::string> FRUIdentity::getPN() const
{
if (hasPN())