From d791576c3f9913be338da9fb2a66f7ee20a49cdf Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 5 Jun 2025 15:46:49 -0500 Subject: [PATCH] rdonly: Added missing isrdonly flag overrides when LFS3_RDONLY I did override lfs3_o_isrdonly, but missed lfs3_m_isrdonly and lfs3_t_isrdonly. These aren't strictly necessary (asserts force rdonly flags to be set correctly), but can save code by trimming unreachable code paths. That being said, currently no observable code savings: code stack ctx rdonly before: 10664 840 524 rdonly after: 10664 (+0.0%) 840 (+0.0%) 524 (+0.0%) But I noticed while toying around with a different way of pruning LFS3_TSTATE_OMDIRS/OBTREE and wanted to make sure other code savings weren't dragged in. --- lfs3.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lfs3.c b/lfs3.c index 0d68ab78..53adcad1 100644 --- a/lfs3.c +++ b/lfs3.c @@ -6926,7 +6926,12 @@ static inline bool lfs3_a_islazy(uint32_t flags) { // traversal flags static inline bool lfs3_t_isrdonly(uint32_t flags) { + (void)flags; + #ifndef LFS3_RDONLY return flags & LFS3_T_RDONLY; + #else + return true; + #endif } static inline bool lfs3_t_ismtreeonly(uint32_t flags) { @@ -7018,7 +7023,12 @@ static inline uint32_t lfs3_t_swapdirty(uint32_t flags) { // mount flags static inline bool lfs3_m_isrdonly(uint32_t flags) { + (void)flags; + #ifndef LFS3_RDONLY return flags & LFS3_M_RDONLY; + #else + return true; + #endif } #ifdef LFS3_REVDBG