diff --git a/fs/binfs/fs_binfs.c b/fs/binfs/fs_binfs.c index eaa49b2e6f..9ccf992679 100644 --- a/fs/binfs/fs_binfs.c +++ b/fs/binfs/fs_binfs.c @@ -42,6 +42,8 @@ #include #include +#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 diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h index d02b6c977e..1e84674b4e 100644 --- a/include/nuttx/fs/ioctl.h +++ b/include/nuttx/fs/ioctl.h @@ -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 **************************************/