Return recordID for IpmiSelAdd method
The IPMI spec section 31.6 states that recordID field is passed in
Add SEL Entry request and its value will be overwritten with a
Record ID value that the SEL Device generates.
Return recordID for IpmiSelAdd method to follow IPMI standard.
Change-Id: Ib3fd381368bd9af7aa942e7dd51b0886f956504f
Signed-off-by: Vincent Chou <vincent.chou@fii-na.com>
diff --git a/include/sel_logger.hpp b/include/sel_logger.hpp
index 1c9bc47..15d53fc 100644
--- a/include/sel_logger.hpp
+++ b/include/sel_logger.hpp
@@ -38,7 +38,7 @@
static const std::string selLogFilename = "ipmi_sel";
template <typename... T>
-static void
+static uint16_t
selAddSystemRecord(std::shared_ptr<sdbusplus::asio::connection> conn,
const std::string& message, const std::string& path,
const std::vector<uint8_t>& selData, const bool& assert,
diff --git a/src/sel_logger.cpp b/src/sel_logger.cpp
index 6377dd1..d04e841 100644
--- a/src/sel_logger.cpp
+++ b/src/sel_logger.cpp
@@ -187,7 +187,7 @@
}
template <typename... T>
-static void selAddSystemRecord(
+static uint16_t selAddSystemRecord(
[[maybe_unused]] std::shared_ptr<sdbusplus::asio::connection> conn,
[[maybe_unused]] const std::string& message, const std::string& path,
const std::vector<uint8_t>& selData, const bool& assert,
@@ -221,6 +221,7 @@
{"EVENT_DIR", std::to_string(assert)},
{"SENSOR_DATA", selDataStr}}));
conn->call(AddToLog);
+ return 0;
#else
unsigned int recordId = getNewRecordId();
sd_journal_send("MESSAGE=%s", message.c_str(), "PRIORITY=%i", selPriority,
@@ -230,10 +231,11 @@
"IPMI_SEL_SENSOR_PATH=%s", path.c_str(),
"IPMI_SEL_EVENT_DIR=%x", assert, "IPMI_SEL_DATA=%s",
selDataStr.c_str(), std::forward<T>(metadata)..., NULL);
+ return recordId;
#endif
}
-static void selAddOemRecord(
+static uint16_t selAddOemRecord(
[[maybe_unused]] std::shared_ptr<sdbusplus::asio::connection> conn,
[[maybe_unused]] const std::string& message,
const std::vector<uint8_t>& selData, const uint8_t& recordType)
@@ -265,12 +267,14 @@
{"EVENT_DIR", std::to_string(0)},
{"SENSOR_DATA", selDataStr}}));
conn->call(AddToLog);
+ return 0;
#else
unsigned int recordId = getNewRecordId();
sd_journal_send("MESSAGE=%s", message.c_str(), "PRIORITY=%i", selPriority,
"MESSAGE_ID=%s", selMessageId, "IPMI_SEL_RECORD_ID=%d",
recordId, "IPMI_SEL_RECORD_TYPE=%x", recordType,
"IPMI_SEL_DATA=%s", selDataStr.c_str(), NULL);
+ return recordId;
#endif
}