mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
fs/ioctl: using FIOC_FILEPATH instead of FIOC_FILENAME.
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
+13
-7
@@ -42,6 +42,8 @@
|
|||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
#include <nuttx/lib/builtin.h>
|
#include <nuttx/lib/builtin.h>
|
||||||
|
|
||||||
|
#include "inode/inode.h"
|
||||||
|
|
||||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_BINFS)
|
#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 */
|
/* Only one IOCTL command is supported */
|
||||||
|
|
||||||
if (cmd == FIOC_FILENAME)
|
if (cmd == FIOC_FILEPATH)
|
||||||
{
|
{
|
||||||
/* IN: FAR char const ** pointer
|
/* IN: FAR char *(length >= PATH_MAX)
|
||||||
* OUT: Pointer to a persistent file name (Guaranteed to persist while
|
* OUT: The full file path
|
||||||
* the file is open).
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FAR const char **ptr = (FAR const char **)((uintptr_t)arg);
|
FAR char *ptr = (FAR char *)((uintptr_t)arg);
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*ptr = builtin_getname((int)((uintptr_t)filep->f_priv));
|
ret = inode_getpath(filep->f_inode, ptr);
|
||||||
ret = OK;
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcat(ptr, builtin_getname((int)((uintptr_t)filep->f_priv)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -140,10 +140,8 @@
|
|||||||
* (ignored on most file systems)
|
* (ignored on most file systems)
|
||||||
* OUT: None
|
* OUT: None
|
||||||
*/
|
*/
|
||||||
#define FIOC_FILENAME _FIOC(0x0004) /* IN: FAR const char ** pointer
|
#define FIOC_FILEPATH _FIOC(0x0004) /* IN: FAR char *(length >= PATH_MAX)
|
||||||
* OUT: Pointer to a persistent file name
|
* OUT: The full file path
|
||||||
* (Guaranteed to persist while the
|
|
||||||
* file is open).
|
|
||||||
*/
|
*/
|
||||||
#define FIOC_INTEGRITY _FIOC(0x0005) /* Run a consistency check on the
|
#define FIOC_INTEGRITY _FIOC(0x0005) /* Run a consistency check on the
|
||||||
* file system media.
|
* file system media.
|
||||||
@@ -181,9 +179,6 @@
|
|||||||
#define FIONCLEX _FIOC(0x000e) /* IN: None
|
#define FIONCLEX _FIOC(0x000e) /* IN: None
|
||||||
* OUT: None
|
* OUT: None
|
||||||
*/
|
*/
|
||||||
#define FIOC_FILEPATH _FIOC(0x000f) /* IN: FAR char *(length >= PATH_MAX)
|
|
||||||
* OUT: The full file path
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* NuttX file system ioctl definitions **************************************/
|
/* NuttX file system ioctl definitions **************************************/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user