-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
@dhalbert I downloaded and built with this PR. It boots cleanly and I can now upload files with ampy!! |
Note : I pulled the fixes into master, not 3.x |
repeated with 3.x -- still works ;-) |
@jerryneedell Thanks for the testing! I don't know why you needed to erase, but I assume the original filesystem was corrupted. |
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 |
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.
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) { |
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.
!mp_obj_is_true(ret)
will make it use the standard Python truthiness. https://github.com/adafruit/circuitpython/blob/master/py/obj.h#L681
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.
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.
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()
andwriteblocks()
return0
on success. They can returnNone
or0
. Any other return is considered to be an error status code.@jerryneedell may test this afternoon after 4pm ET.
Fixes #947.