Skip to content
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

[FEATURE] Allow mounting SD images in R/O mode #311

Closed
wavexx opened this issue Jun 19, 2021 · 0 comments · Fixed by #312
Closed

[FEATURE] Allow mounting SD images in R/O mode #311

wavexx opened this issue Jun 19, 2021 · 0 comments · Fixed by #312
Assignees
Labels
enhancement New feature or request

Comments

@wavexx
Copy link
Collaborator

wavexx commented Jun 19, 2021

Is your feature request related to a problem? Please describe.
I'm looking at some test SD images which I made intentionally R/O. These fail to mount, since in SDCard.cpp:571 we explicitly open them with O_RDWR with no fallback.

Describe the solution you'd like
If open() fails, we should attempt to reopen the file with O_RDONLY or probe using access(2).

If O_RDONLY succeeds, for a proper simulation, mmap shouldn't have PROT_WRITE and we should also mark the CSD's PERM_WRITE_PROTECT bit and return errors during writes.

Describe alternatives you've considered
For now I just attempt to reopen with O_RDONLY to ensure I don't change testing images, but that's not a PR I would submit ;)

@wavexx wavexx added the enhancement New feature or request label Jun 19, 2021
@vintagepc vintagepc self-assigned this Jun 19, 2021
vintagepc added a commit that referenced this issue Jun 19, 2021
vintagepc added a commit that referenced this issue Jun 19, 2021
* Fix #311 - support RO SD images.

* Add test for RO card in CSD and failure code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants