Max post code file size per cycle setting
Let user could set POST code file size per cycle
The default size is 512 counts
Reason:
BMC may crash caused by nonstop saving POST code when BIOS has
some unusual behavior like PXE loop
Thus, BMC should set a limit size to prevent this risk
Test Case:
Manually send POST code to check the POST code file rotation
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
Change-Id: Ic7fbafe532a79123e6ae880a8a3506f9c397d933
diff --git a/src/post_code.cpp b/src/post_code.cpp
index b1ffab8..82dba46 100644
--- a/src/post_code.cpp
+++ b/src/post_code.cpp
@@ -93,6 +93,10 @@
}
postCodes.insert(std::make_pair(tsUS, code));
+ if (postCodes.size() > MAX_POST_CODE_SIZE_PER_CYCLE)
+ {
+ postCodes.erase(postCodes.begin());
+ }
serialize(fs::path(strPostCodeListPath));
#ifdef ENABLE_BIOS_POST_CODE_LOG