xiaoxiang781216 commented on code in PR #13584:
URL: https://github.com/apache/nuttx/pull/13584#discussion_r1776161043


##########
fs/smartfs/smartfs.h:
##########
@@ -294,6 +294,7 @@ struct smartfs_ofile_s
   FAR uint8_t                *buffer;       /* Sector buffer to reduce writes 
*/
   uint8_t                     bflags;       /* Buffer flags */
 #endif
+  FAR char                    *path;        /* The full path to the file */

Review Comment:
   ```suggestion
     char                         path[1];     /* The full path to the file */
   ```
   and move to the end of struct



##########
fs/smartfs/smartfs_smart.c:
##########
@@ -217,6 +219,21 @@ static int smartfs_open(FAR struct file *filep, FAR const 
char *relpath,
       goto errout_with_lock;
     }
 
+  /* Save the full path to smartfs_ofile_s stuctrue. This is needed
+   * to FIOC_FILEPATH ioctlc all support.
+   */
+
+  pathlen = strlen(relpath) + 1;
+  sf->path = kmm_malloc(pathlen);

Review Comment:
   let's change line 215 to:
   ```
   sf = kmm_malloc(sizeof(*sf) + len);
   ```
   and remove the second allocation here to simply the error handling



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to