From dde0872b633beeed0d5c55c1af709ea0b737d5ee Mon Sep 17 00:00:00 2001 From: Takumi Ando Date: Tue, 26 Dec 2023 13:55:09 +0900 Subject: [PATCH] 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 --- 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 */