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

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new dde0872b63 fs: smartfs: Add necessary aligned access in 
smartfs_rename()
dde0872b63 is described below

commit dde0872b633beeed0d5c55c1af709ea0b737d5ee
Author: Takumi Ando <[email protected]>
AuthorDate: Tue Dec 26 13:55:09 2023 +0900

    fs: smartfs: Add necessary aligned access in smartfs_rename()
    
    smartfs_rename() was stuck on the boards they need
    CONFIG_SMARTFS_ALIGNED_ACCESS.
    
    Signed-off-by: Takumi Ando <[email protected]>
---
 fs/smartfs/smartfs_smart.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c
index b0ec7ac2a1..c55b6a7a89 100644
--- a/fs/smartfs/smartfs_smart.c
+++ b/fs/smartfs/smartfs_smart.c
@@ -1983,10 +1983,22 @@ int smartfs_rename(FAR struct inode *mountpt, FAR const 
char *oldrelpath,
       direntry = (FAR struct smartfs_entry_header_s *)
         &fs->fs_rwbuffer[oldentry.doffset];
 #if CONFIG_SMARTFS_ERASEDSTATE == 0xff
+#ifdef CONFIG_SMARTFS_ALIGNED_ACCESS
+      smartfs_wrle16(&direntry->flags,
+                     smartfs_rdle16(&direntry->flags)
+                     & ~SMARTFS_DIRENT_ACTIVE);
+#else
       direntry->flags &= ~SMARTFS_DIRENT_ACTIVE;
+#endif
+#else /* CONFIG_SMARTFS_ERASEDSTATE == 0xff */
+#ifdef CONFIG_SMARTFS_ALIGNED_ACCESS
+      smartfs_wrle16(&direntry->flags,
+                     smartfs_rdle16(&direntry->flags)
+                     | SMARTFS_DIRENT_ACTIVE);
 #else
       direntry->flags |= SMARTFS_DIRENT_ACTIVE;
 #endif
+#endif /* CONFIG_SMARTFS_ERASEDSTATE == 0xff */
 
       /* Now write the updated flags back to the device */
 

Reply via email to