Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"

This reverts commit dbc163f1b0.
This commit is contained in:
Jukka Laitinen 2023-01-02 16:32:30 +04:00 committed by Alan Carvalho de Assis
parent 275b2e70a4
commit 36528eed64
2 changed files with 1 additions and 17 deletions

View File

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

View File

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