[riot-notifications] [RIOT-OS/RIOT] mtd: Change API to return 0 on success (#13896)

benpicco notifications at github.com
Sat May 9 15:17:46 CEST 2020


> Should the upper layer make sure that only valid parameters are passed to the lower layer? Why would that upper layer call the lower one with writes across pages, unless the upper layer is sure that this is supported?

You are right, some file systems will already align their writes accordingly.
However, there is not much overhead in adding handling to this to the MTD layer: If the buffer fits into one low-level `write()`, it will [exit early](https://github.com/RIOT-OS/RIOT/blob/606d6de54e4803aeb0412bfe2caaf22369c57054/drivers/mtd/mtd.c#L77).

Adding two code paths would be a much bigger overhead.

> EEPROM or the native file based MTD map very naturally to arbitrary reads and writes.

EEPROMs still can't write over page boundaries. If a single write transaction goes beyond the current page, it will wrap around instead of writing to the next page.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/13896#issuecomment-626174950
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200509/db9a3c36/attachment.htm>


More information about the notifications mailing list