-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
extmod/vfs: Return mount table from no-args mount call. #16939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Code size report:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #16939 +/- ##
=======================================
Coverage 98.54% 98.54%
=======================================
Files 169 169
Lines 21878 21887 +9
=======================================
+ Hits 21559 21568 +9
Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! And it's nice how it mirrors the Linux mount
command, which with no arguments outputs a list of mounted filesystems.
Tested on PYBD_SF2 (with a ROMFS mounted) and RPI_PICO_W (which mounts at the root).
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
This extends the existing `vfs.mount()` function to accept zero arguments, in which case it returns a list of tuples of mounted filesystem objects and their mount location. Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
Summary
This is a more minimal version of #16849, that overloads
vfs.mount
to output the current vfs mount table when called with no arguments.Testing
This PR includes full automated tests; I have verified that these tests pass with the feature code and fail without it.
Trade-offs and Alternatives
In order to overload
vfs.mount
to accept a zero-argument call, it's necessary to change the two existing arguments from fixed positional arguments into dynamic positional arguments handled bymp_arg_parse_all
.I've re-defined them as required nameless arguments in the table for now so that their current positional-only behavior doesn't change:
This avoids introducing new QSTRs for the argument names
fsobj
andmount_point
and avoids committing to those specific argument names as a visible part of the API (i.e.mount(fsobj=..., mount_point=...)
remains an error). This may be a design decision worth revisiting (perhaps along with the argument names themselves).