batman-adv; branch, master, updated. v2012.1.0-178-g3b896e3
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 3b896e321c49e3cbbfd540f537c007db883c3900
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:21 2012 +0200
batman-adv: Replace simple function like defines with functions
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/bat_debugfs.c b/bat_debugfs.c
index 004d94f..b4d622b 100644
--- a/bat_debugfs.c
+++ b/bat_debugfs.c
@@ -74,16 +74,13 @@ static int batadv_fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
return 0;
}
-int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
+int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, va_list args)
{
- va_list args;
char tmp_log_buf[256];
- va_start(args, fmt);
vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s",
jiffies_to_msecs(jiffies), tmp_log_buf);
- va_end(args);
return 0;
}
diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index d03f441..85e041a 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -32,6 +32,31 @@
#include "translation-table.h"
#include "unicast.h"
+static uint8_t *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size)
+{
+ uint8_t *addr;
+
+ addr = (uint8_t *)(skb->data + hdr_size);
+ addr += ETH_HLEN + sizeof(struct arphdr);
+
+ return addr;
+}
+
+static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size)
+{
+ return *(__be32 *)(batadv_arp_hw_src(skb, hdr_size) + ETH_ALEN);
+}
+
+static uint8_t *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size)
+{
+ return batadv_arp_hw_src(skb, hdr_size) + ETH_ALEN + 4;
+}
+
+static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size)
+{
+ return *(__be32 *)(batadv_arp_hw_src(skb, hdr_size) + ETH_ALEN * 2 + 4);
+}
+
/* hash function to choose an entry in a hash table of given size.
* hash algorithm from http://en.wikipedia.org/wiki/Hash_table
*/
@@ -60,14 +85,17 @@ static void batadv_dbg_arp(struct bat_priv *bat_priv, struct sk_buff *skb,
uint16_t type, int hdr_size, char *msg)
{
struct unicast_4addr_packet *unicast_4addr_packet;
+ __be32 src_ip, dst_ip;
if (msg)
batadv_dbg(DBG_DAT, bat_priv, "%s\n", msg);
+ src_ip = batadv_arp_ip_src(skb, hdr_size);
+ dst_ip = batadv_arp_ip_dst(skb, hdr_size);
batadv_dbg(DBG_DAT, bat_priv,
"ARP MSG = [src: %pM-%pI4 dst: %pM-%pI4]\n",
- ARP_HW_SRC(skb, hdr_size), &ARP_IP_SRC(skb, hdr_size),
- ARP_HW_DST(skb, hdr_size), &ARP_IP_DST(skb, hdr_size));
+ batadv_arp_hw_src(skb, hdr_size), &src_ip,
+ batadv_arp_hw_dst(skb, hdr_size), &dst_ip);
if (hdr_size == 0)
return;
@@ -383,8 +411,8 @@ static uint16_t batadv_arp_get_type(struct bat_priv *bat_priv,
/* Check for bad reply/request. If the ARP message is not sane, DAT
* will simply ignore it
*/
- ip_src = ARP_IP_SRC(skb, hdr_size);
- ip_dst = ARP_IP_DST(skb, hdr_size);
+ ip_src = batadv_arp_ip_src(skb, hdr_size);
+ ip_dst = batadv_arp_ip_dst(skb, hdr_size);
if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) ||
ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst))
goto out;
@@ -418,9 +446,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv,
batadv_dbg_arp(bat_priv, skb, type, 0, "Parsing outgoing ARP REQUEST");
- ip_src = ARP_IP_SRC(skb, 0);
- hw_src = ARP_HW_SRC(skb, 0);
- ip_dst = ARP_IP_DST(skb, 0);
+ ip_src = batadv_arp_ip_src(skb, 0);
+ hw_src = batadv_arp_hw_src(skb, 0);
+ ip_dst = batadv_arp_ip_dst(skb, 0);
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
@@ -480,9 +508,9 @@ bool batadv_dat_snoop_incoming_arp_request(struct bat_priv *bat_priv,
if (type != ARPOP_REQUEST)
goto out;
- hw_src = ARP_HW_SRC(skb, hdr_size);
- ip_src = ARP_IP_SRC(skb, hdr_size);
- ip_dst = ARP_IP_DST(skb, hdr_size);
+ hw_src = batadv_arp_hw_src(skb, hdr_size);
+ ip_src = batadv_arp_ip_src(skb, hdr_size);
+ ip_dst = batadv_arp_ip_dst(skb, hdr_size);
batadv_dbg_arp(bat_priv, skb, type, hdr_size,
"Parsing incoming ARP REQUEST");
@@ -538,10 +566,10 @@ bool batadv_dat_snoop_outgoing_arp_reply(struct bat_priv *bat_priv,
batadv_dbg_arp(bat_priv, skb, type, 0, "Parsing outgoing ARP REPLY");
- hw_src = ARP_HW_SRC(skb, 0);
- ip_src = ARP_IP_SRC(skb, 0);
- hw_dst = ARP_HW_DST(skb, 0);
- ip_dst = ARP_IP_DST(skb, 0);
+ hw_src = batadv_arp_hw_src(skb, 0);
+ ip_src = batadv_arp_ip_src(skb, 0);
+ hw_dst = batadv_arp_hw_dst(skb, 0);
+ ip_dst = batadv_arp_ip_dst(skb, 0);
batadv_arp_neigh_update(bat_priv, ip_src, hw_src);
batadv_arp_neigh_update(bat_priv, ip_dst, hw_dst);
@@ -576,10 +604,10 @@ bool batadv_dat_snoop_incoming_arp_reply(struct bat_priv *bat_priv,
batadv_dbg_arp(bat_priv, skb, type, hdr_size,
"Parsing incoming ARP REPLY");
- hw_src = ARP_HW_SRC(skb, hdr_size);
- ip_src = ARP_IP_SRC(skb, hdr_size);
- hw_dst = ARP_HW_DST(skb, hdr_size);
- ip_dst = ARP_IP_DST(skb, hdr_size);
+ hw_src = batadv_arp_hw_src(skb, hdr_size);
+ ip_src = batadv_arp_ip_src(skb, hdr_size);
+ hw_dst = batadv_arp_hw_dst(skb, hdr_size);
+ ip_dst = batadv_arp_ip_dst(skb, hdr_size);
/* Update our internal cache with both the IP addresses we fetched from
* the ARP reply
@@ -603,6 +631,7 @@ bool batadv_dat_drop_broadcast_packet(struct bat_priv *bat_priv,
struct neighbour *n = NULL;
uint16_t type;
bool ret = false;
+ __be32 ip_dst;
/* If this packet is an ARP_REQUEST and we already have the information
* that it is going to ask, we can drop the packet
@@ -614,20 +643,19 @@ bool batadv_dat_drop_broadcast_packet(struct bat_priv *bat_priv,
if (type != ARPOP_REQUEST)
goto out;
- n = neigh_lookup(&arp_tbl, &ARP_IP_DST(forw_packet->skb, bcast_len),
+ ip_dst = batadv_arp_ip_dst(forw_packet->skb, bcast_len);
+ n = neigh_lookup(&arp_tbl, &ip_dst,
forw_packet->if_incoming->soft_iface);
/* check if we already know this neigh */
if (!n || !(n->nud_state & NUD_CONNECTED)) {
batadv_dbg(DBG_DAT, bat_priv,
- "ARP Request for %pI4: fallback\n",
- &ARP_IP_DST(forw_packet->skb, bcast_len));
+ "ARP Request for %pI4: fallback\n", &ip_dst);
goto out;
}
batadv_dbg(DBG_DAT, bat_priv,
- "ARP Request for %pI4: fallback prevented\n",
- &ARP_IP_DST(forw_packet->skb, bcast_len));
+ "ARP Request for %pI4: fallback prevented\n", &ip_dst);
ret = true;
out:
diff --git a/distributed-arp-table.h b/distributed-arp-table.h
index 6b1d22c..47fe32f 100644
--- a/distributed-arp-table.h
+++ b/distributed-arp-table.h
@@ -29,14 +29,6 @@
#define DAT_ADDR_MAX ((dat_addr_t)~(dat_addr_t)0)
-#define ARP_HW_SRC(skb, hdr_size) ((uint8_t *)(skb->data + hdr_size) + \
- ETH_HLEN + sizeof(struct arphdr))
-#define ARP_IP_SRC(skb, hdr_size) (*(__be32 *)(ARP_HW_SRC(skb, hdr_size) + \
- ETH_ALEN))
-#define ARP_HW_DST(skb, hdr_size) (ARP_HW_SRC(skb, hdr_size) + ETH_ALEN + 4)
-#define ARP_IP_DST(skb, hdr_size) (*(__be32 *)(ARP_HW_SRC(skb, hdr_size) + \
- ETH_ALEN * 2 + 4))
-
bool batadv_dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv,
struct sk_buff *skb);
bool batadv_dat_snoop_incoming_arp_request(struct bat_priv *bat_priv,
diff --git a/main.h b/main.h
index 245323b..ea5d7d5 100644
--- a/main.h
+++ b/main.h
@@ -187,24 +187,37 @@ int batadv_algo_select(struct bat_priv *bat_priv, char *name);
int batadv_algo_seq_print_text(struct seq_file *seq, void *offset);
#ifdef CONFIG_BATMAN_ADV_DEBUG
-int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
-__printf(2, 3);
-
-#define batadv_dbg(type, bat_priv, fmt, arg...) \
- do { \
- if (atomic_read(&bat_priv->log_level) & type) \
- batadv_debug_log(bat_priv, fmt, ## arg);\
- } \
- while (0)
+int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, va_list args);
+
+static inline void batadv_vdbg(int type, struct bat_priv *bat_priv,
+ const char *fmt, va_list args)
+{
+ if (atomic_read(&bat_priv->log_level) & type)
+ batadv_debug_log(bat_priv, fmt, args);
+}
+
#else /* !CONFIG_BATMAN_ADV_DEBUG */
-__printf(3, 4)
-static inline void batadv_dbg(int type __always_unused,
- struct bat_priv *bat_priv __always_unused,
- const char *fmt __always_unused, ...)
+
+static inline void batadv_vdbg(int type __always_unused,
+ struct bat_priv *bat_priv __always_unused,
+ const char *fmt __always_unused,
+ va_list args __always_unused)
{
}
+
#endif
+__printf(3, 4)
+static inline void batadv_dbg(int type, struct bat_priv *bat_priv,
+ const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ batadv_vdbg(type, bat_priv, fmt, args);
+ va_end(args);
+}
+
#define bat_info(net_dev, fmt, arg...) \
do { \
struct net_device *_netdev = (net_dev); \
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-177-ge47eadc
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit e47eadc18aa6db6262d6b3ea174c080f122430aa
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:20 2012 +0200
batman-adv: Mark only locally used symbol batadv_tt_local_crc as static
29ccfec94d51f7725124786e29d023b212920661 changed the translation table code in
such a way that it doesn't use the symbol tt_local_crc outside of
translation-table.c
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/translation-table.c b/translation-table.c
index f50e795..62dda2b 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1172,7 +1172,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
}
/* Calculates the checksum of the local table */
-uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv)
+static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv)
{
uint16_t total = 0, total_one;
struct hashtable_t *hash = bat_priv->tt_local_hash;
diff --git a/translation-table.h b/translation-table.h
index 56e8016..7edc9df 100644
--- a/translation-table.h
+++ b/translation-table.h
@@ -41,7 +41,6 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,
const uint8_t *src,
const uint8_t *addr);
-uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv);
void batadv_tt_free(struct bat_priv *bat_priv);
bool batadv_send_tt_response(struct bat_priv *bat_priv,
struct tt_query_packet *tt_request);
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-176-g0c172dd
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 0c172dd77616b42bd8534d51eb51074fc957ead1
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:19 2012 +0200
batman-adv: Prefix main local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/main.c b/main.c
index 5df1032..b051457 100644
--- a/main.c
+++ b/main.c
@@ -38,22 +38,23 @@
* list traversals just rcu-locked
*/
struct list_head batadv_hardif_list;
-static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *);
+static int (*batadv_rx_handler[256])(struct sk_buff *,
+ struct hard_iface *);
char batadv_routing_algo[20] = "BATMAN_IV";
-static struct hlist_head bat_algo_list;
+static struct hlist_head batadv_algo_list;
unsigned char batadv_broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct workqueue_struct *batadv_event_workqueue;
-static void recv_handler_init(void);
+static void batadv_recv_handler_init(void);
-static int __init batman_init(void)
+static int __init batadv_init(void)
{
INIT_LIST_HEAD(&batadv_hardif_list);
- INIT_HLIST_HEAD(&bat_algo_list);
+ INIT_HLIST_HEAD(&batadv_algo_list);
- recv_handler_init();
+ batadv_recv_handler_init();
batadv_iv_init();
@@ -76,7 +77,7 @@ static int __init batman_init(void)
return 0;
}
-static void __exit batman_exit(void)
+static void __exit batadv_exit(void)
{
batadv_debugfs_destroy();
unregister_netdevice_notifier(&batadv_hard_if_notifier);
@@ -189,8 +190,8 @@ int batadv_is_my_mac(const uint8_t *addr)
return 0;
}
-static int recv_unhandled_packet(struct sk_buff *skb,
- struct hard_iface *recv_if)
+static int batadv_recv_unhandled_packet(struct sk_buff *skb,
+ struct hard_iface *recv_if)
{
return NET_RX_DROP;
}
@@ -248,7 +249,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
* the supplied skb. if not, we have to free the skb.
*/
idx = batman_ogm_packet->header.packet_type;
- ret = (*recv_packet_handler[idx])(skb, hard_iface);
+ ret = (*batadv_rx_handler[idx])(skb, hard_iface);
if (ret == NET_RX_DROP)
kfree_skb(skb);
@@ -265,53 +266,53 @@ err_out:
return NET_RX_DROP;
}
-static void recv_handler_init(void)
+static void batadv_recv_handler_init(void)
{
int i;
- for (i = 0; i < ARRAY_SIZE(recv_packet_handler); i++)
- recv_packet_handler[i] = recv_unhandled_packet;
+ for (i = 0; i < ARRAY_SIZE(batadv_rx_handler); i++)
+ batadv_rx_handler[i] = batadv_recv_unhandled_packet;
/* batman icmp packet */
- recv_packet_handler[BAT_ICMP] = batadv_recv_icmp_packet;
+ batadv_rx_handler[BAT_ICMP] = batadv_recv_icmp_packet;
/* unicast with 4 addresses packet */
- recv_packet_handler[BAT_UNICAST_4ADDR] = batadv_recv_unicast_packet;
+ batadv_rx_handler[BAT_UNICAST_4ADDR] = batadv_recv_unicast_packet;
/* unicast packet */
- recv_packet_handler[BAT_UNICAST] = batadv_recv_unicast_packet;
+ batadv_rx_handler[BAT_UNICAST] = batadv_recv_unicast_packet;
/* fragmented unicast packet */
- recv_packet_handler[BAT_UNICAST_FRAG] = batadv_recv_ucast_frag_packet;
+ batadv_rx_handler[BAT_UNICAST_FRAG] = batadv_recv_ucast_frag_packet;
/* broadcast packet */
- recv_packet_handler[BAT_BCAST] = batadv_recv_bcast_packet;
+ batadv_rx_handler[BAT_BCAST] = batadv_recv_bcast_packet;
/* vis packet */
- recv_packet_handler[BAT_VIS] = batadv_recv_vis_packet;
+ batadv_rx_handler[BAT_VIS] = batadv_recv_vis_packet;
/* Translation table query (request or response) */
- recv_packet_handler[BAT_TT_QUERY] = batadv_recv_tt_query;
+ batadv_rx_handler[BAT_TT_QUERY] = batadv_recv_tt_query;
/* Roaming advertisement */
- recv_packet_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv;
+ batadv_rx_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv;
}
int batadv_recv_handler_register(uint8_t packet_type,
int (*recv_handler)(struct sk_buff *,
struct hard_iface *))
{
- if (recv_packet_handler[packet_type] != &recv_unhandled_packet)
+ if (batadv_rx_handler[packet_type] != &batadv_recv_unhandled_packet)
return -EBUSY;
- recv_packet_handler[packet_type] = recv_handler;
+ batadv_rx_handler[packet_type] = recv_handler;
return 0;
}
void batadv_recv_handler_unregister(uint8_t packet_type)
{
- recv_packet_handler[packet_type] = recv_unhandled_packet;
+ batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet;
}
-static struct bat_algo_ops *bat_algo_get(char *name)
+static struct bat_algo_ops *batadv_algo_get(char *name)
{
struct bat_algo_ops *bat_algo_ops = NULL, *bat_algo_ops_tmp;
struct hlist_node *node;
- hlist_for_each_entry(bat_algo_ops_tmp, node, &bat_algo_list, list) {
+ hlist_for_each_entry(bat_algo_ops_tmp, node, &batadv_algo_list, list) {
if (strcmp(bat_algo_ops_tmp->name, name) != 0)
continue;
@@ -327,7 +328,7 @@ int batadv_algo_register(struct bat_algo_ops *bat_algo_ops)
struct bat_algo_ops *bat_algo_ops_tmp;
int ret;
- bat_algo_ops_tmp = bat_algo_get(bat_algo_ops->name);
+ bat_algo_ops_tmp = batadv_algo_get(bat_algo_ops->name);
if (bat_algo_ops_tmp) {
pr_info("Trying to register already registered routing algorithm: %s\n",
bat_algo_ops->name);
@@ -349,7 +350,7 @@ int batadv_algo_register(struct bat_algo_ops *bat_algo_ops)
}
INIT_HLIST_NODE(&bat_algo_ops->list);
- hlist_add_head(&bat_algo_ops->list, &bat_algo_list);
+ hlist_add_head(&bat_algo_ops->list, &batadv_algo_list);
ret = 0;
out:
@@ -361,7 +362,7 @@ int batadv_algo_select(struct bat_priv *bat_priv, char *name)
struct bat_algo_ops *bat_algo_ops;
int ret = -EINVAL;
- bat_algo_ops = bat_algo_get(name);
+ bat_algo_ops = batadv_algo_get(name);
if (!bat_algo_ops)
goto out;
@@ -379,14 +380,14 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
seq_printf(seq, "Available routing algorithms:\n");
- hlist_for_each_entry(bat_algo_ops, node, &bat_algo_list, list) {
+ hlist_for_each_entry(bat_algo_ops, node, &batadv_algo_list, list) {
seq_printf(seq, "%s\n", bat_algo_ops->name);
}
return 0;
}
-static int param_set_ra(const char *val, const struct kernel_param *kp)
+static int batadv_param_set_ra(const char *val, const struct kernel_param *kp)
{
struct bat_algo_ops *bat_algo_ops;
char *algo_name = (char *)val;
@@ -395,7 +396,7 @@ static int param_set_ra(const char *val, const struct kernel_param *kp)
if (algo_name[name_len - 1] == '\n')
algo_name[name_len - 1] = '\0';
- bat_algo_ops = bat_algo_get(algo_name);
+ bat_algo_ops = batadv_algo_get(algo_name);
if (!bat_algo_ops) {
pr_err("Routing algorithm '%s' is not supported\n", algo_name);
return -EINVAL;
@@ -404,19 +405,20 @@ static int param_set_ra(const char *val, const struct kernel_param *kp)
return param_set_copystring(algo_name, kp);
}
-static const struct kernel_param_ops param_ops_ra = {
- .set = param_set_ra,
+static const struct kernel_param_ops batadv_param_ops_ra = {
+ .set = batadv_param_set_ra,
.get = param_get_string,
};
-static struct kparam_string __param_string_ra = {
+static struct kparam_string batadv_param_string_ra = {
.maxlen = sizeof(batadv_routing_algo),
.string = batadv_routing_algo,
};
-module_param_cb(routing_algo, ¶m_ops_ra, &__param_string_ra, 0644);
-module_init(batman_init);
-module_exit(batman_exit);
+module_param_cb(routing_algo, &batadv_param_ops_ra, &batadv_param_string_ra,
+ 0644);
+module_init(batadv_init);
+module_exit(batadv_exit);
MODULE_LICENSE("GPL");
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-175-ga371f80
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit a371f804652747cbf67f6712fc254684983bc40f
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:18 2012 +0200
batman-adv: Prefix vis local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/vis.c b/vis.c
index d45989e..607b101 100644
--- a/vis.c
+++ b/vis.c
@@ -28,10 +28,10 @@
#define MAX_VIS_PACKET_SIZE 1000
-static void start_vis_timer(struct bat_priv *bat_priv);
+static void batadv_start_vis_timer(struct bat_priv *bat_priv);
/* free the info */
-static void free_info(struct kref *ref)
+static void batadv_free_info(struct kref *ref)
{
struct vis_info *info = container_of(ref, struct vis_info, refcount);
struct bat_priv *bat_priv = info->bat_priv;
@@ -50,7 +50,7 @@ static void free_info(struct kref *ref)
}
/* Compare two vis packets, used by the hashing algorithm */
-static int vis_info_cmp(const struct hlist_node *node, const void *data2)
+static int batadv_vis_info_cmp(const struct hlist_node *node, const void *data2)
{
const struct vis_info *d1, *d2;
const struct vis_packet *p1, *p2;
@@ -65,7 +65,7 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2)
/* hash function to choose an entry in a hash table of given size
* hash algorithm from http://en.wikipedia.org/wiki/Hash_table
*/
-static uint32_t vis_info_choose(const void *data, uint32_t size)
+static uint32_t batadv_vis_info_choose(const void *data, uint32_t size)
{
const struct vis_info *vis_info = data;
const struct vis_packet *packet;
@@ -88,8 +88,8 @@ static uint32_t vis_info_choose(const void *data, uint32_t size)
return hash % size;
}
-static struct vis_info *vis_hash_find(struct bat_priv *bat_priv,
- const void *data)
+static struct vis_info *batadv_vis_hash_find(struct bat_priv *bat_priv,
+ const void *data)
{
struct hashtable_t *hash = bat_priv->vis_hash;
struct hlist_head *head;
@@ -100,12 +100,12 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv,
if (!hash)
return NULL;
- index = vis_info_choose(data, hash->size);
+ index = batadv_vis_info_choose(data, hash->size);
head = &hash->table[index];
rcu_read_lock();
hlist_for_each_entry_rcu(vis_info, node, head, hash_entry) {
- if (!vis_info_cmp(node, data))
+ if (!batadv_vis_info_cmp(node, data))
continue;
vis_info_tmp = vis_info;
@@ -119,9 +119,9 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv,
/* insert interface to the list of interfaces of one originator, if it
* does not already exist in the list
*/
-static void vis_data_insert_interface(const uint8_t *interface,
- struct hlist_head *if_list,
- bool primary)
+static void batadv_vis_data_insert_interface(const uint8_t *interface,
+ struct hlist_head *if_list,
+ bool primary)
{
struct if_list_entry *entry;
struct hlist_node *pos;
@@ -140,8 +140,7 @@ static void vis_data_insert_interface(const uint8_t *interface,
hlist_add_head(&entry->list, if_list);
}
-static ssize_t vis_data_read_prim_sec(char *buff,
- const struct hlist_head *if_list)
+static ssize_t batadv_vis_prim_sec(char *buff, const struct hlist_head *if_list)
{
struct if_list_entry *entry;
struct hlist_node *pos;
@@ -157,7 +156,7 @@ static ssize_t vis_data_read_prim_sec(char *buff,
return len;
}
-static size_t vis_data_count_prim_sec(struct hlist_head *if_list)
+static size_t batadv_vis_cnt_prim_sec(struct hlist_head *if_list)
{
struct if_list_entry *entry;
struct hlist_node *pos;
@@ -174,9 +173,9 @@ static size_t vis_data_count_prim_sec(struct hlist_head *if_list)
}
/* read an entry */
-static ssize_t vis_data_read_entry(char *buff,
- const struct vis_info_entry *entry,
- const uint8_t *src, bool primary)
+static ssize_t batadv_vis_data_read_entry(char *buff,
+ const struct vis_info_entry *entry,
+ const uint8_t *src, bool primary)
{
/* maximal length: max(4+17+2, 3+17+1+3+2) == 26 */
if (primary && entry->quality == 0)
@@ -227,8 +226,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
entries = (struct vis_info_entry *)
((char *)packet + sizeof(*packet));
- vis_data_insert_interface(packet->vis_orig,
- &vis_if_list, true);
+ batadv_vis_data_insert_interface(packet->vis_orig,
+ &vis_if_list, true);
for (j = 0; j < packet->entries; j++) {
if (entries[j].quality == 0)
@@ -236,9 +235,9 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
if (batadv_compare_eth(entries[j].src,
packet->vis_orig))
continue;
- vis_data_insert_interface(entries[j].src,
- &vis_if_list,
- false);
+ batadv_vis_data_insert_interface(entries[j].src,
+ &vis_if_list,
+ false);
}
hlist_for_each_entry(entry, pos, &vis_if_list, list) {
@@ -248,7 +247,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
if (batadv_compare_eth(entry->addr,
packet->vis_orig))
buf_size +=
- vis_data_count_prim_sec(&vis_if_list);
+ batadv_vis_cnt_prim_sec(&vis_if_list);
buf_size += 1;
}
@@ -280,8 +279,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
entries = (struct vis_info_entry *)
((char *)packet + sizeof(*packet));
- vis_data_insert_interface(packet->vis_orig,
- &vis_if_list, true);
+ batadv_vis_data_insert_interface(packet->vis_orig,
+ &vis_if_list, true);
for (j = 0; j < packet->entries; j++) {
if (entries[j].quality == 0)
@@ -289,9 +288,9 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
if (batadv_compare_eth(entries[j].src,
packet->vis_orig))
continue;
- vis_data_insert_interface(entries[j].src,
- &vis_if_list,
- false);
+ batadv_vis_data_insert_interface(entries[j].src,
+ &vis_if_list,
+ false);
}
hlist_for_each_entry(entry, pos, &vis_if_list, list) {
@@ -299,7 +298,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
entry->addr);
for (j = 0; j < packet->entries; j++)
- buff_pos += vis_data_read_entry(
+ buff_pos += batadv_vis_data_read_entry(
buff + buff_pos,
&entries[j],
entry->addr,
@@ -309,8 +308,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
if (batadv_compare_eth(entry->addr,
packet->vis_orig))
buff_pos +=
- vis_data_read_prim_sec(buff + buff_pos,
- &vis_if_list);
+ batadv_vis_prim_sec(buff + buff_pos,
+ &vis_if_list);
buff_pos += sprintf(buff + buff_pos, "\n");
}
@@ -338,7 +337,8 @@ out:
/* add the info packet to the send list, if it was not
* already linked in.
*/
-static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info)
+static void batadv_send_list_add(struct bat_priv *bat_priv,
+ struct vis_info *info)
{
if (list_empty(&info->send_list)) {
kref_get(&info->refcount);
@@ -349,17 +349,17 @@ static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info)
/* delete the info packet from the send list, if it was
* linked in.
*/
-static void send_list_del(struct vis_info *info)
+static void batadv_send_list_del(struct vis_info *info)
{
if (!list_empty(&info->send_list)) {
list_del_init(&info->send_list);
- kref_put(&info->refcount, free_info);
+ kref_put(&info->refcount, batadv_free_info);
}
}
/* tries to add one entry to the receive list. */
-static void recv_list_add(struct bat_priv *bat_priv,
- struct list_head *recv_list, const char *mac)
+static void batadv_recv_list_add(struct bat_priv *bat_priv,
+ struct list_head *recv_list, const char *mac)
{
struct recvlist_node *entry;
@@ -374,8 +374,9 @@ static void recv_list_add(struct bat_priv *bat_priv,
}
/* returns 1 if this mac is in the recv_list */
-static int recv_list_is_in(struct bat_priv *bat_priv,
- const struct list_head *recv_list, const char *mac)
+static int batadv_recv_list_is_in(struct bat_priv *bat_priv,
+ const struct list_head *recv_list,
+ const char *mac)
{
const struct recvlist_node *entry;
@@ -394,10 +395,10 @@ static int recv_list_is_in(struct bat_priv *bat_priv,
* broken.. ). vis hash must be locked outside. is_new is set when the packet
* is newer than old entries in the hash.
*/
-static struct vis_info *add_packet(struct bat_priv *bat_priv,
- struct vis_packet *vis_packet,
- int vis_info_len, int *is_new,
- int make_broadcast)
+static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv,
+ struct vis_packet *vis_packet,
+ int vis_info_len, int *is_new,
+ int make_broadcast)
{
struct vis_info *info, *old_info;
struct vis_packet *search_packet, *old_packet;
@@ -418,7 +419,7 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
sizeof(*search_packet));
memcpy(search_packet->vis_orig, vis_packet->vis_orig, ETH_ALEN);
- old_info = vis_hash_find(bat_priv, &search_elem);
+ old_info = batadv_vis_hash_find(bat_priv, &search_elem);
kfree_skb(search_elem.skb_packet);
if (old_info) {
@@ -426,8 +427,9 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
if (!seq_after(ntohl(vis_packet->seqno),
ntohl(old_packet->seqno))) {
if (old_packet->seqno == vis_packet->seqno) {
- recv_list_add(bat_priv, &old_info->recv_list,
- vis_packet->sender_orig);
+ batadv_recv_list_add(bat_priv,
+ &old_info->recv_list,
+ vis_packet->sender_orig);
return old_info;
} else {
/* newer packet is already in hash. */
@@ -435,10 +437,10 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
}
}
/* remove old entry */
- batadv_hash_remove(bat_priv->vis_hash, vis_info_cmp,
- vis_info_choose, old_info);
- send_list_del(old_info);
- kref_put(&old_info->refcount, free_info);
+ batadv_hash_remove(bat_priv->vis_hash, batadv_vis_info_cmp,
+ batadv_vis_info_choose, old_info);
+ batadv_send_list_del(old_info);
+ kref_put(&old_info->refcount, batadv_free_info);
}
info = kmalloc(sizeof(*info), GFP_ATOMIC);
@@ -473,14 +475,15 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
if (packet->entries * sizeof(struct vis_info_entry) > vis_info_len)
packet->entries = vis_info_len / sizeof(struct vis_info_entry);
- recv_list_add(bat_priv, &info->recv_list, packet->sender_orig);
+ batadv_recv_list_add(bat_priv, &info->recv_list, packet->sender_orig);
/* try to add it */
- hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
- vis_info_choose, info, &info->hash_entry);
+ hash_added = batadv_hash_add(bat_priv->vis_hash, batadv_vis_info_cmp,
+ batadv_vis_info_choose, info,
+ &info->hash_entry);
if (hash_added != 0) {
/* did not work (for some reason) */
- kref_put(&info->refcount, free_info);
+ kref_put(&info->refcount, batadv_free_info);
info = NULL;
}
@@ -499,8 +502,8 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
make_broadcast = (vis_server == VIS_TYPE_SERVER_SYNC);
spin_lock_bh(&bat_priv->vis_hash_lock);
- info = add_packet(bat_priv, vis_packet, vis_info_len,
- &is_new, make_broadcast);
+ info = batadv_add_packet(bat_priv, vis_packet, vis_info_len,
+ &is_new, make_broadcast);
if (!info)
goto end;
@@ -508,7 +511,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
* hash.
*/
if (vis_server == VIS_TYPE_SERVER_SYNC && is_new)
- send_list_add(bat_priv, info);
+ batadv_send_list_add(bat_priv, info);
end:
spin_unlock_bh(&bat_priv->vis_hash_lock);
}
@@ -534,8 +537,8 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
are_target = 1;
spin_lock_bh(&bat_priv->vis_hash_lock);
- info = add_packet(bat_priv, vis_packet, vis_info_len,
- &is_new, are_target);
+ info = batadv_add_packet(bat_priv, vis_packet, vis_info_len,
+ &is_new, are_target);
if (!info)
goto end;
@@ -546,11 +549,11 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
/* send only if we're the target server or ... */
if (are_target && is_new) {
packet->vis_type = VIS_TYPE_SERVER_SYNC; /* upgrade! */
- send_list_add(bat_priv, info);
+ batadv_send_list_add(bat_priv, info);
/* ... we're not the recipient (and thus need to forward). */
} else if (!batadv_is_my_mac(packet->target_orig)) {
- send_list_add(bat_priv, info);
+ batadv_send_list_add(bat_priv, info);
}
end:
@@ -562,8 +565,8 @@ end:
*
* Must be called with the originator hash locked
*/
-static int find_best_vis_server(struct bat_priv *bat_priv,
- struct vis_info *info)
+static int batadv_find_best_vis_server(struct bat_priv *bat_priv,
+ struct vis_info *info)
{
struct hashtable_t *hash = bat_priv->orig_hash;
struct neigh_node *router;
@@ -600,7 +603,7 @@ static int find_best_vis_server(struct bat_priv *bat_priv,
}
/* Return true if the vis packet is full. */
-static bool vis_packet_full(const struct vis_info *info)
+static bool batadv_vis_packet_full(const struct vis_info *info)
{
const struct vis_packet *packet;
packet = (struct vis_packet *)info->skb_packet->data;
@@ -614,7 +617,7 @@ static bool vis_packet_full(const struct vis_info *info)
/* generates a packet of own vis data,
* returns 0 on success, -1 if no packet could be generated
*/
-static int generate_vis_packet(struct bat_priv *bat_priv)
+static int batadv_generate_vis_packet(struct bat_priv *bat_priv)
{
struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_node *node;
@@ -638,7 +641,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
skb_trim(info->skb_packet, sizeof(*packet));
if (packet->vis_type == VIS_TYPE_CLIENT_UPDATE) {
- best_tq = find_best_vis_server(bat_priv, info);
+ best_tq = batadv_find_best_vis_server(bat_priv, info);
if (best_tq < 0)
return best_tq;
@@ -675,7 +678,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
next:
batadv_neigh_node_free_ref(router);
- if (vis_packet_full(info))
+ if (batadv_vis_packet_full(info))
goto unlock;
}
rcu_read_unlock();
@@ -697,7 +700,7 @@ next:
entry->quality = 0; /* 0 means TT */
packet->entries++;
- if (vis_packet_full(info))
+ if (batadv_vis_packet_full(info))
goto unlock;
}
rcu_read_unlock();
@@ -713,7 +716,7 @@ unlock:
/* free old vis packets. Must be called with this vis_hash_lock
* held
*/
-static void purge_vis_packets(struct bat_priv *bat_priv)
+static void batadv_purge_vis_packets(struct bat_priv *bat_priv)
{
uint32_t i;
struct hashtable_t *hash = bat_priv->vis_hash;
@@ -733,15 +736,15 @@ static void purge_vis_packets(struct bat_priv *bat_priv)
if (batadv_has_timed_out(info->first_seen,
VIS_TIMEOUT)) {
hlist_del(node);
- send_list_del(info);
- kref_put(&info->refcount, free_info);
+ batadv_send_list_del(info);
+ kref_put(&info->refcount, batadv_free_info);
}
}
}
}
-static void broadcast_vis_packet(struct bat_priv *bat_priv,
- struct vis_info *info)
+static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv,
+ struct vis_info *info)
{
struct neigh_node *router;
struct hashtable_t *hash = bat_priv->orig_hash;
@@ -774,8 +777,8 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,
/* don't send it if we already received the packet from
* this node.
*/
- if (recv_list_is_in(bat_priv, &info->recv_list,
- orig_node->orig)) {
+ if (batadv_recv_list_is_in(bat_priv, &info->recv_list,
+ orig_node->orig)) {
batadv_neigh_node_free_ref(router);
continue;
}
@@ -796,8 +799,8 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,
}
}
-static void unicast_vis_packet(struct bat_priv *bat_priv,
- struct vis_info *info)
+static void batadv_unicast_vis_packet(struct bat_priv *bat_priv,
+ struct vis_info *info)
{
struct orig_node *orig_node;
struct neigh_node *router = NULL;
@@ -825,8 +828,9 @@ out:
batadv_orig_node_free_ref(orig_node);
}
-/* only send one vis packet. called from send_vis_packets() */
-static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
+/* only send one vis packet. called from batadv_send_vis_packets() */
+static void batadv_send_vis_packet(struct bat_priv *bat_priv,
+ struct vis_info *info)
{
struct hard_iface *primary_if;
struct vis_packet *packet;
@@ -845,9 +849,9 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
packet->header.ttl--;
if (is_broadcast_ether_addr(packet->target_orig))
- broadcast_vis_packet(bat_priv, info);
+ batadv_broadcast_vis_packet(bat_priv, info);
else
- unicast_vis_packet(bat_priv, info);
+ batadv_unicast_vis_packet(bat_priv, info);
packet->header.ttl++; /* restore TTL */
out:
@@ -856,7 +860,7 @@ out:
}
/* called from timer; send (and maybe generate) vis packet. */
-static void send_vis_packets(struct work_struct *work)
+static void batadv_send_vis_packets(struct work_struct *work)
{
struct delayed_work *delayed_work =
container_of(work, struct delayed_work, work);
@@ -865,11 +869,11 @@ static void send_vis_packets(struct work_struct *work)
struct vis_info *info;
spin_lock_bh(&bat_priv->vis_hash_lock);
- purge_vis_packets(bat_priv);
+ batadv_purge_vis_packets(bat_priv);
- if (generate_vis_packet(bat_priv) == 0) {
+ if (batadv_generate_vis_packet(bat_priv) == 0) {
/* schedule if generation was successful */
- send_list_add(bat_priv, bat_priv->my_vis_info);
+ batadv_send_list_add(bat_priv, bat_priv->my_vis_info);
}
while (!list_empty(&bat_priv->vis_send_list)) {
@@ -879,14 +883,14 @@ static void send_vis_packets(struct work_struct *work)
kref_get(&info->refcount);
spin_unlock_bh(&bat_priv->vis_hash_lock);
- send_vis_packet(bat_priv, info);
+ batadv_send_vis_packet(bat_priv, info);
spin_lock_bh(&bat_priv->vis_hash_lock);
- send_list_del(info);
- kref_put(&info->refcount, free_info);
+ batadv_send_list_del(info);
+ kref_put(&info->refcount, batadv_free_info);
}
spin_unlock_bh(&bat_priv->vis_hash_lock);
- start_vis_timer(bat_priv);
+ batadv_start_vis_timer(bat_priv);
}
/* init the vis server. this may only be called when if_list is already
@@ -937,18 +941,19 @@ int batadv_vis_init(struct bat_priv *bat_priv)
INIT_LIST_HEAD(&bat_priv->vis_send_list);
- hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
- vis_info_choose, bat_priv->my_vis_info,
+ hash_added = batadv_hash_add(bat_priv->vis_hash, batadv_vis_info_cmp,
+ batadv_vis_info_choose,
+ bat_priv->my_vis_info,
&bat_priv->my_vis_info->hash_entry);
if (hash_added != 0) {
pr_err("Can't add own vis packet into hash\n");
/* not in hash, need to remove it manually. */
- kref_put(&bat_priv->my_vis_info->refcount, free_info);
+ kref_put(&bat_priv->my_vis_info->refcount, batadv_free_info);
goto err;
}
spin_unlock_bh(&bat_priv->vis_hash_lock);
- start_vis_timer(bat_priv);
+ batadv_start_vis_timer(bat_priv);
return 0;
free_info:
@@ -961,13 +966,13 @@ err:
}
/* Decrease the reference count on a hash item info */
-static void free_info_ref(struct hlist_node *node, void *arg)
+static void batadv_free_info_ref(struct hlist_node *node, void *arg)
{
struct vis_info *info;
info = container_of(node, struct vis_info, hash_entry);
- send_list_del(info);
- kref_put(&info->refcount, free_info);
+ batadv_send_list_del(info);
+ kref_put(&info->refcount, batadv_free_info);
}
/* shutdown vis-server */
@@ -980,16 +985,16 @@ void batadv_vis_quit(struct bat_priv *bat_priv)
spin_lock_bh(&bat_priv->vis_hash_lock);
/* properly remove, kill timers ... */
- batadv_hash_delete(bat_priv->vis_hash, free_info_ref, NULL);
+ batadv_hash_delete(bat_priv->vis_hash, batadv_free_info_ref, NULL);
bat_priv->vis_hash = NULL;
bat_priv->my_vis_info = NULL;
spin_unlock_bh(&bat_priv->vis_hash_lock);
}
/* schedule packets for (re)transmission */
-static void start_vis_timer(struct bat_priv *bat_priv)
+static void batadv_start_vis_timer(struct bat_priv *bat_priv)
{
- INIT_DELAYED_WORK(&bat_priv->vis_work, send_vis_packets);
+ INIT_DELAYED_WORK(&bat_priv->vis_work, batadv_send_vis_packets);
queue_delayed_work(batadv_event_workqueue, &bat_priv->vis_work,
msecs_to_jiffies(VIS_INTERVAL));
}
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-174-gd8b7635
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit d8b763533449cef443267977dcbbb44741477207
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:17 2012 +0200
batman-adv: Prefix unicast local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/unicast.c b/unicast.c
index d5efa40..bc2f897 100644
--- a/unicast.c
+++ b/unicast.c
@@ -29,9 +29,10 @@
#include "hard-interface.h"
-static struct sk_buff *frag_merge_packet(struct list_head *head,
- struct frag_packet_list_entry *tfp,
- struct sk_buff *skb)
+static struct sk_buff *
+batadv_frag_merge_packet(struct list_head *head,
+ struct frag_packet_list_entry *tfp,
+ struct sk_buff *skb)
{
struct unicast_frag_packet *up =
(struct unicast_frag_packet *)skb->data;
@@ -75,7 +76,8 @@ err:
return NULL;
}
-static void frag_create_entry(struct list_head *head, struct sk_buff *skb)
+static void batadv_frag_create_entry(struct list_head *head,
+ struct sk_buff *skb)
{
struct frag_packet_list_entry *tfp;
struct unicast_frag_packet *up =
@@ -91,7 +93,7 @@ static void frag_create_entry(struct list_head *head, struct sk_buff *skb)
return;
}
-static int frag_create_buffer(struct list_head *head)
+static int batadv_frag_create_buffer(struct list_head *head)
{
int i;
struct frag_packet_list_entry *tfp;
@@ -111,8 +113,9 @@ static int frag_create_buffer(struct list_head *head)
return 0;
}
-static struct frag_packet_list_entry *frag_search_packet(struct list_head *head,
- const struct unicast_frag_packet *up)
+static struct frag_packet_list_entry *
+batadv_frag_search_packet(struct list_head *head,
+ const struct unicast_frag_packet *up)
{
struct frag_packet_list_entry *tfp;
struct unicast_frag_packet *tmp_up = NULL;
@@ -188,22 +191,22 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
orig_node->last_frag_packet = jiffies;
if (list_empty(&orig_node->frag_list) &&
- frag_create_buffer(&orig_node->frag_list)) {
+ batadv_frag_create_buffer(&orig_node->frag_list)) {
pr_debug("couldn't create frag buffer\n");
goto out;
}
- tmp_frag_entry = frag_search_packet(&orig_node->frag_list,
- unicast_packet);
+ tmp_frag_entry = batadv_frag_search_packet(&orig_node->frag_list,
+ unicast_packet);
if (!tmp_frag_entry) {
- frag_create_entry(&orig_node->frag_list, skb);
+ batadv_frag_create_entry(&orig_node->frag_list, skb);
ret = NET_RX_SUCCESS;
goto out;
}
- *new_skb = frag_merge_packet(&orig_node->frag_list, tmp_frag_entry,
- skb);
+ *new_skb = batadv_frag_merge_packet(&orig_node->frag_list,
+ tmp_frag_entry, skb);
/* if not, merge failed */
if (*new_skb)
ret = NET_RX_SUCCESS;
@@ -281,8 +284,8 @@ out:
return ret;
}
-static bool pull_and_fill_unicast(struct sk_buff *skb, int hdr_size,
- struct orig_node *orig_node)
+static bool batadv_pull_and_fill_unicast(struct sk_buff *skb, int hdr_size,
+ struct orig_node *orig_node)
{
struct unicast_packet *unicast_packet;
@@ -304,11 +307,11 @@ static bool pull_and_fill_unicast(struct sk_buff *skb, int hdr_size,
return true;
}
-static bool prepare_unicast_packet(struct sk_buff *skb,
- struct orig_node *orig_node)
+static bool batadv_prepare_unicast_packet(struct sk_buff *skb,
+ struct orig_node *orig_node)
{
- return pull_and_fill_unicast(skb, sizeof(struct unicast_packet),
- orig_node);
+ return batadv_pull_and_fill_unicast(skb, sizeof(struct unicast_packet),
+ orig_node);
}
bool batadv_prepare_unicast_4addr_packet(struct bat_priv *bat_priv,
@@ -328,8 +331,8 @@ bool batadv_prepare_unicast_4addr_packet(struct bat_priv *bat_priv,
* We can do that because the first member of the unicast_4addr_packet
* is of type struct unicast_packet
*/
- if (!pull_and_fill_unicast(skb, sizeof(*unicast_4addr_packet),
- orig_node))
+ if (!batadv_pull_and_fill_unicast(skb, sizeof(*unicast_4addr_packet),
+ orig_node))
goto out;
unicast_4addr_packet = (struct unicast_4addr_packet *)skb->data;
@@ -379,7 +382,7 @@ find_router:
switch (packet_type) {
case BAT_UNICAST:
- prepare_unicast_packet(skb, orig_node);
+ batadv_prepare_unicast_packet(skb, orig_node);
break;
case BAT_UNICAST_4ADDR:
batadv_prepare_unicast_4addr_packet(bat_priv, skb, orig_node,
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-173-g0114926
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 0114926f0d99e69671e08d7f31935b6fc74dcfd8
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:16 2012 +0200
batman-adv: Prefix translation-table local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/translation-table.c b/translation-table.c
index 84b2b91..f50e795 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -29,13 +29,14 @@
#include <linux/crc16.h>
-static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
- struct orig_node *orig_node);
-static void tt_purge(struct work_struct *work);
-static void tt_global_del_orig_list(struct tt_global_entry *tt_global_entry);
+static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
+ struct orig_node *orig_node);
+static void batadv_tt_purge(struct work_struct *work);
+static void
+batadv_tt_global_del_orig_list(struct tt_global_entry *tt_global_entry);
/* returns 1 if they are the same mac addr */
-static int compare_tt(const struct hlist_node *node, const void *data2)
+static int batadv_compare_tt(const struct hlist_node *node, const void *data2)
{
const void *data1 = container_of(node, struct tt_common_entry,
hash_entry);
@@ -43,15 +44,15 @@ static int compare_tt(const struct hlist_node *node, const void *data2)
return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
}
-static void tt_start_timer(struct bat_priv *bat_priv)
+static void batadv_tt_start_timer(struct bat_priv *bat_priv)
{
- INIT_DELAYED_WORK(&bat_priv->tt_work, tt_purge);
+ INIT_DELAYED_WORK(&bat_priv->tt_work, batadv_tt_purge);
queue_delayed_work(batadv_event_workqueue, &bat_priv->tt_work,
msecs_to_jiffies(5000));
}
-static struct tt_common_entry *tt_hash_find(struct hashtable_t *hash,
- const void *data)
+static struct tt_common_entry *batadv_tt_hash_find(struct hashtable_t *hash,
+ const void *data)
{
struct hlist_head *head;
struct hlist_node *node;
@@ -80,26 +81,26 @@ static struct tt_common_entry *tt_hash_find(struct hashtable_t *hash,
return tt_common_entry_tmp;
}
-static struct tt_local_entry *tt_local_hash_find(struct bat_priv *bat_priv,
- const void *data)
+static struct tt_local_entry *
+batadv_tt_local_hash_find(struct bat_priv *bat_priv, const void *data)
{
struct tt_common_entry *tt_common_entry;
struct tt_local_entry *tt_local_entry = NULL;
- tt_common_entry = tt_hash_find(bat_priv->tt_local_hash, data);
+ tt_common_entry = batadv_tt_hash_find(bat_priv->tt_local_hash, data);
if (tt_common_entry)
tt_local_entry = container_of(tt_common_entry,
struct tt_local_entry, common);
return tt_local_entry;
}
-static struct tt_global_entry *tt_global_hash_find(struct bat_priv *bat_priv,
- const void *data)
+static struct tt_global_entry *
+batadv_tt_global_hash_find(struct bat_priv *bat_priv, const void *data)
{
struct tt_common_entry *tt_common_entry;
struct tt_global_entry *tt_global_entry = NULL;
- tt_common_entry = tt_hash_find(bat_priv->tt_global_hash, data);
+ tt_common_entry = batadv_tt_hash_find(bat_priv->tt_global_hash, data);
if (tt_common_entry)
tt_global_entry = container_of(tt_common_entry,
struct tt_global_entry, common);
@@ -107,13 +108,14 @@ static struct tt_global_entry *tt_global_hash_find(struct bat_priv *bat_priv,
}
-static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
+static void
+batadv_tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
{
if (atomic_dec_and_test(&tt_local_entry->common.refcount))
kfree_rcu(tt_local_entry, common.rcu);
}
-static void tt_global_entry_free_rcu(struct rcu_head *rcu)
+static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu)
{
struct tt_common_entry *tt_common_entry;
struct tt_global_entry *tt_global_entry;
@@ -125,16 +127,17 @@ static void tt_global_entry_free_rcu(struct rcu_head *rcu)
kfree(tt_global_entry);
}
-static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
+static void
+batadv_tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
{
if (atomic_dec_and_test(&tt_global_entry->common.refcount)) {
- tt_global_del_orig_list(tt_global_entry);
+ batadv_tt_global_del_orig_list(tt_global_entry);
call_rcu(&tt_global_entry->common.rcu,
- tt_global_entry_free_rcu);
+ batadv_tt_global_entry_free_rcu);
}
}
-static void tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
+static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
{
struct tt_orig_list_entry *orig_entry;
@@ -144,13 +147,14 @@ static void tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
kfree(orig_entry);
}
-static void tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry)
+static void
+batadv_tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry)
{
- call_rcu(&orig_entry->rcu, tt_orig_list_entry_free_rcu);
+ call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
}
-static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
- uint8_t flags)
+static void batadv_tt_local_event(struct bat_priv *bat_priv,
+ const uint8_t *addr, uint8_t flags)
{
struct tt_change_node *tt_change_node;
@@ -176,7 +180,7 @@ int batadv_tt_len(int changes_num)
return changes_num * sizeof(struct tt_change);
}
-static int tt_local_init(struct bat_priv *bat_priv)
+static int batadv_tt_local_init(struct bat_priv *bat_priv)
{
if (bat_priv->tt_local_hash)
return 0;
@@ -200,7 +204,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
struct tt_orig_list_entry *orig_entry;
int hash_added;
- tt_local_entry = tt_local_hash_find(bat_priv, addr);
+ tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr);
if (tt_local_entry) {
tt_local_entry->last_seen = jiffies;
@@ -234,21 +238,21 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
*/
tt_local_entry->common.flags |= TT_CLIENT_NEW;
- hash_added = batadv_hash_add(bat_priv->tt_local_hash, compare_tt,
+ hash_added = batadv_hash_add(bat_priv->tt_local_hash, batadv_compare_tt,
batadv_choose_orig,
&tt_local_entry->common,
&tt_local_entry->common.hash_entry);
if (unlikely(hash_added != 0)) {
/* remove the reference for the hash */
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
goto out;
}
- tt_local_event(bat_priv, addr, tt_local_entry->common.flags);
+ batadv_tt_local_event(bat_priv, addr, tt_local_entry->common.flags);
/* remove address from global hash if present */
- tt_global_entry = tt_global_hash_find(bat_priv, addr);
+ tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr);
/* Check whether it is a roaming! */
if (tt_global_entry) {
@@ -258,8 +262,9 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
hlist_for_each_entry_rcu(orig_entry, node, head, list) {
orig_entry->orig_node->tt_poss_change = true;
- send_roam_adv(bat_priv, tt_global_entry->common.addr,
- orig_entry->orig_node);
+ batadv_send_roam_adv(bat_priv,
+ tt_global_entry->common.addr,
+ orig_entry->orig_node);
}
rcu_read_unlock();
/* The global entry has to be marked as ROAMING and
@@ -270,14 +275,15 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
}
out:
if (tt_local_entry)
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
if (tt_global_entry)
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
}
-static void tt_realloc_packet_buff(unsigned char **packet_buff,
- int *packet_buff_len, int min_packet_len,
- int new_packet_len)
+static void batadv_tt_realloc_packet_buff(unsigned char **packet_buff,
+ int *packet_buff_len,
+ int min_packet_len,
+ int new_packet_len)
{
unsigned char *new_buff;
@@ -292,9 +298,10 @@ static void tt_realloc_packet_buff(unsigned char **packet_buff,
}
}
-static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
- unsigned char **packet_buff,
- int *packet_buff_len, int min_packet_len)
+static void batadv_tt_prepare_packet_buff(struct bat_priv *bat_priv,
+ unsigned char **packet_buff,
+ int *packet_buff_len,
+ int min_packet_len)
{
struct hard_iface *primary_if;
int req_len;
@@ -310,23 +317,24 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
if ((!primary_if) || (req_len > primary_if->soft_iface->mtu))
req_len = min_packet_len;
- tt_realloc_packet_buff(packet_buff, packet_buff_len,
- min_packet_len, req_len);
+ batadv_tt_realloc_packet_buff(packet_buff, packet_buff_len,
+ min_packet_len, req_len);
if (primary_if)
batadv_hardif_free_ref(primary_if);
}
-static int tt_changes_fill_buff(struct bat_priv *bat_priv,
- unsigned char **packet_buff,
- int *packet_buff_len, int min_packet_len)
+static int batadv_tt_changes_fill_buff(struct bat_priv *bat_priv,
+ unsigned char **packet_buff,
+ int *packet_buff_len,
+ int min_packet_len)
{
struct tt_change_node *entry, *safe;
int count = 0, tot_changes = 0, new_len;
unsigned char *tt_buff;
- tt_prepare_packet_buff(bat_priv, packet_buff,
- packet_buff_len, min_packet_len);
+ batadv_tt_prepare_packet_buff(bat_priv, packet_buff,
+ packet_buff_len, min_packet_len);
new_len = *packet_buff_len - min_packet_len;
tt_buff = *packet_buff + min_packet_len;
@@ -428,12 +436,12 @@ out:
return ret;
}
-static void tt_local_set_pending(struct bat_priv *bat_priv,
- struct tt_local_entry *tt_local_entry,
- uint16_t flags, const char *message)
+static void batadv_tt_local_set_pending(struct bat_priv *bat_priv,
+ struct tt_local_entry *tt_local_entry,
+ uint16_t flags, const char *message)
{
- tt_local_event(bat_priv, tt_local_entry->common.addr,
- tt_local_entry->common.flags | flags);
+ batadv_tt_local_event(bat_priv, tt_local_entry->common.addr,
+ tt_local_entry->common.flags | flags);
/* The local client has to be marked as "pending to be removed" but has
* to be kept in the table in order to send it in a full table
@@ -451,18 +459,19 @@ void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
{
struct tt_local_entry *tt_local_entry = NULL;
- tt_local_entry = tt_local_hash_find(bat_priv, addr);
+ tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr);
if (!tt_local_entry)
goto out;
- tt_local_set_pending(bat_priv, tt_local_entry, TT_CLIENT_DEL |
- (roaming ? TT_CLIENT_ROAM : NO_FLAGS), message);
+ batadv_tt_local_set_pending(bat_priv, tt_local_entry, TT_CLIENT_DEL |
+ (roaming ? TT_CLIENT_ROAM : NO_FLAGS),
+ message);
out:
if (tt_local_entry)
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
}
-static void tt_local_purge(struct bat_priv *bat_priv)
+static void batadv_tt_local_purge(struct bat_priv *bat_priv)
{
struct hashtable_t *hash = bat_priv->tt_local_hash;
struct tt_local_entry *tt_local_entry;
@@ -493,15 +502,15 @@ static void tt_local_purge(struct bat_priv *bat_priv)
TT_LOCAL_TIMEOUT))
continue;
- tt_local_set_pending(bat_priv, tt_local_entry,
- TT_CLIENT_DEL, "timed out");
+ batadv_tt_local_set_pending(bat_priv, tt_local_entry,
+ TT_CLIENT_DEL, "timed out");
}
spin_unlock_bh(list_lock);
}
}
-static void tt_local_table_free(struct bat_priv *bat_priv)
+static void batadv_tt_local_table_free(struct bat_priv *bat_priv)
{
struct hashtable_t *hash;
spinlock_t *list_lock; /* protects write access to the hash lists */
@@ -527,7 +536,7 @@ static void tt_local_table_free(struct bat_priv *bat_priv)
tt_local_entry = container_of(tt_common_entry,
struct tt_local_entry,
common);
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
}
spin_unlock_bh(list_lock);
}
@@ -537,7 +546,7 @@ static void tt_local_table_free(struct bat_priv *bat_priv)
bat_priv->tt_local_hash = NULL;
}
-static int tt_global_init(struct bat_priv *bat_priv)
+static int batadv_tt_global_init(struct bat_priv *bat_priv)
{
if (bat_priv->tt_global_hash)
return 0;
@@ -550,7 +559,7 @@ static int tt_global_init(struct bat_priv *bat_priv)
return 0;
}
-static void tt_changes_list_free(struct bat_priv *bat_priv)
+static void batadv_tt_changes_list_free(struct bat_priv *bat_priv)
{
struct tt_change_node *entry, *safe;
@@ -569,8 +578,8 @@ static void tt_changes_list_free(struct bat_priv *bat_priv)
/* find out if an orig_node is already in the list of a tt_global_entry.
* returns 1 if found, 0 otherwise
*/
-static bool tt_global_entry_has_orig(const struct tt_global_entry *entry,
- const struct orig_node *orig_node)
+static bool batadv_tt_global_entry_has_orig(const struct tt_global_entry *entry,
+ const struct orig_node *orig_node)
{
struct tt_orig_list_entry *tmp_orig_entry;
const struct hlist_head *head;
@@ -589,9 +598,9 @@ static bool tt_global_entry_has_orig(const struct tt_global_entry *entry,
return found;
}
-static void tt_global_add_orig_entry(struct tt_global_entry *tt_global_entry,
- struct orig_node *orig_node,
- int ttvn)
+static void
+batadv_tt_global_add_orig_entry(struct tt_global_entry *tt_global_entry,
+ struct orig_node *orig_node, int ttvn)
{
struct tt_orig_list_entry *orig_entry;
@@ -621,7 +630,7 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
int hash_added;
struct tt_common_entry *common;
- tt_global_entry = tt_global_hash_find(bat_priv, tt_addr);
+ tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr);
if (!tt_global_entry) {
tt_global_entry = kzalloc(sizeof(*tt_global_entry),
@@ -640,16 +649,18 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
spin_lock_init(&tt_global_entry->list_lock);
hash_added = batadv_hash_add(bat_priv->tt_global_hash,
- compare_tt, batadv_choose_orig,
- common, &common->hash_entry);
+ batadv_compare_tt,
+ batadv_choose_orig, common,
+ &common->hash_entry);
if (unlikely(hash_added != 0)) {
/* remove the reference for the hash */
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
goto out_remove;
}
- tt_global_add_orig_entry(tt_global_entry, orig_node, ttvn);
+ batadv_tt_global_add_orig_entry(tt_global_entry, orig_node,
+ ttvn);
} else {
/* there is already a global entry, use this one. */
@@ -661,14 +672,15 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
* new one.
*/
if (tt_global_entry->common.flags & TT_CLIENT_ROAM) {
- tt_global_del_orig_list(tt_global_entry);
+ batadv_tt_global_del_orig_list(tt_global_entry);
tt_global_entry->common.flags &= ~TT_CLIENT_ROAM;
tt_global_entry->roam_at = 0;
}
- if (!tt_global_entry_has_orig(tt_global_entry, orig_node))
- tt_global_add_orig_entry(tt_global_entry, orig_node,
- ttvn);
+ if (!batadv_tt_global_entry_has_orig(tt_global_entry,
+ orig_node))
+ batadv_tt_global_add_orig_entry(tt_global_entry,
+ orig_node, ttvn);
}
if (wifi)
@@ -685,15 +697,16 @@ out_remove:
ret = 1;
out:
if (tt_global_entry)
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
return ret;
}
/* print all orig nodes who announce the address for this global entry.
* it is assumed that the caller holds rcu_read_lock();
*/
-static void tt_global_print_entry(struct tt_global_entry *tt_global_entry,
- struct seq_file *seq)
+static void
+batadv_tt_global_print_entry(struct tt_global_entry *tt_global_entry,
+ struct seq_file *seq)
{
struct hlist_head *head;
struct hlist_node *node;
@@ -760,7 +773,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
tt_global_entry = container_of(tt_common_entry,
struct tt_global_entry,
common);
- tt_global_print_entry(tt_global_entry, seq);
+ batadv_tt_global_print_entry(tt_global_entry, seq);
}
rcu_read_unlock();
}
@@ -771,7 +784,8 @@ out:
}
/* deletes the orig list of a tt_global_entry */
-static void tt_global_del_orig_list(struct tt_global_entry *tt_global_entry)
+static void
+batadv_tt_global_del_orig_list(struct tt_global_entry *tt_global_entry)
{
struct hlist_head *head;
struct hlist_node *node, *safe;
@@ -781,16 +795,17 @@ static void tt_global_del_orig_list(struct tt_global_entry *tt_global_entry)
head = &tt_global_entry->orig_list;
hlist_for_each_entry_safe(orig_entry, node, safe, head, list) {
hlist_del_rcu(node);
- tt_orig_list_entry_free_ref(orig_entry);
+ batadv_tt_orig_list_entry_free_ref(orig_entry);
}
spin_unlock_bh(&tt_global_entry->list_lock);
}
-static void tt_global_del_orig_entry(struct bat_priv *bat_priv,
- struct tt_global_entry *tt_global_entry,
- struct orig_node *orig_node,
- const char *message)
+static void
+batadv_tt_global_del_orig_entry(struct bat_priv *bat_priv,
+ struct tt_global_entry *tt_global_entry,
+ struct orig_node *orig_node,
+ const char *message)
{
struct hlist_head *head;
struct hlist_node *node, *safe;
@@ -805,22 +820,22 @@ static void tt_global_del_orig_entry(struct bat_priv *bat_priv,
orig_node->orig,
tt_global_entry->common.addr, message);
hlist_del_rcu(node);
- tt_orig_list_entry_free_ref(orig_entry);
+ batadv_tt_orig_list_entry_free_ref(orig_entry);
}
}
spin_unlock_bh(&tt_global_entry->list_lock);
}
-static void tt_global_del_struct(struct bat_priv *bat_priv,
- struct tt_global_entry *tt_global_entry,
- const char *message)
+static void batadv_tt_global_del_struct(struct bat_priv *bat_priv,
+ struct tt_global_entry *tt_global_entry,
+ const char *message)
{
batadv_dbg(DBG_TT, bat_priv, "Deleting global tt entry %pM: %s\n",
tt_global_entry->common.addr, message);
- batadv_hash_remove(bat_priv->tt_global_hash, compare_tt,
+ batadv_hash_remove(bat_priv->tt_global_hash, batadv_compare_tt,
batadv_choose_orig, tt_global_entry->common.addr);
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
}
@@ -828,10 +843,10 @@ static void tt_global_del_struct(struct bat_priv *bat_priv,
* within tt_global entry. If yes, we set the TT_CLIENT_ROAM flag and the timer,
* otherwise we simply remove the originator scheduled for deletion.
*/
-static void tt_global_del_roaming(struct bat_priv *bat_priv,
- struct tt_global_entry *tt_global_entry,
- struct orig_node *orig_node,
- const char *message)
+static void
+batadv_tt_global_del_roaming(struct bat_priv *bat_priv,
+ struct tt_global_entry *tt_global_entry,
+ struct orig_node *orig_node, const char *message)
{
bool last_entry = true;
struct hlist_head *head;
@@ -860,31 +875,31 @@ static void tt_global_del_roaming(struct bat_priv *bat_priv,
/* there is another entry, we can simply delete this
* one and can still use the other one.
*/
- tt_global_del_orig_entry(bat_priv, tt_global_entry,
- orig_node, message);
+ batadv_tt_global_del_orig_entry(bat_priv, tt_global_entry,
+ orig_node, message);
}
-static void tt_global_del(struct bat_priv *bat_priv,
- struct orig_node *orig_node,
- const unsigned char *addr,
- const char *message, bool roaming)
+static void batadv_tt_global_del(struct bat_priv *bat_priv,
+ struct orig_node *orig_node,
+ const unsigned char *addr,
+ const char *message, bool roaming)
{
struct tt_global_entry *tt_global_entry = NULL;
- struct tt_local_entry *tt_local_entry = NULL;
+ struct tt_local_entry *local_entry = NULL;
- tt_global_entry = tt_global_hash_find(bat_priv, addr);
+ tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr);
if (!tt_global_entry)
goto out;
if (!roaming) {
- tt_global_del_orig_entry(bat_priv, tt_global_entry, orig_node,
- message);
+ batadv_tt_global_del_orig_entry(bat_priv, tt_global_entry,
+ orig_node, message);
if (hlist_empty(&tt_global_entry->orig_list))
- tt_global_del_struct(bat_priv, tt_global_entry,
- message);
+ batadv_tt_global_del_struct(bat_priv, tt_global_entry,
+ message);
goto out;
}
@@ -902,29 +917,29 @@ static void tt_global_del(struct bat_priv *bat_priv,
* 2) the client roamed to us => we can directly delete
* the global entry, since it is useless now.
*/
- tt_local_entry = tt_local_hash_find(bat_priv,
- tt_global_entry->common.addr);
- if (tt_local_entry) {
+ local_entry = batadv_tt_local_hash_find(bat_priv,
+ tt_global_entry->common.addr);
+ if (local_entry) {
/* local entry exists, case 2: client roamed to us. */
- tt_global_del_orig_list(tt_global_entry);
- tt_global_del_struct(bat_priv, tt_global_entry, message);
+ batadv_tt_global_del_orig_list(tt_global_entry);
+ batadv_tt_global_del_struct(bat_priv, tt_global_entry, message);
} else
/* no local entry exists, case 1: check for roaming */
- tt_global_del_roaming(bat_priv, tt_global_entry, orig_node,
- message);
+ batadv_tt_global_del_roaming(bat_priv, tt_global_entry,
+ orig_node, message);
out:
if (tt_global_entry)
- tt_global_entry_free_ref(tt_global_entry);
- if (tt_local_entry)
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
+ if (local_entry)
+ batadv_tt_local_entry_free_ref(local_entry);
}
void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
struct orig_node *orig_node, const char *message)
{
- struct tt_global_entry *tt_global_entry;
+ struct tt_global_entry *global_entry;
struct tt_common_entry *tt_common_entry;
uint32_t i;
struct hashtable_t *hash = bat_priv->tt_global_hash;
@@ -942,20 +957,19 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
spin_lock_bh(list_lock);
hlist_for_each_entry_safe(tt_common_entry, node, safe,
head, hash_entry) {
- tt_global_entry = container_of(tt_common_entry,
- struct tt_global_entry,
- common);
+ global_entry = container_of(tt_common_entry,
+ struct tt_global_entry,
+ common);
- tt_global_del_orig_entry(bat_priv, tt_global_entry,
- orig_node, message);
+ batadv_tt_global_del_orig_entry(bat_priv, global_entry,
+ orig_node, message);
- if (hlist_empty(&tt_global_entry->orig_list)) {
+ if (hlist_empty(&global_entry->orig_list)) {
batadv_dbg(DBG_TT, bat_priv,
"Deleting global tt entry %pM: %s\n",
- tt_global_entry->common.addr,
- message);
+ global_entry->common.addr, message);
hlist_del_rcu(node);
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(global_entry);
}
}
spin_unlock_bh(list_lock);
@@ -964,7 +978,7 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
orig_node->tt_initialised = false;
}
-static void tt_global_roam_purge(struct bat_priv *bat_priv)
+static void batadv_tt_global_roam_purge(struct bat_priv *bat_priv)
{
struct hashtable_t *hash = bat_priv->tt_global_hash;
struct tt_common_entry *tt_common_entry;
@@ -995,14 +1009,14 @@ static void tt_global_roam_purge(struct bat_priv *bat_priv)
tt_global_entry->common.addr);
hlist_del_rcu(node);
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
}
spin_unlock_bh(list_lock);
}
}
-static void tt_global_table_free(struct bat_priv *bat_priv)
+static void batadv_tt_global_table_free(struct bat_priv *bat_priv)
{
struct hashtable_t *hash;
spinlock_t *list_lock; /* protects write access to the hash lists */
@@ -1028,7 +1042,7 @@ static void tt_global_table_free(struct bat_priv *bat_priv)
tt_global_entry = container_of(tt_common_entry,
struct tt_global_entry,
common);
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
}
spin_unlock_bh(list_lock);
}
@@ -1038,8 +1052,8 @@ static void tt_global_table_free(struct bat_priv *bat_priv)
bat_priv->tt_global_hash = NULL;
}
-static bool _is_ap_isolated(struct tt_local_entry *tt_local_entry,
- struct tt_global_entry *tt_global_entry)
+static bool _batadv_is_ap_isolated(struct tt_local_entry *tt_local_entry,
+ struct tt_global_entry *tt_global_entry)
{
bool ret = false;
@@ -1064,19 +1078,20 @@ struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,
int best_tq;
if (src && atomic_read(&bat_priv->ap_isolation)) {
- tt_local_entry = tt_local_hash_find(bat_priv, src);
+ tt_local_entry = batadv_tt_local_hash_find(bat_priv, src);
if (!tt_local_entry)
goto out;
}
- tt_global_entry = tt_global_hash_find(bat_priv, addr);
+ tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr);
if (!tt_global_entry)
goto out;
/* check whether the clients should not communicate due to AP
* isolation
*/
- if (tt_local_entry && _is_ap_isolated(tt_local_entry, tt_global_entry))
+ if (tt_local_entry &&
+ _batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
goto out;
best_tq = 0;
@@ -1100,16 +1115,16 @@ struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,
rcu_read_unlock();
out:
if (tt_global_entry)
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
if (tt_local_entry)
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
return orig_node;
}
/* Calculates the checksum of the local table of a given orig_node */
-static uint16_t tt_global_crc(struct bat_priv *bat_priv,
- struct orig_node *orig_node)
+static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
+ struct orig_node *orig_node)
{
uint16_t total = 0, total_one;
struct hashtable_t *hash = bat_priv->tt_global_hash;
@@ -1140,8 +1155,8 @@ static uint16_t tt_global_crc(struct bat_priv *bat_priv,
/* find out if this global entry is announced by this
* originator
*/
- if (!tt_global_entry_has_orig(tt_global_entry,
- orig_node))
+ if (!batadv_tt_global_entry_has_orig(tt_global_entry,
+ orig_node))
continue;
total_one = 0;
@@ -1190,7 +1205,7 @@ uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv)
return total;
}
-static void tt_req_list_free(struct bat_priv *bat_priv)
+static void batadv_tt_req_list_free(struct bat_priv *bat_priv)
{
struct tt_req_node *node, *safe;
@@ -1204,10 +1219,10 @@ static void tt_req_list_free(struct bat_priv *bat_priv)
spin_unlock_bh(&bat_priv->tt_req_list_lock);
}
-static void tt_save_orig_buffer(struct bat_priv *bat_priv,
- struct orig_node *orig_node,
- const unsigned char *tt_buff,
- uint8_t tt_num_changes)
+static void batadv_tt_save_orig_buffer(struct bat_priv *bat_priv,
+ struct orig_node *orig_node,
+ const unsigned char *tt_buff,
+ uint8_t tt_num_changes)
{
uint16_t tt_buff_len = batadv_tt_len(tt_num_changes);
@@ -1227,7 +1242,7 @@ static void tt_save_orig_buffer(struct bat_priv *bat_priv,
spin_unlock_bh(&orig_node->tt_buff_lock);
}
-static void tt_req_purge(struct bat_priv *bat_priv)
+static void batadv_tt_req_purge(struct bat_priv *bat_priv)
{
struct tt_req_node *node, *safe;
@@ -1244,8 +1259,8 @@ static void tt_req_purge(struct bat_priv *bat_priv)
/* returns the pointer to the new tt_req_node struct if no request
* has already been issued for this orig_node, NULL otherwise
*/
-static struct tt_req_node *new_tt_req_node(struct bat_priv *bat_priv,
- struct orig_node *orig_node)
+static struct tt_req_node *batadv_new_tt_req_node(struct bat_priv *bat_priv,
+ struct orig_node *orig_node)
{
struct tt_req_node *tt_req_node_tmp, *tt_req_node = NULL;
@@ -1271,7 +1286,8 @@ unlock:
}
/* data_ptr is useless here, but has to be kept to respect the prototype */
-static int tt_local_valid_entry(const void *entry_ptr, const void *data_ptr)
+static int batadv_tt_local_valid_entry(const void *entry_ptr,
+ const void *data_ptr)
{
const struct tt_common_entry *tt_common_entry = entry_ptr;
@@ -1280,7 +1296,8 @@ static int tt_local_valid_entry(const void *entry_ptr, const void *data_ptr)
return 1;
}
-static int tt_global_valid_entry(const void *entry_ptr, const void *data_ptr)
+static int batadv_tt_global_valid(const void *entry_ptr,
+ const void *data_ptr)
{
const struct tt_common_entry *tt_common_entry = entry_ptr;
const struct tt_global_entry *tt_global_entry;
@@ -1292,15 +1309,15 @@ static int tt_global_valid_entry(const void *entry_ptr, const void *data_ptr)
tt_global_entry = container_of(tt_common_entry, struct tt_global_entry,
common);
- return tt_global_entry_has_orig(tt_global_entry, orig_node);
+ return batadv_tt_global_entry_has_orig(tt_global_entry, orig_node);
}
-static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
- struct hashtable_t *hash,
- struct hard_iface *primary_if,
- int (*valid_cb)(const void *,
- const void *),
- void *cb_data)
+static struct sk_buff *
+batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
+ struct hashtable_t *hash,
+ struct hard_iface *primary_if,
+ int (*valid_cb)(const void *, const void *),
+ void *cb_data)
{
struct tt_common_entry *tt_common_entry;
struct tt_query_packet *tt_response;
@@ -1361,9 +1378,10 @@ out:
return skb;
}
-static int send_tt_request(struct bat_priv *bat_priv,
- struct orig_node *dst_orig_node,
- uint8_t ttvn, uint16_t tt_crc, bool full_table)
+static int batadv_send_tt_request(struct bat_priv *bat_priv,
+ struct orig_node *dst_orig_node,
+ uint8_t ttvn, uint16_t tt_crc,
+ bool full_table)
{
struct sk_buff *skb = NULL;
struct tt_query_packet *tt_request;
@@ -1379,7 +1397,7 @@ static int send_tt_request(struct bat_priv *bat_priv,
/* The new tt_req will be issued only if I'm not waiting for a
* reply from the same orig_node yet
*/
- tt_req_node = new_tt_req_node(bat_priv, dst_orig_node);
+ tt_req_node = batadv_new_tt_req_node(bat_priv, dst_orig_node);
if (!tt_req_node)
goto out;
@@ -1434,8 +1452,8 @@ out:
return ret;
}
-static bool send_other_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_request)
+static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
+ struct tt_query_packet *tt_request)
{
struct orig_node *req_dst_orig_node = NULL, *res_dst_orig_node = NULL;
struct neigh_node *neigh_node = NULL;
@@ -1515,10 +1533,11 @@ static bool send_other_tt_response(struct bat_priv *bat_priv,
sizeof(struct tt_change);
ttvn = (uint8_t)atomic_read(&req_dst_orig_node->last_ttvn);
- skb = tt_response_fill_table(tt_len, ttvn,
- bat_priv->tt_global_hash,
- primary_if, tt_global_valid_entry,
- req_dst_orig_node);
+ skb = batadv_tt_response_fill_table(tt_len, ttvn,
+ bat_priv->tt_global_hash,
+ primary_if,
+ batadv_tt_global_valid,
+ req_dst_orig_node);
if (!skb)
goto out;
@@ -1563,8 +1582,8 @@ out:
return ret;
}
-static bool send_my_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_request)
+static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
+ struct tt_query_packet *tt_request)
{
struct orig_node *orig_node = NULL;
struct neigh_node *neigh_node = NULL;
@@ -1635,10 +1654,11 @@ static bool send_my_tt_response(struct bat_priv *bat_priv,
sizeof(struct tt_change);
ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
- skb = tt_response_fill_table(tt_len, ttvn,
- bat_priv->tt_local_hash,
- primary_if, tt_local_valid_entry,
- NULL);
+ skb = batadv_tt_response_fill_table(tt_len, ttvn,
+ bat_priv->tt_local_hash,
+ primary_if,
+ batadv_tt_local_valid_entry,
+ NULL);
if (!skb)
goto out;
@@ -1689,26 +1709,28 @@ bool batadv_send_tt_response(struct bat_priv *bat_priv,
if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src))
return true;
- return send_my_tt_response(bat_priv, tt_request);
+ return batadv_send_my_tt_response(bat_priv, tt_request);
} else {
- return send_other_tt_response(bat_priv, tt_request);
+ return batadv_send_other_tt_response(bat_priv, tt_request);
}
}
-static void _tt_update_changes(struct bat_priv *bat_priv,
- struct orig_node *orig_node,
- struct tt_change *tt_change,
- uint16_t tt_num_changes, uint8_t ttvn)
+static void _batadv_tt_update_changes(struct bat_priv *bat_priv,
+ struct orig_node *orig_node,
+ struct tt_change *tt_change,
+ uint16_t tt_num_changes, uint8_t ttvn)
{
int i;
int is_wifi;
+ int roams;
for (i = 0; i < tt_num_changes; i++) {
if ((tt_change + i)->flags & TT_CLIENT_DEL) {
- tt_global_del(bat_priv, orig_node,
- (tt_change + i)->addr,
- "tt removed by changes",
- (tt_change + i)->flags & TT_CLIENT_ROAM);
+ roams = (tt_change + i)->flags & TT_CLIENT_ROAM;
+ batadv_tt_global_del(bat_priv, orig_node,
+ (tt_change + i)->addr,
+ "tt removed by changes",
+ roams);
} else {
is_wifi = (tt_change + i)->flags & TT_CLIENT_WIFI;
if (!batadv_tt_global_add(bat_priv, orig_node,
@@ -1726,8 +1748,8 @@ static void _tt_update_changes(struct bat_priv *bat_priv,
orig_node->tt_initialised = true;
}
-static void tt_fill_gtable(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_response)
+static void batadv_tt_fill_gtable(struct bat_priv *bat_priv,
+ struct tt_query_packet *tt_response)
{
struct orig_node *orig_node = NULL;
@@ -1738,9 +1760,10 @@ static void tt_fill_gtable(struct bat_priv *bat_priv,
/* Purge the old table first.. */
batadv_tt_global_del_orig(bat_priv, orig_node, "Received full table");
- _tt_update_changes(bat_priv, orig_node,
- (struct tt_change *)(tt_response + 1),
- ntohs(tt_response->tt_data), tt_response->ttvn);
+ _batadv_tt_update_changes(bat_priv, orig_node,
+ (struct tt_change *)(tt_response + 1),
+ ntohs(tt_response->tt_data),
+ tt_response->ttvn);
spin_lock_bh(&orig_node->tt_buff_lock);
kfree(orig_node->tt_buff);
@@ -1755,16 +1778,16 @@ out:
batadv_orig_node_free_ref(orig_node);
}
-static void tt_update_changes(struct bat_priv *bat_priv,
- struct orig_node *orig_node,
- uint16_t tt_num_changes, uint8_t ttvn,
- struct tt_change *tt_change)
+static void batadv_tt_update_changes(struct bat_priv *bat_priv,
+ struct orig_node *orig_node,
+ uint16_t tt_num_changes, uint8_t ttvn,
+ struct tt_change *tt_change)
{
- _tt_update_changes(bat_priv, orig_node, tt_change, tt_num_changes,
- ttvn);
+ _batadv_tt_update_changes(bat_priv, orig_node, tt_change,
+ tt_num_changes, ttvn);
- tt_save_orig_buffer(bat_priv, orig_node, (unsigned char *)tt_change,
- tt_num_changes);
+ batadv_tt_save_orig_buffer(bat_priv, orig_node,
+ (unsigned char *)tt_change, tt_num_changes);
atomic_set(&orig_node->last_ttvn, ttvn);
}
@@ -1773,7 +1796,7 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr)
struct tt_local_entry *tt_local_entry = NULL;
bool ret = false;
- tt_local_entry = tt_local_hash_find(bat_priv, addr);
+ tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr);
if (!tt_local_entry)
goto out;
/* Check if the client has been logically deleted (but is kept for
@@ -1784,7 +1807,7 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr)
ret = true;
out:
if (tt_local_entry)
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
return ret;
}
@@ -1809,12 +1832,12 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,
goto out;
if (tt_response->flags & TT_FULL_TABLE)
- tt_fill_gtable(bat_priv, tt_response);
+ batadv_tt_fill_gtable(bat_priv, tt_response);
else
- tt_update_changes(bat_priv, orig_node,
- ntohs(tt_response->tt_data),
- tt_response->ttvn,
- (struct tt_change *)(tt_response + 1));
+ batadv_tt_update_changes(bat_priv, orig_node,
+ ntohs(tt_response->tt_data),
+ tt_response->ttvn,
+ (struct tt_change *)(tt_response + 1));
/* Delete the tt_req_node from pending tt_requests list */
spin_lock_bh(&bat_priv->tt_req_list_lock);
@@ -1827,7 +1850,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,
spin_unlock_bh(&bat_priv->tt_req_list_lock);
/* Recalculate the CRC for this orig_node and store it */
- orig_node->tt_crc = tt_global_crc(bat_priv, orig_node);
+ orig_node->tt_crc = batadv_tt_global_crc(bat_priv, orig_node);
/* Roaming phase is over: tables are in sync again. I can
* unset the flag
*/
@@ -1841,20 +1864,20 @@ int batadv_tt_init(struct bat_priv *bat_priv)
{
int ret;
- ret = tt_local_init(bat_priv);
+ ret = batadv_tt_local_init(bat_priv);
if (ret < 0)
return ret;
- ret = tt_global_init(bat_priv);
+ ret = batadv_tt_global_init(bat_priv);
if (ret < 0)
return ret;
- tt_start_timer(bat_priv);
+ batadv_tt_start_timer(bat_priv);
return 1;
}
-static void tt_roam_list_free(struct bat_priv *bat_priv)
+static void batadv_tt_roam_list_free(struct bat_priv *bat_priv)
{
struct tt_roam_node *node, *safe;
@@ -1868,7 +1891,7 @@ static void tt_roam_list_free(struct bat_priv *bat_priv)
spin_unlock_bh(&bat_priv->tt_roam_list_lock);
}
-static void tt_roam_purge(struct bat_priv *bat_priv)
+static void batadv_tt_roam_purge(struct bat_priv *bat_priv)
{
struct tt_roam_node *node, *safe;
@@ -1889,8 +1912,8 @@ static void tt_roam_purge(struct bat_priv *bat_priv)
*
* returns true if the ROAMING_ADV can be sent, false otherwise
*/
-static bool tt_check_roam_count(struct bat_priv *bat_priv,
- uint8_t *client)
+static bool batadv_tt_check_roam_count(struct bat_priv *bat_priv,
+ uint8_t *client)
{
struct tt_roam_node *tt_roam_node;
bool ret = false;
@@ -1932,8 +1955,8 @@ unlock:
return ret;
}
-static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
- struct orig_node *orig_node)
+static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
+ struct orig_node *orig_node)
{
struct neigh_node *neigh_node = NULL;
struct sk_buff *skb = NULL;
@@ -1944,7 +1967,7 @@ static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
/* before going on we have to check whether the client has
* already roamed to us too many times
*/
- if (!tt_check_roam_count(bat_priv, client))
+ if (!batadv_tt_check_roam_count(bat_priv, client))
goto out;
skb = dev_alloc_skb(sizeof(struct roam_adv_packet) + ETH_HLEN);
@@ -1988,30 +2011,30 @@ out:
return;
}
-static void tt_purge(struct work_struct *work)
+static void batadv_tt_purge(struct work_struct *work)
{
struct delayed_work *delayed_work =
container_of(work, struct delayed_work, work);
struct bat_priv *bat_priv =
container_of(delayed_work, struct bat_priv, tt_work);
- tt_local_purge(bat_priv);
- tt_global_roam_purge(bat_priv);
- tt_req_purge(bat_priv);
- tt_roam_purge(bat_priv);
+ batadv_tt_local_purge(bat_priv);
+ batadv_tt_global_roam_purge(bat_priv);
+ batadv_tt_req_purge(bat_priv);
+ batadv_tt_roam_purge(bat_priv);
- tt_start_timer(bat_priv);
+ batadv_tt_start_timer(bat_priv);
}
void batadv_tt_free(struct bat_priv *bat_priv)
{
cancel_delayed_work_sync(&bat_priv->tt_work);
- tt_local_table_free(bat_priv);
- tt_global_table_free(bat_priv);
- tt_req_list_free(bat_priv);
- tt_changes_list_free(bat_priv);
- tt_roam_list_free(bat_priv);
+ batadv_tt_local_table_free(bat_priv);
+ batadv_tt_global_table_free(bat_priv);
+ batadv_tt_req_list_free(bat_priv);
+ batadv_tt_changes_list_free(bat_priv);
+ batadv_tt_roam_list_free(bat_priv);
kfree(bat_priv->tt_buff);
}
@@ -2019,8 +2042,8 @@ void batadv_tt_free(struct bat_priv *bat_priv)
/* This function will enable or disable the specified flags for all the entries
* in the given hash table and returns the number of modified entries
*/
-static uint16_t tt_set_flags(struct hashtable_t *hash, uint16_t flags,
- bool enable)
+static uint16_t batadv_tt_set_flags(struct hashtable_t *hash, uint16_t flags,
+ bool enable)
{
uint32_t i;
uint16_t changed_num = 0;
@@ -2055,7 +2078,7 @@ out:
}
/* Purge out all the tt local entries marked with TT_CLIENT_PENDING */
-static void tt_local_purge_pending_clients(struct bat_priv *bat_priv)
+static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv)
{
struct hashtable_t *hash = bat_priv->tt_local_hash;
struct tt_common_entry *tt_common_entry;
@@ -2087,28 +2110,28 @@ static void tt_local_purge_pending_clients(struct bat_priv *bat_priv)
tt_local_entry = container_of(tt_common_entry,
struct tt_local_entry,
common);
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
}
spin_unlock_bh(list_lock);
}
}
-static int tt_commit_changes(struct bat_priv *bat_priv,
- unsigned char **packet_buff, int *packet_buff_len,
- int packet_min_len)
+static int batadv_tt_commit_changes(struct bat_priv *bat_priv,
+ unsigned char **packet_buff,
+ int *packet_buff_len, int packet_min_len)
{
uint16_t changed_num = 0;
if (atomic_read(&bat_priv->tt_local_changes) < 1)
return -ENOENT;
- changed_num = tt_set_flags(bat_priv->tt_local_hash,
- TT_CLIENT_NEW, false);
+ changed_num = batadv_tt_set_flags(bat_priv->tt_local_hash,
+ TT_CLIENT_NEW, false);
/* all reset entries have to be counted as local entries */
atomic_add(changed_num, &bat_priv->num_local_tt);
- tt_local_purge_pending_clients(bat_priv);
+ batadv_tt_local_purge_pending_clients(bat_priv);
bat_priv->tt_crc = batadv_tt_local_crc(bat_priv);
/* Increment the TTVN only once per OGM interval */
@@ -2121,8 +2144,8 @@ static int tt_commit_changes(struct bat_priv *bat_priv,
/* reset the sending counter */
atomic_set(&bat_priv->tt_ogm_append_cnt, TT_OGM_APPEND_MAX);
- return tt_changes_fill_buff(bat_priv, packet_buff,
- packet_buff_len, packet_min_len);
+ return batadv_tt_changes_fill_buff(bat_priv, packet_buff,
+ packet_buff_len, packet_min_len);
}
/* when calling this function (hard_iface == primary_if) has to be true */
@@ -2133,14 +2156,15 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv,
int tt_num_changes;
/* if at least one change happened */
- tt_num_changes = tt_commit_changes(bat_priv, packet_buff,
- packet_buff_len, packet_min_len);
+ tt_num_changes = batadv_tt_commit_changes(bat_priv, packet_buff,
+ packet_buff_len,
+ packet_min_len);
/* if the changes have been sent often enough */
if ((tt_num_changes < 0) &&
(!atomic_dec_not_zero(&bat_priv->tt_ogm_append_cnt))) {
- tt_realloc_packet_buff(packet_buff, packet_buff_len,
- packet_min_len, packet_min_len);
+ batadv_tt_realloc_packet_buff(packet_buff, packet_buff_len,
+ packet_min_len, packet_min_len);
tt_num_changes = 0;
}
@@ -2157,24 +2181,24 @@ bool batadv_is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src,
if (!atomic_read(&bat_priv->ap_isolation))
return false;
- tt_local_entry = tt_local_hash_find(bat_priv, dst);
+ tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst);
if (!tt_local_entry)
goto out;
- tt_global_entry = tt_global_hash_find(bat_priv, src);
+ tt_global_entry = batadv_tt_global_hash_find(bat_priv, src);
if (!tt_global_entry)
goto out;
- if (_is_ap_isolated(tt_local_entry, tt_global_entry))
+ if (_batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
goto out;
ret = false;
out:
if (tt_global_entry)
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
if (tt_local_entry)
- tt_local_entry_free_ref(tt_local_entry);
+ batadv_tt_local_entry_free_ref(tt_local_entry);
return ret;
}
@@ -2204,14 +2228,14 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv,
goto request_table;
}
- tt_update_changes(bat_priv, orig_node, tt_num_changes, ttvn,
- (struct tt_change *)tt_buff);
+ batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes,
+ ttvn, (struct tt_change *)tt_buff);
/* Even if we received the precomputed crc with the OGM, we
* prefer to recompute it to spot any possible inconsistency
* in the global table
*/
- orig_node->tt_crc = tt_global_crc(bat_priv, orig_node);
+ orig_node->tt_crc = batadv_tt_global_crc(bat_priv, orig_node);
/* The ttvn alone is not enough to guarantee consistency
* because a single value could represent different states
@@ -2240,8 +2264,8 @@ request_table:
"TT inconsistency for %pM. Need to retrieve the correct information (ttvn: %u last_ttvn: %u crc: %u last_crc: %u num_changes: %u)\n",
orig_node->orig, ttvn, orig_ttvn, tt_crc,
orig_node->tt_crc, tt_num_changes);
- send_tt_request(bat_priv, orig_node, ttvn, tt_crc,
- full_table);
+ batadv_send_tt_request(bat_priv, orig_node, ttvn,
+ tt_crc, full_table);
return;
}
}
@@ -2257,12 +2281,12 @@ bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv,
struct tt_global_entry *tt_global_entry;
bool ret = false;
- tt_global_entry = tt_global_hash_find(bat_priv, addr);
+ tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr);
if (!tt_global_entry)
goto out;
ret = tt_global_entry->common.flags & TT_CLIENT_ROAM;
- tt_global_entry_free_ref(tt_global_entry);
+ batadv_tt_global_entry_free_ref(tt_global_entry);
out:
return ret;
}
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-172-g258f84d
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 258f84dbe1674c68f22ae0d4dac8700c257b7ab3
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:15 2012 +0200
batman-adv: Prefix soft-interface local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/soft-interface.c b/soft-interface.c
index dfe32b9..9b4c0d0 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -38,26 +38,26 @@
#include "bridge_loop_avoidance.h"
-static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
-static void bat_get_drvinfo(struct net_device *dev,
- struct ethtool_drvinfo *info);
-static u32 bat_get_msglevel(struct net_device *dev);
-static void bat_set_msglevel(struct net_device *dev, u32 value);
-static u32 bat_get_link(struct net_device *dev);
-static void bat_get_strings(struct net_device *dev, u32 stringset, u8 *data);
-static void bat_get_ethtool_stats(struct net_device *dev,
- struct ethtool_stats *stats, u64 *data);
-static int bat_get_sset_count(struct net_device *dev, int stringset);
-
-static const struct ethtool_ops bat_ethtool_ops = {
- .get_settings = bat_get_settings,
- .get_drvinfo = bat_get_drvinfo,
- .get_msglevel = bat_get_msglevel,
- .set_msglevel = bat_set_msglevel,
- .get_link = bat_get_link,
- .get_strings = bat_get_strings,
- .get_ethtool_stats = bat_get_ethtool_stats,
- .get_sset_count = bat_get_sset_count,
+static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
+static void batadv_get_drvinfo(struct net_device *dev,
+ struct ethtool_drvinfo *info);
+static u32 batadv_get_msglevel(struct net_device *dev);
+static void batadv_set_msglevel(struct net_device *dev, u32 value);
+static u32 batadv_get_link(struct net_device *dev);
+static void batadv_get_strings(struct net_device *dev, u32 stringset, u8 *data);
+static void batadv_get_ethtool_stats(struct net_device *dev,
+ struct ethtool_stats *stats, u64 *data);
+static int batadv_get_sset_count(struct net_device *dev, int stringset);
+
+static const struct ethtool_ops batadv_ethtool_ops = {
+ .get_settings = batadv_get_settings,
+ .get_drvinfo = batadv_get_drvinfo,
+ .get_msglevel = batadv_get_msglevel,
+ .set_msglevel = batadv_set_msglevel,
+ .get_link = batadv_get_link,
+ .get_strings = batadv_get_strings,
+ .get_ethtool_stats = batadv_get_ethtool_stats,
+ .get_sset_count = batadv_get_sset_count,
};
int batadv_skb_head_push(struct sk_buff *skb, unsigned int len)
@@ -79,25 +79,25 @@ int batadv_skb_head_push(struct sk_buff *skb, unsigned int len)
return 0;
}
-static int interface_open(struct net_device *dev)
+static int batadv_interface_open(struct net_device *dev)
{
netif_start_queue(dev);
return 0;
}
-static int interface_release(struct net_device *dev)
+static int batadv_interface_release(struct net_device *dev)
{
netif_stop_queue(dev);
return 0;
}
-static struct net_device_stats *interface_stats(struct net_device *dev)
+static struct net_device_stats *batadv_interface_stats(struct net_device *dev)
{
struct bat_priv *bat_priv = netdev_priv(dev);
return &bat_priv->stats;
}
-static int interface_set_mac_addr(struct net_device *dev, void *p)
+static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
{
struct bat_priv *bat_priv = netdev_priv(dev);
struct sockaddr *addr = p;
@@ -117,7 +117,7 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)
return 0;
}
-static int interface_change_mtu(struct net_device *dev, int new_mtu)
+static int batadv_interface_change_mtu(struct net_device *dev, int new_mtu)
{
/* check ranges */
if ((new_mtu < 68) || (new_mtu > batadv_hardif_min_mtu(dev)))
@@ -128,7 +128,8 @@ static int interface_change_mtu(struct net_device *dev, int new_mtu)
return 0;
}
-static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
+static int batadv_interface_tx(struct sk_buff *skb,
+ struct net_device *soft_iface)
{
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
struct bat_priv *bat_priv = netdev_priv(soft_iface);
@@ -336,23 +337,23 @@ out:
return;
}
-static const struct net_device_ops bat_netdev_ops = {
- .ndo_open = interface_open,
- .ndo_stop = interface_release,
- .ndo_get_stats = interface_stats,
- .ndo_set_mac_address = interface_set_mac_addr,
- .ndo_change_mtu = interface_change_mtu,
- .ndo_start_xmit = interface_tx,
+static const struct net_device_ops batadv_netdev_ops = {
+ .ndo_open = batadv_interface_open,
+ .ndo_stop = batadv_interface_release,
+ .ndo_get_stats = batadv_interface_stats,
+ .ndo_set_mac_address = batadv_interface_set_mac_addr,
+ .ndo_change_mtu = batadv_interface_change_mtu,
+ .ndo_start_xmit = batadv_interface_tx,
.ndo_validate_addr = eth_validate_addr
};
-static void interface_setup(struct net_device *dev)
+static void batadv_interface_setup(struct net_device *dev)
{
struct bat_priv *priv = netdev_priv(dev);
ether_setup(dev);
- dev->netdev_ops = &bat_netdev_ops;
+ dev->netdev_ops = &batadv_netdev_ops;
dev->destructor = free_netdev;
dev->tx_queue_len = 0;
@@ -366,7 +367,7 @@ static void interface_setup(struct net_device *dev)
/* generate random address */
eth_hw_addr_random(dev);
- SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
+ SET_ETHTOOL_OPS(dev, &batadv_ethtool_ops);
memset(priv, 0, sizeof(*priv));
}
@@ -377,7 +378,8 @@ struct net_device *batadv_softif_create(const char *name)
struct bat_priv *bat_priv;
int ret;
- soft_iface = alloc_netdev(sizeof(*bat_priv), name, interface_setup);
+ soft_iface = alloc_netdev(sizeof(*bat_priv), name,
+ batadv_interface_setup);
if (!soft_iface)
goto out;
@@ -471,14 +473,14 @@ void batadv_softif_destroy(struct net_device *soft_iface)
int batadv_softif_is_valid(const struct net_device *net_dev)
{
- if (net_dev->netdev_ops->ndo_start_xmit == interface_tx)
+ if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx)
return 1;
return 0;
}
/* ethtool */
-static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
cmd->supported = 0;
cmd->advertising = 0;
@@ -494,8 +496,8 @@ static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return 0;
}
-static void bat_get_drvinfo(struct net_device *dev,
- struct ethtool_drvinfo *info)
+static void batadv_get_drvinfo(struct net_device *dev,
+ struct ethtool_drvinfo *info)
{
strcpy(info->driver, "B.A.T.M.A.N. advanced");
strcpy(info->version, SOURCE_VERSION);
@@ -503,16 +505,16 @@ static void bat_get_drvinfo(struct net_device *dev,
strcpy(info->bus_info, "batman");
}
-static u32 bat_get_msglevel(struct net_device *dev)
+static u32 batadv_get_msglevel(struct net_device *dev)
{
return -EOPNOTSUPP;
}
-static void bat_set_msglevel(struct net_device *dev, u32 value)
+static void batadv_set_msglevel(struct net_device *dev, u32 value)
{
}
-static u32 bat_get_link(struct net_device *dev)
+static u32 batadv_get_link(struct net_device *dev)
{
return 1;
}
@@ -523,7 +525,7 @@ static u32 bat_get_link(struct net_device *dev)
*/
static const struct {
const char name[ETH_GSTRING_LEN];
-} bat_counters_strings[] = {
+} batadv_counters_strings[] = {
{ "forward" },
{ "forward_bytes" },
{ "mgmt_tx" },
@@ -544,16 +546,17 @@ static const struct {
#endif
};
-static void bat_get_strings(struct net_device *dev, uint32_t stringset,
- uint8_t *data)
+static void batadv_get_strings(struct net_device *dev, uint32_t stringset,
+ uint8_t *data)
{
if (stringset == ETH_SS_STATS)
- memcpy(data, bat_counters_strings,
- sizeof(bat_counters_strings));
+ memcpy(data, batadv_counters_strings,
+ sizeof(batadv_counters_strings));
}
-static void bat_get_ethtool_stats(struct net_device *dev,
- struct ethtool_stats *stats, uint64_t *data)
+static void batadv_get_ethtool_stats(struct net_device *dev,
+ struct ethtool_stats *stats,
+ uint64_t *data)
{
struct bat_priv *bat_priv = netdev_priv(dev);
int i;
@@ -562,7 +565,7 @@ static void bat_get_ethtool_stats(struct net_device *dev,
data[i] = batadv_sum_counter(bat_priv, i);
}
-static int bat_get_sset_count(struct net_device *dev, int stringset)
+static int batadv_get_sset_count(struct net_device *dev, int stringset)
{
if (stringset == ETH_SS_STATS)
return BAT_CNT_NUM;
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-171-gaec4e11
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit aec4e11775cd3e5d79c96c84fa230b8f033a6423
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:14 2012 +0200
batman-adv: Prefix send local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/send.c b/send.c
index ef4b4b3..e19265a 100644
--- a/send.c
+++ b/send.c
@@ -28,7 +28,7 @@
#include "gateway_common.h"
#include "originator.h"
-static void send_outstanding_bcast_packet(struct work_struct *work);
+static void batadv_send_outstanding_bcast_packet(struct work_struct *work);
/* send out an already prepared packet to the given address via the
* specified batman interface
@@ -97,7 +97,7 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface)
bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface);
}
-static void forw_packet_free(struct forw_packet *forw_packet)
+static void batadv_forw_packet_free(struct forw_packet *forw_packet)
{
if (forw_packet->skb)
kfree_skb(forw_packet->skb);
@@ -106,9 +106,9 @@ static void forw_packet_free(struct forw_packet *forw_packet)
kfree(forw_packet);
}
-static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,
- struct forw_packet *forw_packet,
- unsigned long send_time)
+static void _batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
+ struct forw_packet *forw_packet,
+ unsigned long send_time)
{
INIT_HLIST_NODE(&forw_packet->list);
@@ -119,7 +119,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,
/* start timer for this packet */
INIT_DELAYED_WORK(&forw_packet->delayed_work,
- send_outstanding_bcast_packet);
+ batadv_send_outstanding_bcast_packet);
queue_delayed_work(batadv_event_workqueue, &forw_packet->delayed_work,
send_time);
}
@@ -172,7 +172,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
/* how often did we send the bcast packet ? */
forw_packet->num_packets = 0;
- _add_bcast_packet_to_list(bat_priv, forw_packet, delay);
+ _batadv_add_bcast_packet_to_list(bat_priv, forw_packet, delay);
return NETDEV_TX_OK;
packet_free:
@@ -185,7 +185,7 @@ out:
return NETDEV_TX_BUSY;
}
-static void send_outstanding_bcast_packet(struct work_struct *work)
+static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
{
struct hard_iface *hard_iface;
struct delayed_work *delayed_work =
@@ -224,13 +224,13 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
/* if we still have some more bcasts to send */
if (forw_packet->num_packets < 3) {
- _add_bcast_packet_to_list(bat_priv, forw_packet,
- msecs_to_jiffies(5));
+ _batadv_add_bcast_packet_to_list(bat_priv, forw_packet,
+ msecs_to_jiffies(5));
return;
}
out:
- forw_packet_free(forw_packet);
+ batadv_forw_packet_free(forw_packet);
atomic_inc(&bat_priv->bcast_queue_left);
}
@@ -264,7 +264,7 @@ out:
if (!forw_packet->own)
atomic_inc(&bat_priv->batman_queue_left);
- forw_packet_free(forw_packet);
+ batadv_forw_packet_free(forw_packet);
}
void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
@@ -296,7 +296,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
- /* send_outstanding_bcast_packet() will lock the list to
+ /* batadv_send_outstanding_bcast_packet() will lock the list to
* delete the item from the list
*/
pending = cancel_delayed_work_sync(&forw_packet->delayed_work);
@@ -304,7 +304,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
if (pending) {
hlist_del(&forw_packet->list);
- forw_packet_free(forw_packet);
+ batadv_forw_packet_free(forw_packet);
}
}
spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
@@ -331,7 +331,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
if (pending) {
hlist_del(&forw_packet->list);
- forw_packet_free(forw_packet);
+ batadv_forw_packet_free(forw_packet);
}
}
spin_unlock_bh(&bat_priv->forw_bat_list_lock);
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-170-gc63e1d1
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit c63e1d134af21dd89235c803aff27150aff509a1
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed May 16 20:23:13 2012 +0200
batman-adv: Prefix routing local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/routing.c b/routing.c
index 977e44c..4176c78 100644
--- a/routing.c
+++ b/routing.c
@@ -29,8 +29,8 @@
#include "unicast.h"
#include "bridge_loop_avoidance.h"
-static int route_unicast_packet(struct sk_buff *skb,
- struct hard_iface *recv_if);
+static int batadv_route_unicast_packet(struct sk_buff *skb,
+ struct hard_iface *recv_if);
void batadv_slide_own_bcast_window(struct hard_iface *hard_iface)
{
@@ -61,9 +61,9 @@ void batadv_slide_own_bcast_window(struct hard_iface *hard_iface)
}
}
-static void _update_route(struct bat_priv *bat_priv,
- struct orig_node *orig_node,
- struct neigh_node *neigh_node)
+static void _batadv_update_route(struct bat_priv *bat_priv,
+ struct orig_node *orig_node,
+ struct neigh_node *neigh_node)
{
struct neigh_node *curr_router;
@@ -117,7 +117,7 @@ void batadv_update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
router = batadv_orig_node_get_router(orig_node);
if (router != neigh_node)
- _update_route(bat_priv, orig_node, neigh_node);
+ _batadv_update_route(bat_priv, orig_node, neigh_node);
out:
if (router)
@@ -276,8 +276,8 @@ bool batadv_check_management_packet(struct sk_buff *skb,
return true;
}
-static int recv_my_icmp_packet(struct bat_priv *bat_priv,
- struct sk_buff *skb, size_t icmp_len)
+static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv,
+ struct sk_buff *skb, size_t icmp_len)
{
struct hard_iface *primary_if = NULL;
struct orig_node *orig_node = NULL;
@@ -331,8 +331,8 @@ out:
return ret;
}
-static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
- struct sk_buff *skb)
+static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
+ struct sk_buff *skb)
{
struct hard_iface *primary_if = NULL;
struct orig_node *orig_node = NULL;
@@ -431,11 +431,11 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
/* packet for me */
if (batadv_is_my_mac(icmp_packet->dst))
- return recv_my_icmp_packet(bat_priv, skb, hdr_size);
+ return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size);
/* TTL exceeded */
if (icmp_packet->header.ttl < 2)
- return recv_icmp_ttl_exceeded(bat_priv, skb);
+ return batadv_recv_icmp_ttl_exceeded(bat_priv, skb);
/* get routing information */
orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->dst);
@@ -473,8 +473,9 @@ out:
* This method rotates the bonding list and increases the
* returned router's refcount.
*/
-static struct neigh_node *find_bond_router(struct orig_node *primary_orig,
- const struct hard_iface *recv_if)
+static struct neigh_node *
+batadv_find_bond_router(struct orig_node *primary_orig,
+ const struct hard_iface *recv_if)
{
struct neigh_node *tmp_neigh_node;
struct neigh_node *router = NULL, *first_candidate = NULL;
@@ -527,8 +528,9 @@ out:
*
* Increases the returned router's refcount
*/
-static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig,
- const struct hard_iface *recv_if)
+static struct neigh_node *
+batadv_find_ifalter_router(struct orig_node *primary_orig,
+ const struct hard_iface *recv_if)
{
struct neigh_node *tmp_neigh_node;
struct neigh_node *router = NULL, *first_candidate = NULL;
@@ -614,7 +616,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
"Routing TT_REQUEST to %pM [%c]\n",
tt_query->dst,
tt_flag);
- return route_unicast_packet(skb, recv_if);
+ return batadv_route_unicast_packet(skb, recv_if);
}
break;
case TT_RESPONSE:
@@ -641,7 +643,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
"Routing TT_RESPONSE to %pM [%c]\n",
tt_query->dst,
tt_flag);
- return route_unicast_packet(skb, recv_if);
+ return batadv_route_unicast_packet(skb, recv_if);
}
break;
}
@@ -677,7 +679,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
roam_adv_packet = (struct roam_adv_packet *)skb->data;
if (!batadv_is_my_mac(roam_adv_packet->dst))
- return route_unicast_packet(skb, recv_if);
+ return batadv_route_unicast_packet(skb, recv_if);
/* check if it is a backbone gateway. we don't accept
* roaming advertisement from it, as it has the same
@@ -781,9 +783,9 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv,
batadv_neigh_node_free_ref(router);
if (bonding_enabled)
- router = find_bond_router(primary_orig_node, recv_if);
+ router = batadv_find_bond_router(primary_orig_node, recv_if);
else
- router = find_ifalter_router(primary_orig_node, recv_if);
+ router = batadv_find_ifalter_router(primary_orig_node, recv_if);
return_router:
if (router && router->if_incoming->if_status != IF_ACTIVE)
@@ -799,7 +801,7 @@ err:
return NULL;
}
-static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
+static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
{
struct ethhdr *ethhdr;
@@ -824,7 +826,8 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
return 0;
}
-static int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
+static int batadv_route_unicast_packet(struct sk_buff *skb,
+ struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct orig_node *orig_node = NULL;
@@ -909,8 +912,8 @@ out:
return ret;
}
-static int check_unicast_ttvn(struct bat_priv *bat_priv,
- struct sk_buff *skb) {
+static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv,
+ struct sk_buff *skb) {
uint8_t curr_ttvn;
struct orig_node *orig_node;
struct ethhdr *ethhdr;
@@ -998,10 +1001,10 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (unicast_packet->header.packet_type == BAT_UNICAST_4ADDR)
hdr_size = sizeof(struct unicast_4addr_packet);
- if (check_unicast_packet(skb, hdr_size) < 0)
+ if (batadv_check_unicast_packet(skb, hdr_size) < 0)
return NET_RX_DROP;
- if (!check_unicast_ttvn(bat_priv, skb))
+ if (!batadv_check_unicast_ttvn(bat_priv, skb))
return NET_RX_DROP;
/* packet for me */
@@ -1011,7 +1014,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
return NET_RX_SUCCESS;
}
- return route_unicast_packet(skb, recv_if);
+ return batadv_route_unicast_packet(skb, recv_if);
}
int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
@@ -1023,10 +1026,10 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
struct sk_buff *new_skb = NULL;
int ret;
- if (check_unicast_packet(skb, hdr_size) < 0)
+ if (batadv_check_unicast_packet(skb, hdr_size) < 0)
return NET_RX_DROP;
- if (!check_unicast_ttvn(bat_priv, skb))
+ if (!batadv_check_unicast_ttvn(bat_priv, skb))
return NET_RX_DROP;
unicast_packet = (struct unicast_frag_packet *)skb->data;
@@ -1048,7 +1051,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
return NET_RX_SUCCESS;
}
- return route_unicast_packet(skb, recv_if);
+ return batadv_route_unicast_packet(skb, recv_if);
}
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-169-g3dbc8e0
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 3dbc8e08a76b9e6b8250ed45afb2f90be5595b38
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat May 12 18:34:00 2012 +0200
batman-adv: Prefix originator local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/originator.c b/originator.c
index 8f908be..970dde5 100644
--- a/originator.c
+++ b/originator.c
@@ -29,17 +29,17 @@
#include "soft-interface.h"
#include "bridge_loop_avoidance.h"
-static void purge_orig(struct work_struct *work);
+static void batadv_purge_orig(struct work_struct *work);
-static void start_purge_timer(struct bat_priv *bat_priv)
+static void batadv_start_purge_timer(struct bat_priv *bat_priv)
{
- INIT_DELAYED_WORK(&bat_priv->orig_work, purge_orig);
+ INIT_DELAYED_WORK(&bat_priv->orig_work, batadv_purge_orig);
queue_delayed_work(batadv_event_workqueue,
&bat_priv->orig_work, msecs_to_jiffies(1000));
}
/* returns 1 if they are the same originator */
-static int compare_orig(const struct hlist_node *node, const void *data2)
+static int batadv_compare_orig(const struct hlist_node *node, const void *data2)
{
const void *data1 = container_of(node, struct orig_node, hash_entry);
@@ -56,7 +56,7 @@ int batadv_originator_init(struct bat_priv *bat_priv)
if (!bat_priv->orig_hash)
goto err;
- start_purge_timer(bat_priv);
+ batadv_start_purge_timer(bat_priv);
return 0;
err:
@@ -111,7 +111,7 @@ out:
return neigh_node;
}
-static void orig_node_free_rcu(struct rcu_head *rcu)
+static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
{
struct hlist_node *node, *node_tmp;
struct neigh_node *neigh_node, *tmp_neigh_node;
@@ -150,7 +150,7 @@ static void orig_node_free_rcu(struct rcu_head *rcu)
void batadv_orig_node_free_ref(struct orig_node *orig_node)
{
if (atomic_dec_and_test(&orig_node->refcount))
- call_rcu(&orig_node->rcu, orig_node_free_rcu);
+ call_rcu(&orig_node->rcu, batadv_orig_node_free_rcu);
}
void batadv_originator_free(struct bat_priv *bat_priv)
@@ -250,7 +250,7 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
if (!orig_node->bcast_own_sum)
goto free_bcast_own;
- hash_added = batadv_hash_add(bat_priv->orig_hash, compare_orig,
+ hash_added = batadv_hash_add(bat_priv->orig_hash, batadv_compare_orig,
batadv_choose_orig, orig_node,
&orig_node->hash_entry);
if (hash_added != 0)
@@ -266,9 +266,9 @@ free_orig_node:
return NULL;
}
-static bool purge_orig_neighbors(struct bat_priv *bat_priv,
- struct orig_node *orig_node,
- struct neigh_node **best_neigh_node)
+static bool batadv_purge_orig_neighbors(struct bat_priv *bat_priv,
+ struct orig_node *orig_node,
+ struct neigh_node **best_neigh_node)
{
struct hlist_node *node, *node_tmp;
struct neigh_node *neigh_node;
@@ -321,8 +321,8 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
return neigh_purged;
}
-static bool purge_orig_node(struct bat_priv *bat_priv,
- struct orig_node *orig_node)
+static bool batadv_purge_orig_node(struct bat_priv *bat_priv,
+ struct orig_node *orig_node)
{
struct neigh_node *best_neigh_node;
@@ -333,8 +333,8 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
jiffies_to_msecs(orig_node->last_seen));
return true;
} else {
- if (purge_orig_neighbors(bat_priv, orig_node,
- &best_neigh_node))
+ if (batadv_purge_orig_neighbors(bat_priv, orig_node,
+ &best_neigh_node))
batadv_update_route(bat_priv, orig_node,
best_neigh_node);
}
@@ -342,7 +342,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
return false;
}
-static void _purge_orig(struct bat_priv *bat_priv)
+static void _batadv_purge_orig(struct bat_priv *bat_priv)
{
struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_node *node, *node_tmp;
@@ -362,7 +362,7 @@ static void _purge_orig(struct bat_priv *bat_priv)
spin_lock_bh(list_lock);
hlist_for_each_entry_safe(orig_node, node, node_tmp,
head, hash_entry) {
- if (purge_orig_node(bat_priv, orig_node)) {
+ if (batadv_purge_orig_node(bat_priv, orig_node)) {
if (orig_node->gw_flags)
batadv_gw_node_delete(bat_priv,
orig_node);
@@ -382,20 +382,20 @@ static void _purge_orig(struct bat_priv *bat_priv)
batadv_gw_election(bat_priv);
}
-static void purge_orig(struct work_struct *work)
+static void batadv_purge_orig(struct work_struct *work)
{
struct delayed_work *delayed_work =
container_of(work, struct delayed_work, work);
struct bat_priv *bat_priv =
container_of(delayed_work, struct bat_priv, orig_work);
- _purge_orig(bat_priv);
- start_purge_timer(bat_priv);
+ _batadv_purge_orig(bat_priv);
+ batadv_start_purge_timer(bat_priv);
}
void batadv_purge_orig_ref(struct bat_priv *bat_priv)
{
- _purge_orig(bat_priv);
+ _batadv_purge_orig(bat_priv);
}
int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
@@ -485,7 +485,7 @@ out:
return ret;
}
-static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
+static int batadv_orig_node_add_if(struct orig_node *orig_node, int max_if_num)
{
void *data_ptr;
@@ -530,7 +530,7 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
spin_lock_bh(&orig_node->ogm_cnt_lock);
- ret = orig_node_add_if(orig_node, max_if_num);
+ ret = batadv_orig_node_add_if(orig_node, max_if_num);
spin_unlock_bh(&orig_node->ogm_cnt_lock);
if (ret == -ENOMEM)
@@ -546,8 +546,8 @@ err:
return -ENOMEM;
}
-static int orig_node_del_if(struct orig_node *orig_node,
- int max_if_num, int del_if_num)
+static int batadv_orig_node_del_if(struct orig_node *orig_node,
+ int max_if_num, int del_if_num)
{
void *data_ptr = NULL;
int chunk_size;
@@ -614,8 +614,8 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
spin_lock_bh(&orig_node->ogm_cnt_lock);
- ret = orig_node_del_if(orig_node, max_if_num,
- hard_iface->if_num);
+ ret = batadv_orig_node_del_if(orig_node, max_if_num,
+ hard_iface->if_num);
spin_unlock_bh(&orig_node->ogm_cnt_lock);
if (ret == -ENOMEM)
--
batman-adv
10 years, 1 month