diff options
| author | Stephen Hemminger <shemminger@osdl.org> | 2004-02-05 21:35:14 -0800 |
|---|---|---|
| committer | Stephen Hemminger <shemminger@osdl.org> | 2004-02-05 21:35:14 -0800 |
| commit | cc1b2ba84162afbb7b11d230a1062bfba12adc24 (patch) | |
| tree | e6ffad32e12c3443b2b174542aed295d8ae55bda /net/core/dev.c | |
| parent | 33be943504778ad51cd2caca8b5497cdf75f30ac (diff) | |
[NET]: Move dev_base and dev_base_lock into net/core/dev.c
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 55fbdfa556c1..e298f2b7f9c9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -161,6 +161,31 @@ static struct timer_list samp_timer = TIMER_INITIALIZER(sample_queue, 0, 0); #endif /* + * The @dev_base list is protected by @dev_base_lock and the rtln + * semaphore. + * + * Pure readers hold dev_base_lock for reading. + * + * Writers must hold the rtnl semaphore while they loop through the + * dev_base list, and hold dev_base_lock for writing when they do the + * actual updates. This allows pure readers to access the list even + * while a writer is preparing to update it. + * + * To put it another way, dev_base_lock is held for writing only to + * protect against pure readers; the rtnl semaphore provides the + * protection against other writers. + * + * See, for example usages, register_netdevice() and + * unregister_netdevice(), which must be called with the rtnl + * semaphore held. + */ +struct net_device *dev_base; +rwlock_t dev_base_lock = RW_LOCK_UNLOCKED; + +EXPORT_SYMBOL(dev_base); +EXPORT_SYMBOL(dev_base_lock); + +/* * Our notifier list */ |
