mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
netdev: netdev_from_minor
This commit is contained in:
@@ -95,5 +95,6 @@ void ipv4_process(netdev_t *netdev, void *nextbuff);
|
|||||||
int ipv4_addroute(netdev_t *netdev, uint32_t addr, uint32_t gateway, uint32_t mask, int weight);
|
int ipv4_addroute(netdev_t *netdev, uint32_t addr, uint32_t gateway, uint32_t mask, int weight);
|
||||||
int netdev_register(netdev_t *netdev, char *name);
|
int netdev_register(netdev_t *netdev, char *name);
|
||||||
netdev_t *netdev_getdev(char *name);
|
netdev_t *netdev_getdev(char *name);
|
||||||
|
netdev_t *netdev_from_minor(uint16_t minor);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -246,6 +246,10 @@ static devops_t devops = {
|
|||||||
.ioctl = netdev_ioctl
|
.ioctl = netdev_ioctl
|
||||||
};
|
};
|
||||||
|
|
||||||
|
netdev_t *netdev_from_minor(uint16_t minor) {
|
||||||
|
return minors[minor];
|
||||||
|
}
|
||||||
|
|
||||||
int netdev_register(netdev_t *netdev, char *name) {
|
int netdev_register(netdev_t *netdev, char *name) {
|
||||||
// TODO: better allocation strategy (copy wlan's?)
|
// TODO: better allocation strategy (copy wlan's?)
|
||||||
int minor = __atomic_fetch_add(¤t_minor, 1, __ATOMIC_RELAXED);
|
int minor = __atomic_fetch_add(¤t_minor, 1, __ATOMIC_RELAXED);
|
||||||
|
|||||||
Reference in New Issue
Block a user