diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ac0c92b1e002..30446222b396 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -304,7 +304,7 @@ struct net_device | |||
304 | 304 | ||
305 | unsigned long state; | 305 | unsigned long state; |
306 | 306 | ||
307 | struct net_device *next; | 307 | struct list_head dev_list; |
308 | 308 | ||
309 | /* The device initialization function. Called only once. */ | 309 | /* The device initialization function. Called only once. */ |
310 | int (*init)(struct net_device *dev); | 310 | int (*init)(struct net_device *dev); |
@@ -575,13 +575,36 @@ struct packet_type { | |||
575 | #include <linux/notifier.h> | 575 | #include <linux/notifier.h> |
576 | 576 | ||
577 | extern struct net_device loopback_dev; /* The loopback */ | 577 | extern struct net_device loopback_dev; /* The loopback */ |
578 | extern struct net_device *dev_base; /* All devices */ | 578 | extern struct list_head dev_base_head; /* All devices */ |
579 | extern rwlock_t dev_base_lock; /* Device list lock */ | 579 | extern rwlock_t dev_base_lock; /* Device list lock */ |
580 | 580 | ||
581 | #define for_each_netdev(d) \ | ||
582 | list_for_each_entry(d, &dev_base_head, dev_list) | ||
583 | #define for_each_netdev_safe(d, n) \ | ||
584 | list_for_each_entry_safe(d, n, &dev_base_head, dev_list) | ||
585 | #define for_each_netdev_continue(d) \ | ||
586 | list_for_each_entry_continue(d, &dev_base_head, dev_list) | ||
587 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | ||
588 | |||
589 | static inline struct net_device *next_net_device(struct net_device *dev) | ||
590 | { | ||
591 | struct list_head *lh; | ||
592 | |||
593 | lh = dev->dev_list.next; | ||
594 | return lh == &dev_base_head ? NULL : net_device_entry(lh); | ||
595 | } | ||
596 | |||
597 | static inline struct net_device *first_net_device(void) | ||
598 | { | ||
599 | return list_empty(&dev_base_head) ? NULL : | ||
600 | net_device_entry(dev_base_head.next); | ||
601 | } | ||
602 | |||
581 | extern int netdev_boot_setup_check(struct net_device *dev); | 603 | extern int netdev_boot_setup_check(struct net_device *dev); |
582 | extern unsigned long netdev_boot_base(const char *prefix, int unit); | 604 | extern unsigned long netdev_boot_base(const char *prefix, int unit); |
583 | extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); | 605 | extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); |
584 | extern struct net_device *dev_getfirstbyhwtype(unsigned short type); | 606 | extern struct net_device *dev_getfirstbyhwtype(unsigned short type); |
607 | extern struct net_device *__dev_getfirstbyhwtype(unsigned short type); | ||
585 | extern void dev_add_pack(struct packet_type *pt); | 608 | extern void dev_add_pack(struct packet_type *pt); |
586 | extern void dev_remove_pack(struct packet_type *pt); | 609 | extern void dev_remove_pack(struct packet_type *pt); |
587 | extern void __dev_remove_pack(struct packet_type *pt); | 610 | extern void __dev_remove_pack(struct packet_type *pt); |