mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
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:
@@ -98,8 +98,6 @@ static int files_extend(FAR struct filelist *list, size_t row)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
|
||||||
|
|
||||||
static void task_fssync(FAR struct tcb_s *tcb, FAR void *arg)
|
static void task_fssync(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
{
|
{
|
||||||
FAR struct filelist *list;
|
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);
|
nxmutex_unlock(&list->fl_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !CONFIG_DISABLE_MOUNTPOINT */
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -638,8 +634,6 @@ int close(int fd)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: sync
|
* Name: sync
|
||||||
*
|
*
|
||||||
@@ -653,5 +647,3 @@ void sync(void)
|
|||||||
{
|
{
|
||||||
nxsched_foreach(task_fssync, NULL);
|
nxsched_foreach(task_fssync, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !CONFIG_DISABLE_MOUNTPOINT */
|
|
||||||
|
|||||||
+2
-2
@@ -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_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_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_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
|
# Certain interfaces are not available if there is no mountpoint support
|
||||||
|
|
||||||
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
|
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
|
||||||
CSRCS += fs_fsync.c fs_truncate.c
|
CSRCS += fs_truncate.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(CONFIG_PSEUDOFS_SOFTLINKS),0)
|
ifneq ($(CONFIG_PSEUDOFS_SOFTLINKS),0)
|
||||||
|
|||||||
+4
-5
@@ -36,8 +36,6 @@
|
|||||||
|
|
||||||
#include "inode/inode.h"
|
#include "inode/inode.h"
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -65,6 +63,7 @@ int file_fsync(FAR struct file *filep)
|
|||||||
inode = filep->f_inode;
|
inode = filep->f_inode;
|
||||||
if (inode != NULL)
|
if (inode != NULL)
|
||||||
{
|
{
|
||||||
|
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||||
if (INODE_IS_MOUNTPT(inode) && inode->u.i_mops &&
|
if (INODE_IS_MOUNTPT(inode) && inode->u.i_mops &&
|
||||||
inode->u.i_mops->sync)
|
inode->u.i_mops->sync)
|
||||||
{
|
{
|
||||||
@@ -72,7 +71,9 @@ int file_fsync(FAR struct file *filep)
|
|||||||
|
|
||||||
return inode->u.i_mops->sync(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);
|
ret = inode->u.i_ops->ioctl(filep, BIOC_FLUSH, 0);
|
||||||
return ret >= 0 ? 0 : ret;
|
return ret >= 0 ? 0 : ret;
|
||||||
@@ -125,5 +126,3 @@ errout:
|
|||||||
set_errno(-ret);
|
set_errno(-ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !CONFIG_DISABLE_MOUNTPOINT */
|
|
||||||
|
|||||||
@@ -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);
|
int file_fsync(FAR struct file *filep);
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_truncate
|
* Name: file_truncate
|
||||||
|
|||||||
@@ -240,6 +240,8 @@ SYSCALL_LOOKUP(fstat, 2)
|
|||||||
SYSCALL_LOOKUP(statfs, 2)
|
SYSCALL_LOOKUP(statfs, 2)
|
||||||
SYSCALL_LOOKUP(fstatfs, 2)
|
SYSCALL_LOOKUP(fstatfs, 2)
|
||||||
SYSCALL_LOOKUP(sendfile, 4)
|
SYSCALL_LOOKUP(sendfile, 4)
|
||||||
|
SYSCALL_LOOKUP(sync, 0)
|
||||||
|
SYSCALL_LOOKUP(fsync, 1)
|
||||||
SYSCALL_LOOKUP(chmod, 2)
|
SYSCALL_LOOKUP(chmod, 2)
|
||||||
SYSCALL_LOOKUP(lchmod, 2)
|
SYSCALL_LOOKUP(lchmod, 2)
|
||||||
SYSCALL_LOOKUP(fchmod, 2)
|
SYSCALL_LOOKUP(fchmod, 2)
|
||||||
@@ -271,8 +273,6 @@ SYSCALL_LOOKUP(munmap, 2)
|
|||||||
|
|
||||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||||
SYSCALL_LOOKUP(mount, 5)
|
SYSCALL_LOOKUP(mount, 5)
|
||||||
SYSCALL_LOOKUP(sync, 0)
|
|
||||||
SYSCALL_LOOKUP(fsync, 1)
|
|
||||||
SYSCALL_LOOKUP(ftruncate, 2)
|
SYSCALL_LOOKUP(ftruncate, 2)
|
||||||
SYSCALL_LOOKUP(mkdir, 2)
|
SYSCALL_LOOKUP(mkdir, 2)
|
||||||
SYSCALL_LOOKUP(rename, 2)
|
SYSCALL_LOOKUP(rename, 2)
|
||||||
|
|||||||
+2
-2
@@ -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 **"
|
"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 *"
|
"fstat","sys/stat.h","","int","int","FAR struct stat *"
|
||||||
"fstatfs","sys/statfs.h","","int","int","FAR struct statfs *"
|
"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"
|
"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 *"
|
"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 **"
|
"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 *"
|
"stat","sys/stat.h","","int","FAR const char *","FAR struct stat *"
|
||||||
"statfs","sys/statfs.h","","int","FAR const char *","FAR struct statfs *"
|
"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 *"
|
"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 *"
|
"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_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"
|
"task_delete","sched.h","!defined(CONFIG_BUILD_KERNEL)","int","pid_t"
|
||||||
|
|||||||
|
Reference in New Issue
Block a user