提交 4389e47a 编写于 作者: M Marek Lindner

batman-adv: rename global if_list to hardif_list

Batman-adv works with "hard interfaces" as well as "soft interfaces".
The new name should better make clear which kind of interfaces this
list stores.
Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
上级 d0072609
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
/* protect update critical side of if_list - but not the content */ /* protect update critical side of hardif_list - but not the content */
static DEFINE_SPINLOCK(if_list_lock); static DEFINE_SPINLOCK(hardif_list_lock);
static int batman_skb_recv(struct sk_buff *skb, static int batman_skb_recv(struct sk_buff *skb,
...@@ -54,7 +54,7 @@ struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev) ...@@ -54,7 +54,7 @@ struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev)
struct batman_if *batman_if; struct batman_if *batman_if;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if (batman_if->net_dev == net_dev && if (batman_if->net_dev == net_dev &&
atomic_inc_not_zero(&batman_if->refcount)) atomic_inc_not_zero(&batman_if->refcount))
goto out; goto out;
...@@ -99,7 +99,7 @@ static struct batman_if *get_active_batman_if(struct net_device *soft_iface) ...@@ -99,7 +99,7 @@ static struct batman_if *get_active_batman_if(struct net_device *soft_iface)
struct batman_if *batman_if; struct batman_if *batman_if;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if (batman_if->soft_iface != soft_iface) if (batman_if->soft_iface != soft_iface)
continue; continue;
...@@ -179,7 +179,7 @@ static void check_known_mac_addr(struct net_device *net_dev) ...@@ -179,7 +179,7 @@ static void check_known_mac_addr(struct net_device *net_dev)
struct batman_if *batman_if; struct batman_if *batman_if;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if ((batman_if->if_status != IF_ACTIVE) && if ((batman_if->if_status != IF_ACTIVE) &&
(batman_if->if_status != IF_TO_BE_ACTIVATED)) (batman_if->if_status != IF_TO_BE_ACTIVATED))
continue; continue;
...@@ -212,7 +212,7 @@ int hardif_min_mtu(struct net_device *soft_iface) ...@@ -212,7 +212,7 @@ int hardif_min_mtu(struct net_device *soft_iface)
goto out; goto out;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if ((batman_if->if_status != IF_ACTIVE) && if ((batman_if->if_status != IF_ACTIVE) &&
(batman_if->if_status != IF_TO_BE_ACTIVATED)) (batman_if->if_status != IF_TO_BE_ACTIVATED))
continue; continue;
...@@ -449,9 +449,9 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev) ...@@ -449,9 +449,9 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
check_known_mac_addr(batman_if->net_dev); check_known_mac_addr(batman_if->net_dev);
spin_lock(&if_list_lock); spin_lock(&hardif_list_lock);
list_add_tail_rcu(&batman_if->list, &if_list); list_add_tail_rcu(&batman_if->list, &hardif_list);
spin_unlock(&if_list_lock); spin_unlock(&hardif_list_lock);
return batman_if; return batman_if;
...@@ -484,12 +484,12 @@ void hardif_remove_interfaces(void) ...@@ -484,12 +484,12 @@ void hardif_remove_interfaces(void)
INIT_LIST_HEAD(&if_queue); INIT_LIST_HEAD(&if_queue);
spin_lock(&if_list_lock); spin_lock(&hardif_list_lock);
list_for_each_entry_safe(batman_if, batman_if_tmp, &if_list, list) { list_for_each_entry_safe(batman_if, batman_if_tmp, &hardif_list, list) {
list_del_rcu(&batman_if->list); list_del_rcu(&batman_if->list);
list_add_tail(&batman_if->list, &if_queue); list_add_tail(&batman_if->list, &if_queue);
} }
spin_unlock(&if_list_lock); spin_unlock(&hardif_list_lock);
rtnl_lock(); rtnl_lock();
list_for_each_entry_safe(batman_if, batman_if_tmp, &if_queue, list) { list_for_each_entry_safe(batman_if, batman_if_tmp, &if_queue, list) {
...@@ -520,9 +520,9 @@ static int hard_if_event(struct notifier_block *this, ...@@ -520,9 +520,9 @@ static int hard_if_event(struct notifier_block *this,
hardif_deactivate_interface(batman_if); hardif_deactivate_interface(batman_if);
break; break;
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
spin_lock(&if_list_lock); spin_lock(&hardif_list_lock);
list_del_rcu(&batman_if->list); list_del_rcu(&batman_if->list);
spin_unlock(&if_list_lock); spin_unlock(&hardif_list_lock);
hardif_remove_interface(batman_if); hardif_remove_interface(batman_if);
break; break;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "vis.h" #include "vis.h"
#include "hash.h" #include "hash.h"
struct list_head if_list; struct list_head hardif_list;
unsigned char broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; unsigned char broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
...@@ -41,7 +41,7 @@ struct workqueue_struct *bat_event_workqueue; ...@@ -41,7 +41,7 @@ struct workqueue_struct *bat_event_workqueue;
static int __init batman_init(void) static int __init batman_init(void)
{ {
INIT_LIST_HEAD(&if_list); INIT_LIST_HEAD(&hardif_list);
/* the name should not be longer than 10 chars - see /* the name should not be longer than 10 chars - see
* http://lwn.net/Articles/23634/ */ * http://lwn.net/Articles/23634/ */
...@@ -156,7 +156,7 @@ int is_my_mac(uint8_t *addr) ...@@ -156,7 +156,7 @@ int is_my_mac(uint8_t *addr)
struct batman_if *batman_if; struct batman_if *batman_if;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if (batman_if->if_status != IF_ACTIVE) if (batman_if->if_status != IF_ACTIVE)
continue; continue;
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
#define REVISION_VERSION_STR " "REVISION_VERSION #define REVISION_VERSION_STR " "REVISION_VERSION
#endif #endif
extern struct list_head if_list; extern struct list_head hardif_list;
extern unsigned char broadcast_addr[]; extern unsigned char broadcast_addr[];
extern struct workqueue_struct *bat_event_workqueue; extern struct workqueue_struct *bat_event_workqueue;
......
...@@ -602,7 +602,7 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num) ...@@ -602,7 +602,7 @@ int orig_hash_del_if(struct batman_if *batman_if, int max_if_num)
/* renumber remaining batman interfaces _inside_ of orig_hash_lock */ /* renumber remaining batman interfaces _inside_ of orig_hash_lock */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if_tmp, &if_list, list) { list_for_each_entry_rcu(batman_if_tmp, &hardif_list, list) {
if (batman_if_tmp->if_status == IF_NOT_IN_USE) if (batman_if_tmp->if_status == IF_NOT_IN_USE)
continue; continue;
......
...@@ -643,7 +643,7 @@ void receive_bat_packet(struct ethhdr *ethhdr, ...@@ -643,7 +643,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
has_directlink_flag); has_directlink_flag);
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if (batman_if->if_status != IF_ACTIVE) if (batman_if->if_status != IF_ACTIVE)
continue; continue;
......
...@@ -204,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet) ...@@ -204,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet)
/* broadcast on every interface */ /* broadcast on every interface */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if (batman_if->soft_iface != soft_iface) if (batman_if->soft_iface != soft_iface)
continue; continue;
...@@ -461,7 +461,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work) ...@@ -461,7 +461,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
/* rebroadcast packet */ /* rebroadcast packet */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(batman_if, &if_list, list) { list_for_each_entry_rcu(batman_if, &hardif_list, list) {
if (batman_if->soft_iface != soft_iface) if (batman_if->soft_iface != soft_iface)
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册