8000 Allow mounting '/' on '/' by dhalbert · Pull Request #953 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content
8000

Allow mounting '/' on '/' #953

New issue

Have a questi 8000 on 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

Merged
merged 1 commit into from
Jun 25, 2018
Merged

Conversation

dhalbert
Copy link
Collaborator

Allow mounting '/' on '/'. This was done in C code in atmel-samd, but esp8266 does it in Python code, which fell afoul of #935.

Also relaxes requirement that filesystem operations readblocks() and writeblocks() return 0 on success. They can return None or 0. Any other return is considered to be an error status code.

@jerryneedell may test this afternoon after 4pm ET.

Fixes #947.

@dhalbert dhalbert requested a review from tannewt June 21, 2018 13:29
@jerryneedell
Copy link
Collaborator

@dhalbert I downloaded and built with this PR. It boots cleanly and I can now upload files with ampy!!
One note - I had to erase the chip in order for it to work. At least, it did not work on my first try. I then erased the chip and reloaded and it was fine.

@jerryneedell
Copy link
Collaborator

Note : I pulled the fixes into master, not 3.x

@jerryneedell
Copy link
Collaborator

repeated with 3.x -- still works ;-)

@dhalbert
Copy link
Collaborator Author

@jerryneedell Thanks for the testing! I don't know why you needed to erase, but I assume the original filesystem was corrupted.

@jerryneedell
Copy link
Collaborator

odd - just tried it on another esp8266 and I did not have to erase it. THis board has some files alredy installed and they are still intact

Copy link
Member
@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One optional thing. Otherwise, looks good.

@@ -180,7 +180,7 @@ DRESULT disk_write (
if (nlr_push(&nlr) == 0) {
mp_obj_t ret = mp_call_method_n_kw(2, 0, vfs->writeblocks);
nlr_pop();
if (mp_obj_get_int(ret) != 0) {
if (ret != mp_const_none && MP_OBJ_SMALL_INT_VALUE(ret) != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!mp_obj_is_true(ret) will make it use the standard Python truthiness. https://github.com/adafruit/circuitpython/blob/master/py/obj.h#L681

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The particular test I used above was already used elsewhere in this file (see line 73, for example), so let's stick with the current test. The implicit contract is that the called routines either have a plain return (so returning None, meaning everything is fine, or return an error code, with 0 meaning OK. Other Falsiness (like empty lists) is not expected.

@tannewt tannewt merged commit 5ae8094 into adafruit:3.x Jun 25, 2018
@dhalbert dhalbert deleted the allow-mount-slash branch May 28, 2019 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0