[riot-notifications] [RIOT-OS/RIOT] [RFC][WIP] Initial implementation of a more layered approach to netdev (#8198)

Kaspar Schleiser notifications at github.com
Sat Dec 9 13:10:23 CET 2017


> Every layer must implement all ops, that's why I've build a few NULL-like ops.

This brings back an idea I've had for a while: how about refactoring ```netdev_t``` to have all function pointers in it's own structure (netdev_ops_t), which would be the first member of netdev_t?
If we also add a "parent" pointer, we could have a couple of pre-made functions that just pass on to the parent, e.g.,

```
netdev_send_t netdev_send_nop(netdev_t *dev, ...)
{
   return dev->parent->ops->send(dev->parent, ...)
}
```
The benefits of an extra ```ops``` field would be that every layer would only have a base RAM usage of two pointers (ops and parent) in addition to any state, with the ```ops``` struct being in ROM.

-- 
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/8198#issuecomment-350456294
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20171209/b62fe238/attachment.html>


More information about the notifications mailing list