1
0
Fork 0
forked from nuttx/nuttx-update

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 <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-02-10 14:54:23 +08:00 committed by GUIDINGLI
parent bd7e521871
commit a05f9aaa85
6 changed files with 10 additions and 21 deletions

View file

@ -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 */

View file

@ -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)

View file

@ -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 */

View file

@ -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

View file

@ -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)

View file

@ -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"

Can't render this file because it has a wrong number of fields in line 2.