xiaoxiang781216 commented on code in PR #19126:
URL: https://github.com/apache/nuttx/pull/19126#discussion_r3407488821
##########
fs/littlefs/lfs_vfs.c:
##########
@@ -1415,6 +1416,47 @@ static int littlefs_bind(FAR struct inode *driver, FAR
const void *data,
goto errout_with_fs;
}
+ /* Parse comma-separated mount options. Recognised tokens:
+ * autoformat - format if mount fails
+ * forceformat - always format before mounting
+ * block_size_factor=N - override CONFIG_FS_LITTLEFS_BLOCK_SIZE_FACTOR
+ */
+
+ bool autoformat = false;
+ bool forceformat = false;
+ int block_size_factor = CONFIG_FS_LITTLEFS_BLOCK_SIZE_FACTOR;
Review Comment:
move the variable definition to the begin of function for c89
##########
fs/littlefs/lfs_vfs.c:
##########
@@ -1415,6 +1416,47 @@ static int littlefs_bind(FAR struct inode *driver, FAR
const void *data,
goto errout_with_fs;
}
+ /* Parse comma-separated mount options. Recognised tokens:
+ * autoformat - format if mount fails
+ * forceformat - always format before mounting
+ * block_size_factor=N - override CONFIG_FS_LITTLEFS_BLOCK_SIZE_FACTOR
+ */
+
+ bool autoformat = false;
+ bool forceformat = false;
+ int block_size_factor = CONFIG_FS_LITTLEFS_BLOCK_SIZE_FACTOR;
+
+ if (data != NULL)
+ {
+ FAR char *dup = strdup(data);
+ FAR char *tmp = dup;
+ FAR char *tok;
+
+ if (dup == NULL)
+ {
+ ret = -ENOMEM;
+ goto errout_with_fs;
+ }
+
+ while ((tok = strsep(&tmp, ",")) != NULL)
Review Comment:
can we use strchrnul to avoid strdup?
--
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]