From eb05d88e81fd317f6bcdf0492f2b5b75ceb5fd70 Mon Sep 17 00:00:00 2001 From: David Rogers Date: Tue, 12 Oct 2021 15:24:48 -0700 Subject: [PATCH] pw_kvs::flash: Update logs for flash operations Update flash-related log messages to use the PW_LOG_MODULE_NAME of "PW_FLASH" instead of "KVS". Update the error log in FlashPartition::CheckBounds() to be more clear what the error is. Change-Id: If35a914162a45aaec1fd029dc4ec09bc05c5ea37 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/65340 Reviewed-by: Ewout van Bekkum Commit-Queue: David Rogers --- pw_kvs/fake_flash_memory.cc | 2 +- pw_kvs/flash_memory.cc | 8 +++++--- pw_kvs/flash_partition_with_stats.cc | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pw_kvs/fake_flash_memory.cc b/pw_kvs/fake_flash_memory.cc index 4c309133e..ba3decca5 100644 --- a/pw_kvs/fake_flash_memory.cc +++ b/pw_kvs/fake_flash_memory.cc @@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations under // the License. -#define PW_LOG_MODULE_NAME "KVS" +#define PW_LOG_MODULE_NAME "PW_FLASH" #define PW_LOG_LEVEL PW_KVS_LOG_LEVEL #include "pw_kvs/fake_flash_memory.h" diff --git a/pw_kvs/flash_memory.cc b/pw_kvs/flash_memory.cc index 142e7ebae..4f28e07e8 100644 --- a/pw_kvs/flash_memory.cc +++ b/pw_kvs/flash_memory.cc @@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations under // the License. -#define PW_LOG_MODULE_NAME "KVS" +#define PW_LOG_MODULE_NAME "PW_FLASH" #define PW_LOG_LEVEL PW_KVS_LOG_LEVEL #include "pw_kvs/flash_memory.h" @@ -150,9 +150,11 @@ bool FlashPartition::AppearsErased(std::span data) const { Status FlashPartition::CheckBounds(Address address, size_t length) const { if (address + length > size_bytes()) { PW_LOG_ERROR( - "Attempted out-of-bound flash memory access (address: %u length: %u)", + "FlashPartition - Attempted access (address: %u length: %u), exceeds " + "partition size %u bytes", unsigned(address), - unsigned(length)); + unsigned(length), + unsigned(size_bytes())); return Status::OutOfRange(); } return OkStatus(); diff --git a/pw_kvs/flash_partition_with_stats.cc b/pw_kvs/flash_partition_with_stats.cc index 26b0eeef9..48560fdea 100644 --- a/pw_kvs/flash_partition_with_stats.cc +++ b/pw_kvs/flash_partition_with_stats.cc @@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations under // the License. -#define PW_LOG_MODULE_NAME "KVS" +#define PW_LOG_MODULE_NAME "PW_FLASH" #define PW_LOG_LEVEL PW_KVS_LOG_LEVEL #include "pw_kvs/flash_partition_with_stats.h"