aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2012-12-25 04:03:20 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-01-19 08:18:10 -0500
commit0abf5d8117dc864135eda5adda12640e16ed0cb8 (patch)
tree49d97ffda89784ac1751ea7dd4a77196a6252e98 /net
parentb6d0ab7ca306f3363a5996570ae8772d57d61846 (diff)
batman-adv: mark debug_log struct as bat_priv only struct
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/debugfs.c13
-rw-r--r--net/batman-adv/types.h25
2 files changed, 20 insertions, 18 deletions
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 55a90078dc66..e47555b4280e 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -40,13 +40,14 @@ static struct dentry *batadv_debugfs;
40 40
41static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN; 41static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN;
42 42
43static char *batadv_log_char_addr(struct batadv_debug_log *debug_log, 43static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log,
44 size_t idx) 44 size_t idx)
45{ 45{
46 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; 46 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK];
47} 47}
48 48
49static void batadv_emit_log_char(struct batadv_debug_log *debug_log, char c) 49static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log,
50 char c)
50{ 51{
51 char *char_addr; 52 char *char_addr;
52 53
@@ -59,7 +60,7 @@ static void batadv_emit_log_char(struct batadv_debug_log *debug_log, char c)
59} 60}
60 61
61__printf(2, 3) 62__printf(2, 3)
62static int batadv_fdebug_log(struct batadv_debug_log *debug_log, 63static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
63 const char *fmt, ...) 64 const char *fmt, ...)
64{ 65{
65 va_list args; 66 va_list args;
@@ -114,7 +115,7 @@ static int batadv_log_release(struct inode *inode, struct file *file)
114 return 0; 115 return 0;
115} 116}
116 117
117static int batadv_log_empty(struct batadv_debug_log *debug_log) 118static int batadv_log_empty(struct batadv_priv_debug_log *debug_log)
118{ 119{
119 return !(debug_log->log_start - debug_log->log_end); 120 return !(debug_log->log_start - debug_log->log_end);
120} 121}
@@ -123,7 +124,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
123 size_t count, loff_t *ppos) 124 size_t count, loff_t *ppos)
124{ 125{
125 struct batadv_priv *bat_priv = file->private_data; 126 struct batadv_priv *bat_priv = file->private_data;
126 struct batadv_debug_log *debug_log = bat_priv->debug_log; 127 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
127 int error, i = 0; 128 int error, i = 0;
128 char *char_addr; 129 char *char_addr;
129 char c; 130 char c;
@@ -177,7 +178,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
177static unsigned int batadv_log_poll(struct file *file, poll_table *wait) 178static unsigned int batadv_log_poll(struct file *file, poll_table *wait)
178{ 179{
179 struct batadv_priv *bat_priv = file->private_data; 180 struct batadv_priv *bat_priv = file->private_data;
180 struct batadv_debug_log *debug_log = bat_priv->debug_log; 181 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
181 182
182 poll_wait(file, &debug_log->queue_wait, wait); 183 poll_wait(file, &debug_log->queue_wait, wait);
183 184
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index dffbdffc79a4..db3fb252432d 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -233,6 +233,16 @@ struct batadv_priv_bla {
233}; 233};
234#endif 234#endif
235 235
236#ifdef CONFIG_BATMAN_ADV_DEBUG
237struct batadv_priv_debug_log {
238 char log_buff[BATADV_LOG_BUF_LEN];
239 unsigned long log_start;
240 unsigned long log_end;
241 spinlock_t lock; /* protects log_buff, log_start and log_end */
242 wait_queue_head_t queue_wait;
243};
244#endif
245
236struct batadv_priv_gw { 246struct batadv_priv_gw {
237 struct hlist_head list; 247 struct hlist_head list;
238 spinlock_t list_lock; /* protects gw_list and curr_gw */ 248 spinlock_t list_lock; /* protects gw_list and curr_gw */
@@ -290,9 +300,6 @@ struct batadv_priv {
290 atomic_t bcast_queue_left; 300 atomic_t bcast_queue_left;
291 atomic_t batman_queue_left; 301 atomic_t batman_queue_left;
292 char num_ifaces; 302 char num_ifaces;
293#ifdef CONFIG_BATMAN_ADV_DEBUG
294 struct batadv_debug_log *debug_log;
295#endif
296 struct kobject *mesh_obj; 303 struct kobject *mesh_obj;
297 struct dentry *debug_dir; 304 struct dentry *debug_dir;
298 struct hlist_head forw_bat_list; 305 struct hlist_head forw_bat_list;
@@ -306,6 +313,9 @@ struct batadv_priv {
306#ifdef CONFIG_BATMAN_ADV_BLA 313#ifdef CONFIG_BATMAN_ADV_BLA
307 struct batadv_priv_bla bla; 314 struct batadv_priv_bla bla;
308#endif 315#endif
316#ifdef CONFIG_BATMAN_ADV_DEBUG
317 struct batadv_priv_debug_log *debug_log;
318#endif
309 struct batadv_priv_gw gw; 319 struct batadv_priv_gw gw;
310 struct batadv_priv_tt tt; 320 struct batadv_priv_tt tt;
311 struct batadv_priv_vis vis; 321 struct batadv_priv_vis vis;
@@ -425,15 +435,6 @@ struct batadv_if_list_entry {
425 bool primary; 435 bool primary;
426 struct hlist_node list; 436 struct hlist_node list;
427}; 437};
428
429struct batadv_debug_log {
430 char log_buff[BATADV_LOG_BUF_LEN];
431 unsigned long log_start;
432 unsigned long log_end;
433 spinlock_t lock; /* protects log_buff, log_start and log_end */
434 wait_queue_head_t queue_wait;
435};
436
437struct batadv_frag_packet_list_entry { 438struct batadv_frag_packet_list_entry {
438 struct list_head list; 439 struct list_head list;
439 uint16_t seqno; 440 uint16_t seqno;