oem-ibm: Builds filetable lazily
Adds support for lid files from file table to be patched when host is
off. FileTable is rebuilt when a getFileTable request is received.
Change-Id: Ief3afb698ba4fe8b871e85c9b7c9eff1e4699daa
Signed-off-by: Rahul D S <rahulds.rahul@gmail.com>
diff --git a/oem/ibm/libpldmresponder/file_table.cpp b/oem/ibm/libpldmresponder/file_table.cpp
index 402934b..9ea1286 100644
--- a/oem/ibm/libpldmresponder/file_table.cpp
+++ b/oem/ibm/libpldmresponder/file_table.cpp
@@ -129,14 +129,21 @@
return table;
}
+/** Single instance of filetable*/
+static FileTable fileTable;
+
FileTable& buildFileTable(const std::string& fileTablePath)
{
- static FileTable table;
- if (table.isEmpty())
+ if (fileTable.isEmpty())
{
- table = FileTable(fileTablePath);
+ fileTable = FileTable(fileTablePath);
}
- return table;
+ return fileTable;
+}
+
+void clearFileTable()
+{
+ fileTable.clear();
}
} // namespace filetable