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 4009cb1970c05f932b161d5fc253e8f67f1a5650
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Fri Feb 10 15:20:43 2023 +0800

    fs: Don't guard ftruncate with CONFIG_DISABLE_MOUNTPOINT
    
    since ftruncate depends on file_operations not mountpt_operations
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 fs/vfs/Make.defs             | 5 +----
 fs/vfs/fs_truncate.c         | 4 ----
 include/nuttx/fs/fs.h        | 2 --
 include/sys/syscall_lookup.h | 2 +-
 syscall/syscall.csv          | 2 +-
 5 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/fs/vfs/Make.defs b/fs/vfs/Make.defs
index 6a9ed945ad..92bf939c98 100644
--- a/fs/vfs/Make.defs
+++ b/fs/vfs/Make.defs
@@ -25,13 +25,10 @@ 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 fs_fsync.c
+CSRCS += fs_truncate.c
 
 # Certain interfaces are not available if there is no mountpoint support
 
-ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
-CSRCS += fs_truncate.c
-endif
-
 ifneq ($(CONFIG_PSEUDOFS_SOFTLINKS),0)
 CSRCS += fs_link.c fs_symlink.c fs_readlink.c
 endif
diff --git a/fs/vfs/fs_truncate.c b/fs/vfs/fs_truncate.c
index c4c0297640..91bbd8e5a0 100644
--- a/fs/vfs/fs_truncate.c
+++ b/fs/vfs/fs_truncate.c
@@ -34,8 +34,6 @@
 
 #include "inode/inode.h"
 
-#ifndef CONFIG_DISABLE_MOUNTPOINT
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -192,5 +190,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 69a296800b..5d36568066 100644
--- a/include/nuttx/fs/fs.h
+++ b/include/nuttx/fs/fs.h
@@ -1253,9 +1253,7 @@ int file_fsync(FAR struct file *filep);
  *
  ****************************************************************************/
 
-#ifndef CONFIG_DISABLE_MOUNTPOINT
 int file_truncate(FAR struct file *filep, off_t length);
-#endif
 
 /****************************************************************************
  * Name: file_mmap
diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h
index 506d15eafd..8dc62e9438 100644
--- a/include/sys/syscall_lookup.h
+++ b/include/sys/syscall_lookup.h
@@ -231,6 +231,7 @@ SYSCALL_LOOKUP(pwrite,                     4)
 SYSCALL_LOOKUP(dup,                        1)
 SYSCALL_LOOKUP(dup2,                       2)
 SYSCALL_LOOKUP(fcntl,                      3)
+SYSCALL_LOOKUP(ftruncate,                  2)
 SYSCALL_LOOKUP(lseek,                      3)
 SYSCALL_LOOKUP(mmap,                       6)
 SYSCALL_LOOKUP(open,                       3)
@@ -273,7 +274,6 @@ SYSCALL_LOOKUP(munmap,                     2)
 
 #ifndef CONFIG_DISABLE_MOUNTPOINT
   SYSCALL_LOOKUP(mount,                    5)
-  SYSCALL_LOOKUP(ftruncate,                2)
   SYSCALL_LOOKUP(mkdir,                    2)
   SYSCALL_LOOKUP(rename,                   2)
   SYSCALL_LOOKUP(rmdir,                    1)
diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index f5a8f3220b..f6215bf715 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -31,7 +31,7 @@
 "fstat","sys/stat.h","","int","int","FAR struct stat *"
 "fstatfs","sys/statfs.h","","int","int","FAR struct statfs *"
 "fsync","unistd.h","","int","int"
-"ftruncate","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int","off_t"
+"ftruncate","unistd.h","","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 **"
 "getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char *","FAR const 
char *"

Reply via email to