This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit d43ed35d64e1a8faf668b399ba5cfeb212e28e14
Author: Szymon Janc <[email protected]>
AuthorDate: Tue Oct 6 19:09:17 2026 +0200

    fs/fs: Fix registration of mcumgr fs_mgmt group
    
    Since file system entity rework (commit a2dbdfdba "fs: Introduce file
    system entity") fs_mgmt_register_group() is never called and FS_MGMT
    group was not available over SMP. Also build with FS_MGMT enabled was
    failing due to unused g_mgmt_initialized variable.
    
    This restores previous behavior and registers fs_mgmt group when first
    file system is successfully mounted.
    
    Assisted-by: Claude:claude-opus-5-5
---
 fs/fs/src/fs_mount.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/fs/src/fs_mount.c b/fs/fs/src/fs_mount.c
index 567c1f469..ec5a9d5eb 100644
--- a/fs/fs/src/fs_mount.c
+++ b/fs/fs/src/fs_mount.c
@@ -30,6 +30,10 @@
 
 struct mount_point mount_points[MAX_MOUNT_POINTS];
 
+#if MYNEWT_VAL(FS_MGMT)
+static uint8_t g_mgmt_initialized;
+#endif
+
 int
 fs_mount(const file_system_t *fs, const char *mount_point)
 {
@@ -54,6 +58,12 @@ fs_mount(const file_system_t *fs, const char *mount_point)
             mount_points[free_slot].mount_point = NULL;
             mount_points[free_slot].fs = NULL;
         }
+#if MYNEWT_VAL(FS_MGMT)
+        else if (!g_mgmt_initialized) {
+            fs_mgmt_register_group();
+            g_mgmt_initialized = 1;
+        }
+#endif
     } else {
         rc = FS_ENOMEM;
     }
@@ -95,10 +105,6 @@ fs_unmount_file_system(const file_system_t *fs)
     return rc;
 }
 
-#if MYNEWT_VAL(FS_MGMT)
-static uint8_t g_mgmt_initialized;
-#endif
-
 int
 fs_register(struct fs_ops *fops)
 {

Reply via email to