-
Notifications
You must be signed in to change notification settings - Fork 3k
bd: Add get_erase_value function to the block device API #5925
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
Does -ve value indicate not supported by block device? Erase value or state can be either 0/1 is that correct? Can we mention what will be valid return values from this function? |
Good point, I'll add examples. I'm expecting 0x00, 0xff, any byte value between those, or negative for state between erase is undefined. |
Two comments:
|
Looking further in the implementation and based on @davidsaada queries, I have questions:
|
Uh, I think we might be on different pages. Definitely means the documentation should be improved. This was actually supposed to be the idea discussed earlier. so:
Calling It sounds like I used the word byte and state too much. How about this? class BlockDevice {
/** Get the value of storage when erased
*
* If get_erase_value returns a non-negative byte value, the underlying
* storage will be set to that value when erased, and storage containing
* that value can be programmed without another erase.
*
* @return The value of storage when erased, or -1 if the value of
* erased storage can't be relied on
*/
virtual int get_erase_value() const;
} |
Oh OK, then all clear now. No problem here. |
Marking as "needs work" for docs. |
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.
👍
@AnotherButler, could you take a look at this? |
/morph test |
Default implementation returns -1 and is backwards compatible
@cmonr, sorry the documentation wasn't actually updated yet. Is updated now. |
Query: Should ExhaustibleBlockDevice, ObservingBlockDevice and ReadOnlyBlockDevice be listed in our API references on os.mbed.com/docs? They're not there now, but the others are. |
@AnotherButler, I think so, but that page would need to be updated a bit more than simply listing all supported block devices. Some block devices act as interfaces for specific hardware, whereas others serve as helper block devices. Some block devices have their own repos, with their own example code, whereas others exist within mbed-os. I don't think it should be a part of this PR, but definitely think the page should be updated to list all supported block devices (with examples?). |
/morph build |
I guess what I'm asking is should they each get their own page the way HeapBlockDevice does: https://os.mbed.com/docs/v5.7/reference/heapblockdevice.html? os.mbed.com/docs should only include code on master in mbed-os (perhaps with the exception of porting guide information, which we're in discussions about). |
@AnotherButler, I think for the block devices already a part of mbed-os, they should have a page of their own. For the block devices that are not a part of mbed-os, I think they should also have their own docs page, but maybe in order to do that, they need to be merged into mbed-os first. |
Build : SUCCESSBuild number : 1005 Triggering tests/morph test |
Test : FAILUREBuild number : 813 |
They are listed here: But I agree with @cmonr, they should have individual pages. |
Copy edit SlicingBlockDevice.h Copy edit ReadOnlyBlockDevice.h Copy edit ProfilingBlockDevice.h Copy edit ObservingBlockDevice.h Copy edit MBRBlockDevice.h Copy edit ExhaustibleBlockDevice.h Copy edit ChainingBlockDevice.h Copy edit BlockDevice.h Copy edit files for active voice and consistent tense.
Exporter Build : SUCCESSBuild number : 696 |
/morph build |
Build : SUCCESSBuild number : 1008 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 699 |
Test : FAILUREBuild number : 819 |
Test : SUCCESSBuild number : 823 |
This allows a user to determine the state of storage after an erase and take advantage of the NANDing nature of flash in the filesystem, NVStore, and FTL layers.
should resolve #4023
cc @deepikabhavnani, @cmonr, @davidsaada