This is an automated email from the ASF dual-hosted git repository. ligd pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit a05f9aaa852ba5ab05f851c7aedcd29a63695741 Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Fri Feb 10 14:54:23 2023 +0800 fs: Don't guard fsync with CONFIG_DISABLE_MOUNTPOINT since the driver can also support fsync by implementing BIOC_FLUSH Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> --- fs/inode/fs_files.c | 8 -------- fs/vfs/Make.defs | 4 ++-- fs/vfs/fs_fsync.c | 9 ++++----- include/nuttx/fs/fs.h | 2 -- include/sys/syscall_lookup.h | 4 ++-- syscall/syscall.csv | 4 ++-- 6 files changed, 10 insertions(+), 21 deletions(-) diff --git a/fs/inode/fs_files.c b/fs/inode/fs_files.c index ad6e2e893b..e38662b777 100644 --- a/fs/inode/fs_files.c +++ b/fs/inode/fs_files.c @@ -98,8 +98,6 @@ static int files_extend(FAR struct filelist *list, size_t row) return 0; } -#ifndef CONFIG_DISABLE_MOUNTPOINT - static void task_fssync(FAR struct tcb_s *tcb, FAR void *arg) { FAR struct filelist *list; @@ -129,8 +127,6 @@ static void task_fssync(FAR struct tcb_s *tcb, FAR void *arg) nxmutex_unlock(&list->fl_lock); } -#endif /* !CONFIG_DISABLE_MOUNTPOINT */ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -638,8 +634,6 @@ int close(int fd) return ret; } -#ifndef CONFIG_DISABLE_MOUNTPOINT - /**************************************************************************** * Name: sync * @@ -653,5 +647,3 @@ void sync(void) { nxsched_foreach(task_fssync, NULL); } - -#endif /* !CONFIG_DISABLE_MOUNTPOINT */ diff --git a/fs/vfs/Make.defs b/fs/vfs/Make.defs index 5727636820..6a9ed945ad 100644 --- a/fs/vfs/Make.defs +++ b/fs/vfs/Make.defs @@ -24,12 +24,12 @@ CSRCS += fs_chstat.c fs_close.c fs_dup.c fs_dup2.c fs_fcntl.c fs_epoll.c CSRCS += fs_fchstat.c fs_fstat.c fs_fstatfs.c fs_ioctl.c fs_lseek.c CSRCS += fs_mkdir.c fs_open.c fs_poll.c fs_pread.c fs_pwrite.c fs_read.c CSRCS += fs_rename.c fs_rmdir.c fs_select.c fs_sendfile.c fs_stat.c -CSRCS += fs_statfs.c fs_unlink.c fs_write.c fs_dir.c +CSRCS += fs_statfs.c fs_unlink.c fs_write.c fs_dir.c fs_fsync.c # Certain interfaces are not available if there is no mountpoint support ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) -CSRCS += fs_fsync.c fs_truncate.c +CSRCS += fs_truncate.c endif ifneq ($(CONFIG_PSEUDOFS_SOFTLINKS),0) diff --git a/fs/vfs/fs_fsync.c b/fs/vfs/fs_fsync.c index c36667a808..21c361851d 100644 --- a/fs/vfs/fs_fsync.c +++ b/fs/vfs/fs_fsync.c @@ -36,8 +36,6 @@ #include "inode/inode.h" -#ifndef CONFIG_DISABLE_MOUNTPOINT - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -65,6 +63,7 @@ int file_fsync(FAR struct file *filep) inode = filep->f_inode; if (inode != NULL) { +#ifndef CONFIG_DISABLE_MOUNTPOINT if (INODE_IS_MOUNTPT(inode) && inode->u.i_mops && inode->u.i_mops->sync) { @@ -72,7 +71,9 @@ int file_fsync(FAR struct file *filep) return inode->u.i_mops->sync(filep); } - else if (inode->u.i_ops && inode->u.i_ops->ioctl) + else +#endif + if (inode->u.i_ops && inode->u.i_ops->ioctl) { ret = inode->u.i_ops->ioctl(filep, BIOC_FLUSH, 0); return ret >= 0 ? 0 : ret; @@ -125,5 +126,3 @@ errout: set_errno(-ret); return ERROR; } - -#endif /* !CONFIG_DISABLE_MOUNTPOINT */ diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 4bd0357e67..69a296800b 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -1241,9 +1241,7 @@ off_t nx_seek(int fd, off_t offset, int whence); * ****************************************************************************/ -#ifndef CONFIG_DISABLE_MOUNTPOINT int file_fsync(FAR struct file *filep); -#endif /**************************************************************************** * Name: file_truncate diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index a159cad3ff..506d15eafd 100644 --- a/include/sys/syscall_lookup.h +++ b/include/sys/syscall_lookup.h @@ -240,6 +240,8 @@ SYSCALL_LOOKUP(fstat, 2) SYSCALL_LOOKUP(statfs, 2) SYSCALL_LOOKUP(fstatfs, 2) SYSCALL_LOOKUP(sendfile, 4) +SYSCALL_LOOKUP(sync, 0) +SYSCALL_LOOKUP(fsync, 1) SYSCALL_LOOKUP(chmod, 2) SYSCALL_LOOKUP(lchmod, 2) SYSCALL_LOOKUP(fchmod, 2) @@ -271,8 +273,6 @@ SYSCALL_LOOKUP(munmap, 2) #ifndef CONFIG_DISABLE_MOUNTPOINT SYSCALL_LOOKUP(mount, 5) - SYSCALL_LOOKUP(sync, 0) - SYSCALL_LOOKUP(fsync, 1) SYSCALL_LOOKUP(ftruncate, 2) SYSCALL_LOOKUP(mkdir, 2) SYSCALL_LOOKUP(rename, 2) diff --git a/syscall/syscall.csv b/syscall/syscall.csv index ac2706ac36..f5a8f3220b 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -30,7 +30,7 @@ "fs_fdopen","nuttx/fs/fs.h","defined(CONFIG_FILE_STREAM)","int","int","int","FAR struct tcb_s *","FAR struct file_struct **" "fstat","sys/stat.h","","int","int","FAR struct stat *" "fstatfs","sys/statfs.h","","int","int","FAR struct statfs *" -"fsync","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int" +"fsync","unistd.h","","int","int" "ftruncate","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int","off_t" "futimens","sys/stat.h","","int","int","const struct timespec [2]|FAR const struct timespec *" "get_environ_ptr","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char **" @@ -166,7 +166,7 @@ "stat","sys/stat.h","","int","FAR const char *","FAR struct stat *" "statfs","sys/statfs.h","","int","FAR const char *","FAR struct statfs *" "symlink","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","int","FAR const char *","FAR const char *" -"sync","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","void" +"sync","unistd.h","","void" "sysinfo","sys/sysinfo.h","","int","FAR struct sysinfo *" "task_create","sched.h","!defined(CONFIG_BUILD_KERNEL)", "int","FAR const char *","int","int","main_t","FAR char * const []|FAR char * const *" "task_delete","sched.h","!defined(CONFIG_BUILD_KERNEL)","int","pid_t"