Enhance traces for File Size Exceeds Offset
This commit adds changes to enhance or give context
to the generic error traces related to errors for
file size exceeding file offset provided by remote
terminus.
Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
Change-Id: Ic088a54190c2f990d07609a35c9b45bab637a15b
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index c57c387..b01ef19 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -303,8 +303,9 @@
auto fileSize = fs::file_size(value.fsPath);
if (offset >= fileSize)
{
- error("Offset exceeds file size, OFFSET={OFFSTE} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ error(
+ "Offset exceeds file size, OFFSET={OFFSTE} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
+ "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE", fileHandle);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_READ_FILE_INTO_MEMORY,
PLDM_DATA_OUT_OF_RANGE, 0, responsePtr);
@@ -397,8 +398,9 @@
auto fileSize = fs::file_size(value.fsPath);
if (offset >= fileSize)
{
- error("Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ error(
+ "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
+ "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE", fileHandle);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_WRITE_FILE_FROM_MEMORY,
PLDM_DATA_OUT_OF_RANGE, 0, responsePtr);
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.cpp b/oem/ibm/libpldmresponder/file_io_by_type.cpp
index 7a4429c..e7cb489 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.cpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.cpp
@@ -90,8 +90,9 @@
if (offset >= fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}, FILE_HANDLE={FILE_HANDLE}",
+ "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE",
+ fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
if (offset + length > fileSize)
@@ -194,8 +195,9 @@
size_t fileSize = fs::file_size(filePath);
if (offset >= fileSize)
{
- error("Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ error(
+ "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE={FILE_HANDLE}",
+ "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE", fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
diff --git a/oem/ibm/libpldmresponder/file_io_type_lid.hpp b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
index a4bbb4e..8affa8a 100644
--- a/oem/ibm/libpldmresponder/file_io_type_lid.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
@@ -207,8 +207,9 @@
if (offset > fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
+ "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE",
+ fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
}
diff --git a/oem/ibm/libpldmresponder/file_io_type_pel.cpp b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
index 1783c77..6ad5ee2 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
@@ -154,8 +154,9 @@
if (offset >= fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
+ "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE",
+ fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
if (offset + length > fileSize)