You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/01/02 14:23:27 UTC

[nuttx] 01/03: Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 36528eed64d598e31cc4b65d80b61813e3b13539
Author: Jukka Laitinen <ju...@ssrc.tii.ae>
AuthorDate: Mon Jan 2 16:32:30 2023 +0400

    Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"
    
    This reverts commit dbc163f1b0b78543bb93e6e35142ec2061db85d6.
---
 fs/vfs/fs_truncate.c     | 15 +--------------
 include/nuttx/fs/ioctl.h |  3 ---
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/fs/vfs/fs_truncate.c b/fs/vfs/fs_truncate.c
index e67339a54b..4ecd06c13d 100644
--- a/fs/vfs/fs_truncate.c
+++ b/fs/vfs/fs_truncate.c
@@ -31,7 +31,6 @@
 #include <debug.h>
 
 #include <nuttx/fs/fs.h>
-#include <nuttx/fs/ioctl.h>
 
 #include "inode/inode.h"
 
@@ -69,19 +68,7 @@ int file_truncate(FAR struct file *filep, off_t length)
    */
 
   inode = filep->f_inode;
-  if (inode == NULL)
-    {
-      return -EINVAL;
-    }
-
-  /* If inode is not mountpoint try ioctl first */
-
-  if (!INODE_IS_MOUNTPT(inode))
-    {
-      return file_ioctl(filep, FIOC_TRUNCATE, length);
-    }
-
-  if (inode->u.i_mops == NULL)
+  if (inode == NULL || !INODE_IS_MOUNTPT(inode) || inode->u.i_mops == NULL)
     {
       fwarn("WARNING:  Not a (regular) file on a mounted file system.\n");
       return -EINVAL;
diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h
index a249122c63..f356002eff 100644
--- a/include/nuttx/fs/ioctl.h
+++ b/include/nuttx/fs/ioctl.h
@@ -187,9 +187,6 @@
                                            *      configuration
                                            * OUT: None
                                            */
-#define FIOC_TRUNCATE   _FIOC(0x0010)     /* IN:  Length of the file after truncate
-                                           * OUT: None
-                                           */
 
 /* NuttX file system ioctl definitions **************************************/