You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "ajuckler (via GitHub)" <gi...@apache.org> on 2025/11/02 08:29:00 UTC
Re: [PR] vfs/fs_stat: set st_size on EEPROM character drivers [nuttx]
ajuckler commented on code in PR #17264:
URL: https://github.com/apache/nuttx/pull/17264#discussion_r2484395641
##########
fs/vfs/fs_stat.c:
##########
@@ -439,6 +440,27 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve)
#endif
{
buf->st_mode |= S_IFCHR;
+
+ /* If it is an EEPROM driver, populate the st_size as well (to
+ * allow exporting it as filemtd or loop device)
+ */
+
+ if (inode->u.i_ops->ioctl != NULL)
Review Comment:
The EEPROM drivers don't have access to the inode properties until they are open. I could populate the field on open, but `stat` can also be called on non-open files so this is not viable.
Alternatively, I could call `find_driver` after the `register_driver` calls in the `_initialize` functions, and then assign the i_size. What do you think?
--
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