aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-12 12:33:50 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-24 12:41:40 -0400
commit9e466250ede375482a9a65ca60765d24303099e9 (patch)
treed74ebb84371803fc2ce03a8d8b03f4c007899f72 /net
parent7011d0851b80a1a229acfda37ce08aad903b12d1 (diff)
batman-adv: Prefix bat_debugfs 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@narfation.org>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/bat_debugfs.c143
1 files changed, 72 insertions, 71 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 4001c57a25e4..03f09f0f6d98 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -32,25 +32,25 @@
32#include "icmp_socket.h" 32#include "icmp_socket.h"
33#include "bridge_loop_avoidance.h" 33#include "bridge_loop_avoidance.h"
34 34
35static struct dentry *bat_debugfs; 35static struct dentry *batadv_debugfs;
36 36
37#ifdef CONFIG_BATMAN_ADV_DEBUG 37#ifdef CONFIG_BATMAN_ADV_DEBUG
38#define LOG_BUFF_MASK (log_buff_len-1) 38#define LOG_BUFF_MASK (batadv_log_buff_len - 1)
39#define LOG_BUFF(idx) (debug_log->log_buff[(idx) & LOG_BUFF_MASK]) 39#define LOG_BUFF(idx) (debug_log->log_buff[(idx) & LOG_BUFF_MASK])
40 40
41static int log_buff_len = LOG_BUF_LEN; 41static int batadv_log_buff_len = LOG_BUF_LEN;
42 42
43static void emit_log_char(struct debug_log *debug_log, char c) 43static void batadv_emit_log_char(struct debug_log *debug_log, char c)
44{ 44{
45 LOG_BUFF(debug_log->log_end) = c; 45 LOG_BUFF(debug_log->log_end) = c;
46 debug_log->log_end++; 46 debug_log->log_end++;
47 47
48 if (debug_log->log_end - debug_log->log_start > log_buff_len) 48 if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len)
49 debug_log->log_start = debug_log->log_end - log_buff_len; 49 debug_log->log_start = debug_log->log_end - batadv_log_buff_len;
50} 50}
51 51
52__printf(2, 3) 52__printf(2, 3)
53static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...) 53static int batadv_fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
54{ 54{
55 va_list args; 55 va_list args;
56 static char debug_log_buf[256]; 56 static char debug_log_buf[256];
@@ -65,7 +65,7 @@ static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
65 va_end(args); 65 va_end(args);
66 66
67 for (p = debug_log_buf; *p != 0; p++) 67 for (p = debug_log_buf; *p != 0; p++)
68 emit_log_char(debug_log, *p); 68 batadv_emit_log_char(debug_log, *p);
69 69
70 spin_unlock_bh(&debug_log->lock); 70 spin_unlock_bh(&debug_log->lock);
71 71
@@ -81,14 +81,14 @@ int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
81 81
82 va_start(args, fmt); 82 va_start(args, fmt);
83 vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); 83 vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
84 fdebug_log(bat_priv->debug_log, "[%10u] %s", 84 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s",
85 jiffies_to_msecs(jiffies), tmp_log_buf); 85 jiffies_to_msecs(jiffies), tmp_log_buf);
86 va_end(args); 86 va_end(args);
87 87
88 return 0; 88 return 0;
89} 89}
90 90
91static int log_open(struct inode *inode, struct file *file) 91static int batadv_log_open(struct inode *inode, struct file *file)
92{ 92{
93 nonseekable_open(inode, file); 93 nonseekable_open(inode, file);
94 file->private_data = inode->i_private; 94 file->private_data = inode->i_private;
@@ -96,14 +96,14 @@ static int log_open(struct inode *inode, struct file *file)
96 return 0; 96 return 0;
97} 97}
98 98
99static int log_release(struct inode *inode, struct file *file) 99static int batadv_log_release(struct inode *inode, struct file *file)
100{ 100{
101 batadv_dec_module_count(); 101 batadv_dec_module_count();
102 return 0; 102 return 0;
103} 103}
104 104
105static ssize_t log_read(struct file *file, char __user *buf, 105static ssize_t batadv_log_read(struct file *file, char __user *buf,
106 size_t count, loff_t *ppos) 106 size_t count, loff_t *ppos)
107{ 107{
108 struct bat_priv *bat_priv = file->private_data; 108 struct bat_priv *bat_priv = file->private_data;
109 struct debug_log *debug_log = bat_priv->debug_log; 109 struct debug_log *debug_log = bat_priv->debug_log;
@@ -156,7 +156,7 @@ static ssize_t log_read(struct file *file, char __user *buf,
156 return error; 156 return error;
157} 157}
158 158
159static unsigned int log_poll(struct file *file, poll_table *wait) 159static unsigned int batadv_log_poll(struct file *file, poll_table *wait)
160{ 160{
161 struct bat_priv *bat_priv = file->private_data; 161 struct bat_priv *bat_priv = file->private_data;
162 struct debug_log *debug_log = bat_priv->debug_log; 162 struct debug_log *debug_log = bat_priv->debug_log;
@@ -169,15 +169,15 @@ static unsigned int log_poll(struct file *file, poll_table *wait)
169 return 0; 169 return 0;
170} 170}
171 171
172static const struct file_operations log_fops = { 172static const struct file_operations batadv_log_fops = {
173 .open = log_open, 173 .open = batadv_log_open,
174 .release = log_release, 174 .release = batadv_log_release,
175 .read = log_read, 175 .read = batadv_log_read,
176 .poll = log_poll, 176 .poll = batadv_log_poll,
177 .llseek = no_llseek, 177 .llseek = no_llseek,
178}; 178};
179 179
180static int debug_log_setup(struct bat_priv *bat_priv) 180static int batadv_debug_log_setup(struct bat_priv *bat_priv)
181{ 181{
182 struct dentry *d; 182 struct dentry *d;
183 183
@@ -192,7 +192,8 @@ static int debug_log_setup(struct bat_priv *bat_priv)
192 init_waitqueue_head(&bat_priv->debug_log->queue_wait); 192 init_waitqueue_head(&bat_priv->debug_log->queue_wait);
193 193
194 d = debugfs_create_file("log", S_IFREG | S_IRUSR, 194 d = debugfs_create_file("log", S_IFREG | S_IRUSR,
195 bat_priv->debug_dir, bat_priv, &log_fops); 195 bat_priv->debug_dir, bat_priv,
196 &batadv_log_fops);
196 if (!d) 197 if (!d)
197 goto err; 198 goto err;
198 199
@@ -202,49 +203,49 @@ err:
202 return -ENOMEM; 203 return -ENOMEM;
203} 204}
204 205
205static void debug_log_cleanup(struct bat_priv *bat_priv) 206static void batadv_debug_log_cleanup(struct bat_priv *bat_priv)
206{ 207{
207 kfree(bat_priv->debug_log); 208 kfree(bat_priv->debug_log);
208 bat_priv->debug_log = NULL; 209 bat_priv->debug_log = NULL;
209} 210}
210#else /* CONFIG_BATMAN_ADV_DEBUG */ 211#else /* CONFIG_BATMAN_ADV_DEBUG */
211static int debug_log_setup(struct bat_priv *bat_priv) 212static int batadv_debug_log_setup(struct bat_priv *bat_priv)
212{ 213{
213 bat_priv->debug_log = NULL; 214 bat_priv->debug_log = NULL;
214 return 0; 215 return 0;
215} 216}
216 217
217static void debug_log_cleanup(struct bat_priv *bat_priv) 218static void batadv_debug_log_cleanup(struct bat_priv *bat_priv)
218{ 219{
219 return; 220 return;
220} 221}
221#endif 222#endif
222 223
223static int bat_algorithms_open(struct inode *inode, struct file *file) 224static int batadv_algorithms_open(struct inode *inode, struct file *file)
224{ 225{
225 return single_open(file, batadv_algo_seq_print_text, NULL); 226 return single_open(file, batadv_algo_seq_print_text, NULL);
226} 227}
227 228
228static int originators_open(struct inode *inode, struct file *file) 229static int batadv_originators_open(struct inode *inode, struct file *file)
229{ 230{
230 struct net_device *net_dev = (struct net_device *)inode->i_private; 231 struct net_device *net_dev = (struct net_device *)inode->i_private;
231 return single_open(file, batadv_orig_seq_print_text, net_dev); 232 return single_open(file, batadv_orig_seq_print_text, net_dev);
232} 233}
233 234
234static int gateways_open(struct inode *inode, struct file *file) 235static int batadv_gateways_open(struct inode *inode, struct file *file)
235{ 236{
236 struct net_device *net_dev = (struct net_device *)inode->i_private; 237 struct net_device *net_dev = (struct net_device *)inode->i_private;
237 return single_open(file, batadv_gw_client_seq_print_text, net_dev); 238 return single_open(file, batadv_gw_client_seq_print_text, net_dev);
238} 239}
239 240
240static int transtable_global_open(struct inode *inode, struct file *file) 241static int batadv_transtable_global_open(struct inode *inode, struct file *file)
241{ 242{
242 struct net_device *net_dev = (struct net_device *)inode->i_private; 243 struct net_device *net_dev = (struct net_device *)inode->i_private;
243 return single_open(file, batadv_tt_global_seq_print_text, net_dev); 244 return single_open(file, batadv_tt_global_seq_print_text, net_dev);
244} 245}
245 246
246#ifdef CONFIG_BATMAN_ADV_BLA 247#ifdef CONFIG_BATMAN_ADV_BLA
247static int bla_claim_table_open(struct inode *inode, struct file *file) 248static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
248{ 249{
249 struct net_device *net_dev = (struct net_device *)inode->i_private; 250 struct net_device *net_dev = (struct net_device *)inode->i_private;
250 return single_open(file, batadv_bla_claim_table_seq_print_text, 251 return single_open(file, batadv_bla_claim_table_seq_print_text,
@@ -252,13 +253,13 @@ static int bla_claim_table_open(struct inode *inode, struct file *file)
252} 253}
253#endif 254#endif
254 255
255static int transtable_local_open(struct inode *inode, struct file *file) 256static int batadv_transtable_local_open(struct inode *inode, struct file *file)
256{ 257{
257 struct net_device *net_dev = (struct net_device *)inode->i_private; 258 struct net_device *net_dev = (struct net_device *)inode->i_private;
258 return single_open(file, batadv_tt_local_seq_print_text, net_dev); 259 return single_open(file, batadv_tt_local_seq_print_text, net_dev);
259} 260}
260 261
261static int vis_data_open(struct inode *inode, struct file *file) 262static int batadv_vis_data_open(struct inode *inode, struct file *file)
262{ 263{
263 struct net_device *net_dev = (struct net_device *)inode->i_private; 264 struct net_device *net_dev = (struct net_device *)inode->i_private;
264 return single_open(file, batadv_vis_seq_print_text, net_dev); 265 return single_open(file, batadv_vis_seq_print_text, net_dev);
@@ -269,37 +270,37 @@ struct bat_debuginfo {
269 const struct file_operations fops; 270 const struct file_operations fops;
270}; 271};
271 272
272#define BAT_DEBUGINFO(_name, _mode, _open) \ 273#define BAT_DEBUGINFO(_name, _mode, _open) \
273struct bat_debuginfo bat_debuginfo_##_name = { \ 274struct bat_debuginfo batadv_debuginfo_##_name = { \
274 .attr = { .name = __stringify(_name), \ 275 .attr = { .name = __stringify(_name), \
275 .mode = _mode, }, \ 276 .mode = _mode, }, \
276 .fops = { .owner = THIS_MODULE, \ 277 .fops = { .owner = THIS_MODULE, \
277 .open = _open, \ 278 .open = _open, \
278 .read = seq_read, \ 279 .read = seq_read, \
279 .llseek = seq_lseek, \ 280 .llseek = seq_lseek, \
280 .release = single_release, \ 281 .release = single_release, \
281 } \ 282 } \
282}; 283};
283 284
284static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open); 285static BAT_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open);
285static BAT_DEBUGINFO(originators, S_IRUGO, originators_open); 286static BAT_DEBUGINFO(originators, S_IRUGO, batadv_originators_open);
286static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open); 287static BAT_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open);
287static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open); 288static BAT_DEBUGINFO(transtable_global, S_IRUGO, batadv_transtable_global_open);
288#ifdef CONFIG_BATMAN_ADV_BLA 289#ifdef CONFIG_BATMAN_ADV_BLA
289static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open); 290static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
290#endif 291#endif
291static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open); 292static BAT_DEBUGINFO(transtable_local, S_IRUGO, batadv_transtable_local_open);
292static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open); 293static BAT_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open);
293 294
294static struct bat_debuginfo *mesh_debuginfos[] = { 295static struct bat_debuginfo *batadv_mesh_debuginfos[] = {
295 &bat_debuginfo_originators, 296 &batadv_debuginfo_originators,
296 &bat_debuginfo_gateways, 297 &batadv_debuginfo_gateways,
297 &bat_debuginfo_transtable_global, 298 &batadv_debuginfo_transtable_global,
298#ifdef CONFIG_BATMAN_ADV_BLA 299#ifdef CONFIG_BATMAN_ADV_BLA
299 &bat_debuginfo_bla_claim_table, 300 &batadv_debuginfo_bla_claim_table,
300#endif 301#endif
301 &bat_debuginfo_transtable_local, 302 &batadv_debuginfo_transtable_local,
302 &bat_debuginfo_vis_data, 303 &batadv_debuginfo_vis_data,
303 NULL, 304 NULL,
304}; 305};
305 306
@@ -308,17 +309,17 @@ void batadv_debugfs_init(void)
308 struct bat_debuginfo *bat_debug; 309 struct bat_debuginfo *bat_debug;
309 struct dentry *file; 310 struct dentry *file;
310 311
311 bat_debugfs = debugfs_create_dir(DEBUGFS_BAT_SUBDIR, NULL); 312 batadv_debugfs = debugfs_create_dir(DEBUGFS_BAT_SUBDIR, NULL);
312 if (bat_debugfs == ERR_PTR(-ENODEV)) 313 if (batadv_debugfs == ERR_PTR(-ENODEV))
313 bat_debugfs = NULL; 314 batadv_debugfs = NULL;
314 315
315 if (!bat_debugfs) 316 if (!batadv_debugfs)
316 goto out; 317 goto out;
317 318
318 bat_debug = &bat_debuginfo_routing_algos; 319 bat_debug = &batadv_debuginfo_routing_algos;
319 file = debugfs_create_file(bat_debug->attr.name, 320 file = debugfs_create_file(bat_debug->attr.name,
320 S_IFREG | bat_debug->attr.mode, 321 S_IFREG | bat_debug->attr.mode,
321 bat_debugfs, NULL, &bat_debug->fops); 322 batadv_debugfs, NULL, &bat_debug->fops);
322 if (!file) 323 if (!file)
323 pr_err("Can't add debugfs file: %s\n", bat_debug->attr.name); 324 pr_err("Can't add debugfs file: %s\n", bat_debug->attr.name);
324 325
@@ -328,9 +329,9 @@ out:
328 329
329void batadv_debugfs_destroy(void) 330void batadv_debugfs_destroy(void)
330{ 331{
331 if (bat_debugfs) { 332 if (batadv_debugfs) {
332 debugfs_remove_recursive(bat_debugfs); 333 debugfs_remove_recursive(batadv_debugfs);
333 bat_debugfs = NULL; 334 batadv_debugfs = NULL;
334 } 335 }
335} 336}
336 337
@@ -340,20 +341,20 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
340 struct bat_debuginfo **bat_debug; 341 struct bat_debuginfo **bat_debug;
341 struct dentry *file; 342 struct dentry *file;
342 343
343 if (!bat_debugfs) 344 if (!batadv_debugfs)
344 goto out; 345 goto out;
345 346
346 bat_priv->debug_dir = debugfs_create_dir(dev->name, bat_debugfs); 347 bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs);
347 if (!bat_priv->debug_dir) 348 if (!bat_priv->debug_dir)
348 goto out; 349 goto out;
349 350
350 if (batadv_socket_setup(bat_priv) < 0) 351 if (batadv_socket_setup(bat_priv) < 0)
351 goto rem_attr; 352 goto rem_attr;
352 353
353 if (debug_log_setup(bat_priv) < 0) 354 if (batadv_debug_log_setup(bat_priv) < 0)
354 goto rem_attr; 355 goto rem_attr;
355 356
356 for (bat_debug = mesh_debuginfos; *bat_debug; ++bat_debug) { 357 for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) {
357 file = debugfs_create_file(((*bat_debug)->attr).name, 358 file = debugfs_create_file(((*bat_debug)->attr).name,
358 S_IFREG | ((*bat_debug)->attr).mode, 359 S_IFREG | ((*bat_debug)->attr).mode,
359 bat_priv->debug_dir, 360 bat_priv->debug_dir,
@@ -381,9 +382,9 @@ void batadv_debugfs_del_meshif(struct net_device *dev)
381{ 382{
382 struct bat_priv *bat_priv = netdev_priv(dev); 383 struct bat_priv *bat_priv = netdev_priv(dev);
383 384
384 debug_log_cleanup(bat_priv); 385 batadv_debug_log_cleanup(bat_priv);
385 386
386 if (bat_debugfs) { 387 if (batadv_debugfs) {
387 debugfs_remove_recursive(bat_priv->debug_dir); 388 debugfs_remove_recursive(bat_priv->debug_dir);
388 bat_priv->debug_dir = NULL; 389 bat_priv->debug_dir = NULL;
389 } 390 }