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

Marian Buschsieweke notifications at github.com
Sat May 9 11:40:55 CEST 2020

> E.g. if `write()` would write beyond a page, it should only write as many bytes as it could and report that to the MTD layer which would then write the next chunk on the new page.

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?

If you indent to add an intermediate layer on top of the drivers anyway, why not introduce two flavors of backends: One that supports arbitrary writes and reads, and one that only works on a page level. E.g. flash drivers will very naturally map to the page-wise access, while e.g. EEPROM or the native file based MTD map very naturally to arbitrary reads and writes. A `union` could be used that the driver struct does not get to big and the intermediate layer would make sure that implementation details are transparent to the MTD users.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200509/afcbecce/attachment.htm>

More information about the notifications mailing list