You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/09/12 14:49:42 UTC

[GitHub] [incubator-nuttx] Donny9 commented on a change in pull request #4514: fs/ioctl: using FIOC_FILEPATH instead of FIOC_FILENAME

Donny9 commented on a change in pull request #4514:
URL: https://github.com/apache/incubator-nuttx/pull/4514#discussion_r706849048



##########
File path: fs/binfs/fs_binfs.c
##########
@@ -196,22 +198,27 @@ 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, "/");

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org