Commit 0abf5d81 authored by Marek Lindner's avatar Marek Lindner Committed by Antonio Quartulli

batman-adv: mark debug_log struct as bat_priv only struct

Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent b6d0ab7c
...@@ -40,13 +40,14 @@ static struct dentry *batadv_debugfs; ...@@ -40,13 +40,14 @@ static struct dentry *batadv_debugfs;
static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN; static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN;
static char *batadv_log_char_addr(struct batadv_debug_log *debug_log, static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log,
size_t idx) size_t idx)
{ {
return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK];
} }
static void batadv_emit_log_char(struct batadv_debug_log *debug_log, char c) static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log,
char c)
{ {
char *char_addr; char *char_addr;
...@@ -59,7 +60,7 @@ static void batadv_emit_log_char(struct batadv_debug_log *debug_log, char c) ...@@ -59,7 +60,7 @@ static void batadv_emit_log_char(struct batadv_debug_log *debug_log, char c)
} }
__printf(2, 3) __printf(2, 3)
static int batadv_fdebug_log(struct batadv_debug_log *debug_log, static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
const char *fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
...@@ -114,7 +115,7 @@ static int batadv_log_release(struct inode *inode, struct file *file) ...@@ -114,7 +115,7 @@ static int batadv_log_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static int batadv_log_empty(struct batadv_debug_log *debug_log) static int batadv_log_empty(struct batadv_priv_debug_log *debug_log)
{ {
return !(debug_log->log_start - debug_log->log_end); return !(debug_log->log_start - debug_log->log_end);
} }
...@@ -123,7 +124,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, ...@@ -123,7 +124,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct batadv_priv *bat_priv = file->private_data; struct batadv_priv *bat_priv = file->private_data;
struct batadv_debug_log *debug_log = bat_priv->debug_log; struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
int error, i = 0; int error, i = 0;
char *char_addr; char *char_addr;
char c; char c;
...@@ -177,7 +178,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, ...@@ -177,7 +178,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
static unsigned int batadv_log_poll(struct file *file, poll_table *wait) static unsigned int batadv_log_poll(struct file *file, poll_table *wait)
{ {
struct batadv_priv *bat_priv = file->private_data; struct batadv_priv *bat_priv = file->private_data;
struct batadv_debug_log *debug_log = bat_priv->debug_log; struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
poll_wait(file, &debug_log->queue_wait, wait); poll_wait(file, &debug_log->queue_wait, wait);
......
...@@ -233,6 +233,16 @@ struct batadv_priv_bla { ...@@ -233,6 +233,16 @@ struct batadv_priv_bla {
}; };
#endif #endif
#ifdef CONFIG_BATMAN_ADV_DEBUG
struct batadv_priv_debug_log {
char log_buff[BATADV_LOG_BUF_LEN];
unsigned long log_start;
unsigned long log_end;
spinlock_t lock; /* protects log_buff, log_start and log_end */
wait_queue_head_t queue_wait;
};
#endif
struct batadv_priv_gw { struct batadv_priv_gw {
struct hlist_head list; struct hlist_head list;
spinlock_t list_lock; /* protects gw_list and curr_gw */ spinlock_t list_lock; /* protects gw_list and curr_gw */
...@@ -290,9 +300,6 @@ struct batadv_priv { ...@@ -290,9 +300,6 @@ struct batadv_priv {
atomic_t bcast_queue_left; atomic_t bcast_queue_left;
atomic_t batman_queue_left; atomic_t batman_queue_left;
char num_ifaces; char num_ifaces;
#ifdef CONFIG_BATMAN_ADV_DEBUG
struct batadv_debug_log *debug_log;
#endif
struct kobject *mesh_obj; struct kobject *mesh_obj;
struct dentry *debug_dir; struct dentry *debug_dir;
struct hlist_head forw_bat_list; struct hlist_head forw_bat_list;
...@@ -305,6 +312,9 @@ struct batadv_priv { ...@@ -305,6 +312,9 @@ struct batadv_priv {
struct batadv_algo_ops *bat_algo_ops; struct batadv_algo_ops *bat_algo_ops;
#ifdef CONFIG_BATMAN_ADV_BLA #ifdef CONFIG_BATMAN_ADV_BLA
struct batadv_priv_bla bla; struct batadv_priv_bla bla;
#endif
#ifdef CONFIG_BATMAN_ADV_DEBUG
struct batadv_priv_debug_log *debug_log;
#endif #endif
struct batadv_priv_gw gw; struct batadv_priv_gw gw;
struct batadv_priv_tt tt; struct batadv_priv_tt tt;
...@@ -425,15 +435,6 @@ struct batadv_if_list_entry { ...@@ -425,15 +435,6 @@ struct batadv_if_list_entry {
bool primary; bool primary;
struct hlist_node list; struct hlist_node list;
}; };
struct batadv_debug_log {
char log_buff[BATADV_LOG_BUF_LEN];
unsigned long log_start;
unsigned long log_end;
spinlock_t lock; /* protects log_buff, log_start and log_end */
wait_queue_head_t queue_wait;
};
struct batadv_frag_packet_list_entry { struct batadv_frag_packet_list_entry {
struct list_head list; struct list_head list;
uint16_t seqno; uint16_t seqno;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment