fs/ioctl: using FIOC_FILEPATH instead of FIOC_FILENAME.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2021-08-31 16:00:59 +08:00 committed by Xiang Xiao
parent 7a68470e89
commit 6df9d1907c
2 changed files with 15 additions and 14 deletions

View File

@ -42,6 +42,8 @@
#include <nuttx/fs/ioctl.h>
#include <nuttx/lib/builtin.h>
#include "inode/inode.h"
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_BINFS)
/****************************************************************************
@ -196,22 +198,26 @@ static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Only one IOCTL command is supported */
if (cmd == FIOC_FILENAME)
if (cmd == FIOC_FILEPATH)
{
/* IN: FAR char const ** pointer
* OUT: Pointer to a persistent file name (Guaranteed to persist while
* the file is open).
/* IN: FAR char *(length >= PATH_MAX)
* OUT: The full file path
*/
FAR const char **ptr = (FAR const char **)((uintptr_t)arg);
FAR char *ptr = (FAR char *)((uintptr_t)arg);
if (ptr == NULL)
{
ret = -EINVAL;
}
else
{
*ptr = builtin_getname((int)((uintptr_t)filep->f_priv));
ret = OK;
ret = inode_getpath(filep->f_inode, ptr);
if (ret < 0)
{
return ret;
}
strcat(ptr, builtin_getname((int)((uintptr_t)filep->f_priv)));
}
}
else

View File

@ -140,10 +140,8 @@
* (ignored on most file systems)
* OUT: None
*/
#define FIOC_FILENAME _FIOC(0x0004) /* IN: FAR const char ** pointer
* OUT: Pointer to a persistent file name
* (Guaranteed to persist while the
* file is open).
#define FIOC_FILEPATH _FIOC(0x0004) /* IN: FAR char *(length >= PATH_MAX)
* OUT: The full file path
*/
#define FIOC_INTEGRITY _FIOC(0x0005) /* Run a consistency check on the
* file system media.
@ -181,9 +179,6 @@
#define FIONCLEX _FIOC(0x000e) /* IN: None
* OUT: None
*/
#define FIOC_FILEPATH _FIOC(0x000f) /* IN: FAR char *(length >= PATH_MAX)
* OUT: The full file path
*/
/* NuttX file system ioctl definitions **************************************/