platform: Remove `_data` suffix from `cper_event` decode API
Rename `decode_pldm_platform_cper_event_data` to
`decode_pldm_platform_cper_event` as the API does not decode the CPER
data, it decodes the event message.
Change-Id: I0937f043e4d3836f20733f78ea3f5970da6585d5
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9665996..1a6225b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,7 +26,7 @@
5. pdr: Add pldm_pdr_get_terminus_handle() API
6. pdr: Add related decode_entity_auxiliary_names_pdr() APIs
7. fw_update: Add encode req & decode resp for get_downstream_fw_params
-8. platform: Add decode_pldm_platform_cper_event_data() API
+8. platform: Add decode_pldm_platform_cper_event() API
### Changed
diff --git a/include/libpldm/platform.h b/include/libpldm/platform.h
index 589970f..95c90eb 100644
--- a/include/libpldm/platform.h
+++ b/include/libpldm/platform.h
@@ -2460,9 +2460,10 @@
* @param[in] cper_event_length - the length of cper event
* @return error code
*/
-int decode_pldm_platform_cper_event_data(
- const void *event_data, size_t event_data_length,
- struct pldm_platform_cper_event *cper_event, size_t cper_event_length);
+int decode_pldm_platform_cper_event(const void *event_data,
+ size_t event_data_length,
+ struct pldm_platform_cper_event *cper_event,
+ size_t cper_event_length);
/** @brief Helper function to response CPER event event data
*
diff --git a/src/dsp/platform.c b/src/dsp/platform.c
index 9439e12..6ef1061 100644
--- a/src/dsp/platform.c
+++ b/src/dsp/platform.c
@@ -2858,9 +2858,10 @@
}
LIBPLDM_ABI_TESTING
-int decode_pldm_platform_cper_event_data(
- const void *event_data, size_t event_data_length,
- struct pldm_platform_cper_event *cper_event, size_t cper_event_length)
+int decode_pldm_platform_cper_event(const void *event_data,
+ size_t event_data_length,
+ struct pldm_platform_cper_event *cper_event,
+ size_t cper_event_length)
{
struct pldm_msgbuf _buf;
struct pldm_msgbuf *buf = &_buf;
diff --git a/tests/dsp/platform.cpp b/tests/dsp/platform.cpp
index dfc5506..b121399 100644
--- a/tests/dsp/platform.cpp
+++ b/tests/dsp/platform.cpp
@@ -5214,7 +5214,7 @@
auto cper_event = reinterpret_cast<struct pldm_platform_cper_event*>(
malloc(cperEventSize));
- auto rc = decode_pldm_platform_cper_event_data(
+ auto rc = decode_pldm_platform_cper_event(
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cper_event, cperEventSize);
@@ -5254,40 +5254,40 @@
auto cperEvent = reinterpret_cast<struct pldm_platform_cper_event*>(
malloc(cperEventSize));
- auto rc = decode_pldm_platform_cper_event_data(NULL, eventData.size(),
- cperEvent, cperEventSize);
+ auto rc = decode_pldm_platform_cper_event(NULL, eventData.size(), cperEvent,
+ cperEventSize);
EXPECT_EQ(rc, -EINVAL);
- rc = decode_pldm_platform_cper_event_data(
+ rc = decode_pldm_platform_cper_event(
reinterpret_cast<const void*>(eventData.data()), eventData.size(), NULL,
cperEventSize);
EXPECT_EQ(rc, -EINVAL);
#ifdef NDEBUG
- rc = decode_pldm_platform_cper_event_data(
+ rc = decode_pldm_platform_cper_event(
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size() - 1,
cperEvent, cperEventSize);
EXPECT_EQ(rc, -EBADMSG);
#else
- EXPECT_DEATH(decode_pldm_platform_cper_event_data(
+ EXPECT_DEATH(decode_pldm_platform_cper_event(
reinterpret_cast<uint8_t*>(eventData.data()),
eventData.size() - 1, cperEvent, cperEventSize),
"ctx->remaining >= 0");
#endif
- rc = decode_pldm_platform_cper_event_data(
+ rc = decode_pldm_platform_cper_event(
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize - 1);
EXPECT_EQ(rc, -EOVERFLOW);
- rc = decode_pldm_platform_cper_event_data(
+ rc = decode_pldm_platform_cper_event(
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize + 1);
EXPECT_EQ(rc, 0);
// Invalid CPER Event Format Type
eventData[1] = 0x2;
- rc = decode_pldm_platform_cper_event_data(
+ rc = decode_pldm_platform_cper_event(
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize);
@@ -5296,14 +5296,14 @@
// Invalid cper event data size
eventData[1] = 0x1;
eventData[2] = 3;
- rc = decode_pldm_platform_cper_event_data(
+ rc = decode_pldm_platform_cper_event(
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize);
EXPECT_EQ(rc, -EBADMSG);
eventData[2] = 5;
- rc = decode_pldm_platform_cper_event_data(
+ rc = decode_pldm_platform_cper_event(
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize);