From 58ce0e4b20dd4d0868ac6587ab84938338c4523e Mon Sep 17 00:00:00 2001 From: mikee47 Date: Wed, 31 Aug 2022 11:20:28 +0100 Subject: [PATCH 1/5] Fix return value from Spiffs `fenumxattr()` Should return number of attributes read. --- Sming/Libraries/Spiffs/src/FileMeta.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sming/Libraries/Spiffs/src/FileMeta.cpp b/Sming/Libraries/Spiffs/src/FileMeta.cpp index e7ea32dbe7..f8af99324e 100644 --- a/Sming/Libraries/Spiffs/src/FileMeta.cpp +++ b/Sming/Libraries/Spiffs/src/FileMeta.cpp @@ -59,6 +59,7 @@ int SpiffsMetaBuffer::enumxattr(AttributeEnumCallback callback, void* buffer, si continue; } e.set(tag, value, getAttributeSize(tag)); + ++count; if(!callback(e)) { return count; } @@ -72,6 +73,7 @@ int SpiffsMetaBuffer::enumxattr(AttributeEnumCallback callback, void* buffer, si break; } e.set(AttributeTag(unsigned(AttributeTag::User) + tagIndex), &user[i], tagSize); + ++count; if(!callback(e)) { break; } From 4c4cdc92d153a5a67bd15c71b0294bfa6baa8229 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Fri, 30 Sep 2022 16:42:21 +0100 Subject: [PATCH 2/5] Fix LittleFS `FileSystem::format()` return value --- Sming/Libraries/LittleFS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sming/Libraries/LittleFS b/Sming/Libraries/LittleFS index 27be7f5b4b..1a30230481 160000 --- a/Sming/Libraries/LittleFS +++ b/Sming/Libraries/LittleFS @@ -1 +1 @@ -Subproject commit 27be7f5b4bd59cd4e44d8a1e05f8d9bed740feca +Subproject commit 1a3023048190fc133a9a49bfe208a209eb3f56cf From 8ca4df4ce45cf28da7ba69f110854f0bb8ddd2e5 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Thu, 29 Sep 2022 09:46:00 +0100 Subject: [PATCH 3/5] Remove (non-const) `Device::partitions()` method Partition table is always accessed read-only --- Sming/Components/Storage/src/include/Storage/Device.h | 5 ----- .../Components/Storage/src/include/Storage/PartitionTable.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Sming/Components/Storage/src/include/Storage/Device.h b/Sming/Components/Storage/src/include/Storage/Device.h index b8ce634555..0255eb43e8 100644 --- a/Sming/Components/Storage/src/include/Storage/Device.h +++ b/Sming/Components/Storage/src/include/Storage/Device.h @@ -56,11 +56,6 @@ class Device : public LinkedObjectTemplate return getName() == name; } - PartitionTable& partitions() - { - return mPartitions; - } - const PartitionTable& partitions() const { return mPartitions; diff --git a/Sming/Components/Storage/src/include/Storage/PartitionTable.h b/Sming/Components/Storage/src/include/Storage/PartitionTable.h index a243d803bb..1183f2e5e1 100644 --- a/Sming/Components/Storage/src/include/Storage/PartitionTable.h +++ b/Sming/Components/Storage/src/include/Storage/PartitionTable.h @@ -77,7 +77,7 @@ class PartitionTable /** * @brief Find the n'th OTA partition */ - Partition findOta(uint8_t index) + Partition findOta(uint8_t index) const { using App = Partition::SubType::App; auto subtype = App(uint8_t(App::ota0) + index); From c0604a6f924ab2e61c4dec9acac00af7bd5cc2fb Mon Sep 17 00:00:00 2001 From: mikee47 Date: Fri, 23 Sep 2022 12:09:52 +0100 Subject: [PATCH 4/5] Remove `Partition::getDevice()` method This could be used to bypass protections offered by partitioning API and allow code access to other areas of a device. --- Sming/Components/Storage/src/include/Storage/Partition.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Sming/Components/Storage/src/include/Storage/Partition.h b/Sming/Components/Storage/src/include/Storage/Partition.h index 18eb0930ac..72487fdb93 100644 --- a/Sming/Components/Storage/src/include/Storage/Partition.h +++ b/Sming/Components/Storage/src/include/Storage/Partition.h @@ -334,15 +334,6 @@ class Partition */ String getDeviceName() const; - /** - * @brief Get storage device containing this partition - * @retval Device* null if device isn't registered - */ - Device* getDevice() const - { - return mDevice; - } - /** * @brief Determine if given address contained within this partition */ From d9aeecf0c2fc3759d8dac4a6a46e7249e8851f41 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Thu, 29 Sep 2022 09:43:48 +0100 Subject: [PATCH 5/5] Fix `IFS::Stat::printTo()` timestamp printing Shows numeric (time_t) value instead of string --- Sming/Components/IFS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sming/Components/IFS b/Sming/Components/IFS index 1aaa86e1e1..2df44074ac 160000 --- a/Sming/Components/IFS +++ b/Sming/Components/IFS @@ -1 +1 @@ -Subproject commit 1aaa86e1e1ffba3c939c9f32caf91bae63325070 +Subproject commit 2df44074ac0e43b6e7930bb5c20eb39106898077