gustavonihei commented on a change in pull request #4121:
URL: https://github.com/apache/incubator-nuttx/pull/4121#discussion_r668823474
##########
File path: fs/vfs/fs_stat.c
##########
@@ -120,6 +120,10 @@ static int stat_recursive(FAR const char *path,
ret = inode->u.i_mops->stat(inode, desc.relpath, buf);
}
+ else
+ {
+ ret = -ENOSYS;
Review comment:
> from
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html:
>
> Implementations may support additional errors not included in this list,
may generate errors included in this list under circumstances other than those
described here, or may contain extensions or limitations that prevent some
errors from occurring.
Yeah, I checked that list. But one thing that was bugging me was that
`-ENOSYS` is intended for **optional** features that are not implemented, which
is not the the case for `stat`.
> All FS should implement it, but this check ensure if implementer forget
it, the user(even the implementer self) can catch it immediately, instead
wasting the time to the unnecessary debug.
I completely agree with the motivation. The point that I am not so sure is
whether we shouldn't really enforce the implementation by the FS via assertions.
But okay, I'll merge it. `-ENOSYS` is already being returned in several
functions for similar reasons.
--
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]