Commit 84d5e5e003752bc56b413f8d2c3fcfeeec066145
Committed by
Antonio Quartulli
1 parent
7cf06bc6ff
batman-adv: Prefix gateway-common non-static functions with batadv_
batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Showing 4 changed files with 16 additions and 12 deletions Side-by-side Diff
net/batman-adv/bat_sysfs.c
... | ... | @@ -409,7 +409,7 @@ |
409 | 409 | int down, up; |
410 | 410 | int gw_bandwidth = atomic_read(&bat_priv->gw_bandwidth); |
411 | 411 | |
412 | - gw_bandwidth_to_kbit(gw_bandwidth, &down, &up); | |
412 | + batadv_gw_bandwidth_to_kbit(gw_bandwidth, &down, &up); | |
413 | 413 | return sprintf(buff, "%i%s/%i%s\n", |
414 | 414 | (down > 2048 ? down / 1024 : down), |
415 | 415 | (down > 2048 ? "MBit" : "KBit"), |
... | ... | @@ -425,7 +425,7 @@ |
425 | 425 | if (buff[count - 1] == '\n') |
426 | 426 | buff[count - 1] = '\0'; |
427 | 427 | |
428 | - return gw_bandwidth_set(net_dev, buff, count); | |
428 | + return batadv_gw_bandwidth_set(net_dev, buff, count); | |
429 | 429 | } |
430 | 430 | |
431 | 431 | BAT_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); |
net/batman-adv/gateway_client.c
... | ... | @@ -116,13 +116,15 @@ |
116 | 116 | uint32_t max_gw_factor = 0, tmp_gw_factor = 0; |
117 | 117 | uint8_t max_tq = 0; |
118 | 118 | int down, up; |
119 | + struct orig_node *orig_node; | |
119 | 120 | |
120 | 121 | rcu_read_lock(); |
121 | 122 | hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { |
122 | 123 | if (gw_node->deleted) |
123 | 124 | continue; |
124 | 125 | |
125 | - router = orig_node_get_router(gw_node->orig_node); | |
126 | + orig_node = gw_node->orig_node; | |
127 | + router = orig_node_get_router(orig_node); | |
126 | 128 | if (!router) |
127 | 129 | continue; |
128 | 130 | |
... | ... | @@ -131,8 +133,8 @@ |
131 | 133 | |
132 | 134 | switch (atomic_read(&bat_priv->gw_sel_class)) { |
133 | 135 | case 1: /* fast connection */ |
134 | - gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, | |
135 | - &down, &up); | |
136 | + batadv_gw_bandwidth_to_kbit(orig_node->gw_flags, | |
137 | + &down, &up); | |
136 | 138 | |
137 | 139 | tmp_gw_factor = (router->tq_avg * router->tq_avg * |
138 | 140 | down * 100 * 100) / |
... | ... | @@ -319,7 +321,7 @@ |
319 | 321 | hlist_add_head_rcu(&gw_node->list, &bat_priv->gw_list); |
320 | 322 | spin_unlock_bh(&bat_priv->gw_list_lock); |
321 | 323 | |
322 | - gw_bandwidth_to_kbit(new_gwflags, &down, &up); | |
324 | + batadv_gw_bandwidth_to_kbit(new_gwflags, &down, &up); | |
323 | 325 | bat_dbg(DBG_BATMAN, bat_priv, |
324 | 326 | "Found new gateway %pM -> gw_class: %i - %i%s/%i%s\n", |
325 | 327 | orig_node->orig, new_gwflags, |
... | ... | @@ -434,7 +436,7 @@ |
434 | 436 | struct neigh_node *router; |
435 | 437 | int down, up, ret = -1; |
436 | 438 | |
437 | - gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, &down, &up); | |
439 | + batadv_gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, &down, &up); | |
438 | 440 | |
439 | 441 | router = orig_node_get_router(gw_node->orig_node); |
440 | 442 | if (!router) |
net/batman-adv/gateway_common.c
... | ... | @@ -59,7 +59,7 @@ |
59 | 59 | } |
60 | 60 | |
61 | 61 | /* returns the up and downspeeds in kbit, calculated from the class */ |
62 | -void gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up) | |
62 | +void batadv_gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up) | |
63 | 63 | { |
64 | 64 | int sbit = (gw_srv_class & 0x80) >> 7; |
65 | 65 | int dpart = (gw_srv_class & 0x78) >> 3; |
... | ... | @@ -136,7 +136,8 @@ |
136 | 136 | return true; |
137 | 137 | } |
138 | 138 | |
139 | -ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count) | |
139 | +ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, | |
140 | + size_t count) | |
140 | 141 | { |
141 | 142 | struct bat_priv *bat_priv = netdev_priv(net_dev); |
142 | 143 | long gw_bandwidth_tmp = 0; |
... | ... | @@ -160,7 +161,7 @@ |
160 | 161 | * speeds, hence we need to calculate it back to show the number |
161 | 162 | * that is going to be propagated |
162 | 163 | **/ |
163 | - gw_bandwidth_to_kbit((uint8_t)gw_bandwidth_tmp, &down, &up); | |
164 | + batadv_gw_bandwidth_to_kbit((uint8_t)gw_bandwidth_tmp, &down, &up); | |
164 | 165 | |
165 | 166 | if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp) |
166 | 167 | return count; |
net/batman-adv/gateway_common.h
... | ... | @@ -32,8 +32,9 @@ |
32 | 32 | #define GW_MODE_CLIENT_NAME "client" |
33 | 33 | #define GW_MODE_SERVER_NAME "server" |
34 | 34 | |
35 | -void gw_bandwidth_to_kbit(uint8_t gw_class, int *down, int *up); | |
36 | -ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count); | |
35 | +void batadv_gw_bandwidth_to_kbit(uint8_t gw_class, int *down, int *up); | |
36 | +ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, | |
37 | + size_t count); | |
37 | 38 | |
38 | 39 | #endif /* _NET_BATMAN_ADV_GATEWAY_COMMON_H_ */ |