diff options
author | Sven Eckelmann <sven@narfation.org> | 2016-05-15 17:48:31 -0400 |
---|---|---|
committer | Simon Wunderlich <sw@simonwunderlich.de> | 2016-06-30 04:29:43 -0400 |
commit | ba412080fb6461b5a40dbc5e44186ed029d67b8d (patch) | |
tree | 5db650b562d40b428f0249ef14932ddb908921a0 | |
parent | 01d350d14712d1e8dbf2b00c82d2fc7c48d34e04 (diff) |
batman-adv: Consolidate logging related functions
There are several places in batman-adv which provide logging related
functions. These should be grouped together in the log.* files to make them
easier to find.
Reported-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
-rw-r--r-- | net/batman-adv/Makefile | 1 | ||||
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 1 | ||||
-rw-r--r-- | net/batman-adv/bat_v_elp.c | 1 | ||||
-rw-r--r-- | net/batman-adv/bat_v_ogm.c | 1 | ||||
-rw-r--r-- | net/batman-adv/bitarray.c | 2 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 1 | ||||
-rw-r--r-- | net/batman-adv/debugfs.c | 216 | ||||
-rw-r--r-- | net/batman-adv/distributed-arp-table.c | 1 | ||||
-rw-r--r-- | net/batman-adv/gateway_client.c | 1 | ||||
-rw-r--r-- | net/batman-adv/gateway_common.c | 1 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 1 | ||||
-rw-r--r-- | net/batman-adv/icmp_socket.c | 1 | ||||
-rw-r--r-- | net/batman-adv/log.c | 231 | ||||
-rw-r--r-- | net/batman-adv/log.h | 109 | ||||
-rw-r--r-- | net/batman-adv/main.c | 2 | ||||
-rw-r--r-- | net/batman-adv/main.h | 69 | ||||
-rw-r--r-- | net/batman-adv/multicast.c | 1 | ||||
-rw-r--r-- | net/batman-adv/network-coding.c | 1 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 1 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 1 | ||||
-rw-r--r-- | net/batman-adv/send.c | 1 | ||||
-rw-r--r-- | net/batman-adv/sysfs.c | 1 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 1 |
23 files changed, 364 insertions, 282 deletions
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile index 5260c17e2069..a55f4ec97068 100644 --- a/net/batman-adv/Makefile +++ b/net/batman-adv/Makefile | |||
@@ -32,6 +32,7 @@ batman-adv-y += gateway_common.o | |||
32 | batman-adv-y += hard-interface.o | 32 | batman-adv-y += hard-interface.o |
33 | batman-adv-y += hash.o | 33 | batman-adv-y += hash.o |
34 | batman-adv-y += icmp_socket.o | 34 | batman-adv-y += icmp_socket.o |
35 | batman-adv-$(CONFIG_BATMAN_ADV_DEBUG) += log.o | ||
35 | batman-adv-y += main.o | 36 | batman-adv-y += main.o |
36 | batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o | 37 | batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o |
37 | batman-adv-$(CONFIG_BATMAN_ADV_NC) += network-coding.o | 38 | batman-adv-$(CONFIG_BATMAN_ADV_NC) += network-coding.o |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 948a5b45474d..805532a95860 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "bitarray.h" | 52 | #include "bitarray.h" |
53 | #include "hard-interface.h" | 53 | #include "hard-interface.h" |
54 | #include "hash.h" | 54 | #include "hash.h" |
55 | #include "log.h" | ||
55 | #include "network-coding.h" | 56 | #include "network-coding.h" |
56 | #include "originator.h" | 57 | #include "originator.h" |
57 | #include "packet.h" | 58 | #include "packet.h" |
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index cf0262becd08..15cf2726d6a5 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "bat_algo.h" | 43 | #include "bat_algo.h" |
44 | #include "bat_v_ogm.h" | 44 | #include "bat_v_ogm.h" |
45 | #include "hard-interface.h" | 45 | #include "hard-interface.h" |
46 | #include "log.h" | ||
46 | #include "originator.h" | 47 | #include "originator.h" |
47 | #include "packet.h" | 48 | #include "packet.h" |
48 | #include "routing.h" | 49 | #include "routing.h" |
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 93e3d760bfe0..7ac9e0b30618 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "bat_algo.h" | 42 | #include "bat_algo.h" |
43 | #include "hard-interface.h" | 43 | #include "hard-interface.h" |
44 | #include "hash.h" | 44 | #include "hash.h" |
45 | #include "log.h" | ||
45 | #include "originator.h" | 46 | #include "originator.h" |
46 | #include "packet.h" | 47 | #include "packet.h" |
47 | #include "routing.h" | 48 | #include "routing.h" |
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index a0c7913837a5..032271421a20 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #include <linux/bitmap.h> | 21 | #include <linux/bitmap.h> |
22 | 22 | ||
23 | #include "log.h" | ||
24 | |||
23 | /* shift the packet array by n places. */ | 25 | /* shift the packet array by n places. */ |
24 | static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n) | 26 | static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n) |
25 | { | 27 | { |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 748a9ead7ce5..e4f7494fb974 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -48,6 +48,7 @@ | |||
48 | 48 | ||
49 | #include "hard-interface.h" | 49 | #include "hard-interface.h" |
50 | #include "hash.h" | 50 | #include "hash.h" |
51 | #include "log.h" | ||
51 | #include "originator.h" | 52 | #include "originator.h" |
52 | #include "packet.h" | 53 | #include "packet.h" |
53 | #include "sysfs.h" | 54 | #include "sysfs.h" |
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index 227c84b9db03..1d68b6e63b96 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c | |||
@@ -18,37 +18,26 @@ | |||
18 | #include "debugfs.h" | 18 | #include "debugfs.h" |
19 | #include "main.h" | 19 | #include "main.h" |
20 | 20 | ||
21 | #include <linux/compiler.h> | ||
22 | #include <linux/debugfs.h> | 21 | #include <linux/debugfs.h> |
23 | #include <linux/device.h> | 22 | #include <linux/device.h> |
24 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
25 | #include <linux/export.h> | 24 | #include <linux/export.h> |
26 | #include <linux/fcntl.h> | ||
27 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
28 | #include <linux/jiffies.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
32 | #include <linux/poll.h> | ||
33 | #include <linux/printk.h> | 27 | #include <linux/printk.h> |
34 | #include <linux/sched.h> /* for linux/wait.h */ | 28 | #include <linux/sched.h> /* for linux/wait.h */ |
35 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
36 | #include <linux/slab.h> | ||
37 | #include <linux/spinlock.h> | ||
38 | #include <linux/stat.h> | 30 | #include <linux/stat.h> |
39 | #include <linux/stddef.h> | 31 | #include <linux/stddef.h> |
40 | #include <linux/stringify.h> | 32 | #include <linux/stringify.h> |
41 | #include <linux/sysfs.h> | 33 | #include <linux/sysfs.h> |
42 | #include <linux/types.h> | ||
43 | #include <linux/uaccess.h> | ||
44 | #include <linux/wait.h> | ||
45 | #include <stdarg.h> | ||
46 | 34 | ||
47 | #include "bat_algo.h" | 35 | #include "bat_algo.h" |
48 | #include "bridge_loop_avoidance.h" | 36 | #include "bridge_loop_avoidance.h" |
49 | #include "distributed-arp-table.h" | 37 | #include "distributed-arp-table.h" |
50 | #include "gateway_client.h" | 38 | #include "gateway_client.h" |
51 | #include "icmp_socket.h" | 39 | #include "icmp_socket.h" |
40 | #include "log.h" | ||
52 | #include "multicast.h" | 41 | #include "multicast.h" |
53 | #include "network-coding.h" | 42 | #include "network-coding.h" |
54 | #include "originator.h" | 43 | #include "originator.h" |
@@ -56,209 +45,6 @@ | |||
56 | 45 | ||
57 | static struct dentry *batadv_debugfs; | 46 | static struct dentry *batadv_debugfs; |
58 | 47 | ||
59 | #ifdef CONFIG_BATMAN_ADV_DEBUG | ||
60 | #define BATADV_LOG_BUFF_MASK (batadv_log_buff_len - 1) | ||
61 | |||
62 | static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN; | ||
63 | |||
64 | static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log, | ||
65 | size_t idx) | ||
66 | { | ||
67 | return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; | ||
68 | } | ||
69 | |||
70 | static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log, | ||
71 | char c) | ||
72 | { | ||
73 | char *char_addr; | ||
74 | |||
75 | char_addr = batadv_log_char_addr(debug_log, debug_log->log_end); | ||
76 | *char_addr = c; | ||
77 | debug_log->log_end++; | ||
78 | |||
79 | if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) | ||
80 | debug_log->log_start = debug_log->log_end - batadv_log_buff_len; | ||
81 | } | ||
82 | |||
83 | __printf(2, 3) | ||
84 | static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log, | ||
85 | const char *fmt, ...) | ||
86 | { | ||
87 | va_list args; | ||
88 | static char debug_log_buf[256]; | ||
89 | char *p; | ||
90 | |||
91 | if (!debug_log) | ||
92 | return 0; | ||
93 | |||
94 | spin_lock_bh(&debug_log->lock); | ||
95 | va_start(args, fmt); | ||
96 | vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, args); | ||
97 | va_end(args); | ||
98 | |||
99 | for (p = debug_log_buf; *p != 0; p++) | ||
100 | batadv_emit_log_char(debug_log, *p); | ||
101 | |||
102 | spin_unlock_bh(&debug_log->lock); | ||
103 | |||
104 | wake_up(&debug_log->queue_wait); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) | ||
110 | { | ||
111 | va_list args; | ||
112 | char tmp_log_buf[256]; | ||
113 | |||
114 | va_start(args, fmt); | ||
115 | vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); | ||
116 | batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s", | ||
117 | jiffies_to_msecs(jiffies), tmp_log_buf); | ||
118 | va_end(args); | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static int batadv_log_open(struct inode *inode, struct file *file) | ||
124 | { | ||
125 | if (!try_module_get(THIS_MODULE)) | ||
126 | return -EBUSY; | ||
127 | |||
128 | nonseekable_open(inode, file); | ||
129 | file->private_data = inode->i_private; | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | static int batadv_log_release(struct inode *inode, struct file *file) | ||
134 | { | ||
135 | module_put(THIS_MODULE); | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static bool batadv_log_empty(struct batadv_priv_debug_log *debug_log) | ||
140 | { | ||
141 | return !(debug_log->log_start - debug_log->log_end); | ||
142 | } | ||
143 | |||
144 | static ssize_t batadv_log_read(struct file *file, char __user *buf, | ||
145 | size_t count, loff_t *ppos) | ||
146 | { | ||
147 | struct batadv_priv *bat_priv = file->private_data; | ||
148 | struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; | ||
149 | int error, i = 0; | ||
150 | char *char_addr; | ||
151 | char c; | ||
152 | |||
153 | if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log)) | ||
154 | return -EAGAIN; | ||
155 | |||
156 | if (!buf) | ||
157 | return -EINVAL; | ||
158 | |||
159 | if (count == 0) | ||
160 | return 0; | ||
161 | |||
162 | if (!access_ok(VERIFY_WRITE, buf, count)) | ||
163 | return -EFAULT; | ||
164 | |||
165 | error = wait_event_interruptible(debug_log->queue_wait, | ||
166 | (!batadv_log_empty(debug_log))); | ||
167 | |||
168 | if (error) | ||
169 | return error; | ||
170 | |||
171 | spin_lock_bh(&debug_log->lock); | ||
172 | |||
173 | while ((!error) && (i < count) && | ||
174 | (debug_log->log_start != debug_log->log_end)) { | ||
175 | char_addr = batadv_log_char_addr(debug_log, | ||
176 | debug_log->log_start); | ||
177 | c = *char_addr; | ||
178 | |||
179 | debug_log->log_start++; | ||
180 | |||
181 | spin_unlock_bh(&debug_log->lock); | ||
182 | |||
183 | error = __put_user(c, buf); | ||
184 | |||
185 | spin_lock_bh(&debug_log->lock); | ||
186 | |||
187 | buf++; | ||
188 | i++; | ||
189 | } | ||
190 | |||
191 | spin_unlock_bh(&debug_log->lock); | ||
192 | |||
193 | if (!error) | ||
194 | return i; | ||
195 | |||
196 | return error; | ||
197 | } | ||
198 | |||
199 | static unsigned int batadv_log_poll(struct file *file, poll_table *wait) | ||
200 | { | ||
201 | struct batadv_priv *bat_priv = file->private_data; | ||
202 | struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; | ||
203 | |||
204 | poll_wait(file, &debug_log->queue_wait, wait); | ||
205 | |||
206 | if (!batadv_log_empty(debug_log)) | ||
207 | return POLLIN | POLLRDNORM; | ||
208 | |||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | static const struct file_operations batadv_log_fops = { | ||
213 | .open = batadv_log_open, | ||
214 | .release = batadv_log_release, | ||
215 | .read = batadv_log_read, | ||
216 | .poll = batadv_log_poll, | ||
217 | .llseek = no_llseek, | ||
218 | }; | ||
219 | |||
220 | static int batadv_debug_log_setup(struct batadv_priv *bat_priv) | ||
221 | { | ||
222 | struct dentry *d; | ||
223 | |||
224 | if (!bat_priv->debug_dir) | ||
225 | goto err; | ||
226 | |||
227 | bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); | ||
228 | if (!bat_priv->debug_log) | ||
229 | goto err; | ||
230 | |||
231 | spin_lock_init(&bat_priv->debug_log->lock); | ||
232 | init_waitqueue_head(&bat_priv->debug_log->queue_wait); | ||
233 | |||
234 | d = debugfs_create_file("log", S_IFREG | S_IRUSR, | ||
235 | bat_priv->debug_dir, bat_priv, | ||
236 | &batadv_log_fops); | ||
237 | if (!d) | ||
238 | goto err; | ||
239 | |||
240 | return 0; | ||
241 | |||
242 | err: | ||
243 | return -ENOMEM; | ||
244 | } | ||
245 | |||
246 | static void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) | ||
247 | { | ||
248 | kfree(bat_priv->debug_log); | ||
249 | bat_priv->debug_log = NULL; | ||
250 | } | ||
251 | #else /* CONFIG_BATMAN_ADV_DEBUG */ | ||
252 | static int batadv_debug_log_setup(struct batadv_priv *bat_priv) | ||
253 | { | ||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | static void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) | ||
258 | { | ||
259 | } | ||
260 | #endif | ||
261 | |||
262 | static int batadv_algorithms_open(struct inode *inode, struct file *file) | 48 | static int batadv_algorithms_open(struct inode *inode, struct file *file) |
263 | { | 49 | { |
264 | return single_open(file, batadv_algo_seq_print_text, NULL); | 50 | return single_open(file, batadv_algo_seq_print_text, NULL); |
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 584b82744699..fa7646532a13 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -45,6 +45,7 @@ | |||
45 | 45 | ||
46 | #include "hard-interface.h" | 46 | #include "hard-interface.h" |
47 | #include "hash.h" | 47 | #include "hash.h" |
48 | #include "log.h" | ||
48 | #include "originator.h" | 49 | #include "originator.h" |
49 | #include "send.h" | 50 | #include "send.h" |
50 | #include "translation-table.h" | 51 | #include "translation-table.h" |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 18c3715e5e27..63a805d3f96e 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | #include "gateway_common.h" | 43 | #include "gateway_common.h" |
44 | #include "hard-interface.h" | 44 | #include "hard-interface.h" |
45 | #include "log.h" | ||
45 | #include "originator.h" | 46 | #include "originator.h" |
46 | #include "packet.h" | 47 | #include "packet.h" |
47 | #include "routing.h" | 48 | #include "routing.h" |
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index 6a6f2d4987e5..d7bc6a87bcc9 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | 29 | ||
30 | #include "gateway_client.h" | 30 | #include "gateway_client.h" |
31 | #include "log.h" | ||
31 | #include "packet.h" | 32 | #include "packet.h" |
32 | #include "tvlv.h" | 33 | #include "tvlv.h" |
33 | 34 | ||
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index a3483f60c3a1..ad2c37c5583b 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "debugfs.h" | 42 | #include "debugfs.h" |
43 | #include "distributed-arp-table.h" | 43 | #include "distributed-arp-table.h" |
44 | #include "gateway_client.h" | 44 | #include "gateway_client.h" |
45 | #include "log.h" | ||
45 | #include "originator.h" | 46 | #include "originator.h" |
46 | #include "packet.h" | 47 | #include "packet.h" |
47 | #include "send.h" | 48 | #include "send.h" |
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 777aea10cd8f..378cc1119d66 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/wait.h> | 45 | #include <linux/wait.h> |
46 | 46 | ||
47 | #include "hard-interface.h" | 47 | #include "hard-interface.h" |
48 | #include "log.h" | ||
48 | #include "originator.h" | 49 | #include "originator.h" |
49 | #include "packet.h" | 50 | #include "packet.h" |
50 | #include "send.h" | 51 | #include "send.h" |
diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c new file mode 100644 index 000000000000..56dc532f7a2c --- /dev/null +++ b/net/batman-adv/log.c | |||
@@ -0,0 +1,231 @@ | |||
1 | /* Copyright (C) 2010-2016 B.A.T.M.A.N. contributors: | ||
2 | * | ||
3 | * Marek Lindner | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of version 2 of the GNU General Public | ||
7 | * License as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #include "log.h" | ||
19 | #include "main.h" | ||
20 | |||
21 | #include <linux/compiler.h> | ||
22 | #include <linux/debugfs.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/export.h> | ||
25 | #include <linux/fcntl.h> | ||
26 | #include <linux/fs.h> | ||
27 | #include <linux/jiffies.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/module.h> | ||
30 | #include <linux/poll.h> | ||
31 | #include <linux/sched.h> /* for linux/wait.h */ | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/spinlock.h> | ||
34 | #include <linux/stat.h> | ||
35 | #include <linux/stddef.h> | ||
36 | #include <linux/types.h> | ||
37 | #include <linux/uaccess.h> | ||
38 | #include <linux/wait.h> | ||
39 | #include <stdarg.h> | ||
40 | |||
41 | #define BATADV_LOG_BUFF_MASK (batadv_log_buff_len - 1) | ||
42 | |||
43 | static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN; | ||
44 | |||
45 | static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log, | ||
46 | size_t idx) | ||
47 | { | ||
48 | return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; | ||
49 | } | ||
50 | |||
51 | static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log, | ||
52 | char c) | ||
53 | { | ||
54 | char *char_addr; | ||
55 | |||
56 | char_addr = batadv_log_char_addr(debug_log, debug_log->log_end); | ||
57 | *char_addr = c; | ||
58 | debug_log->log_end++; | ||
59 | |||
60 | if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) | ||
61 | debug_log->log_start = debug_log->log_end - batadv_log_buff_len; | ||
62 | } | ||
63 | |||
64 | __printf(2, 3) | ||
65 | static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log, | ||
66 | const char *fmt, ...) | ||
67 | { | ||
68 | va_list args; | ||
69 | static char debug_log_buf[256]; | ||
70 | char *p; | ||
71 | |||
72 | if (!debug_log) | ||
73 | return 0; | ||
74 | |||
75 | spin_lock_bh(&debug_log->lock); | ||
76 | va_start(args, fmt); | ||
77 | vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, args); | ||
78 | va_end(args); | ||
79 | |||
80 | for (p = debug_log_buf; *p != 0; p++) | ||
81 | batadv_emit_log_char(debug_log, *p); | ||
82 | |||
83 | spin_unlock_bh(&debug_log->lock); | ||
84 | |||
85 | wake_up(&debug_log->queue_wait); | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) | ||
91 | { | ||
92 | va_list args; | ||
93 | char tmp_log_buf[256]; | ||
94 | |||
95 | va_start(args, fmt); | ||
96 | vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); | ||
97 | batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s", | ||
98 | jiffies_to_msecs(jiffies), tmp_log_buf); | ||
99 | va_end(args); | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int batadv_log_open(struct inode *inode, struct file *file) | ||
105 | { | ||
106 | if (!try_module_get(THIS_MODULE)) | ||
107 | return -EBUSY; | ||
108 | |||
109 | nonseekable_open(inode, file); | ||
110 | file->private_data = inode->i_private; | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int batadv_log_release(struct inode *inode, struct file *file) | ||
115 | { | ||
116 | module_put(THIS_MODULE); | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static bool batadv_log_empty(struct batadv_priv_debug_log *debug_log) | ||
121 | { | ||
122 | return !(debug_log->log_start - debug_log->log_end); | ||
123 | } | ||
124 | |||
125 | static ssize_t batadv_log_read(struct file *file, char __user *buf, | ||
126 | size_t count, loff_t *ppos) | ||
127 | { | ||
128 | struct batadv_priv *bat_priv = file->private_data; | ||
129 | struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; | ||
130 | int error, i = 0; | ||
131 | char *char_addr; | ||
132 | char c; | ||
133 | |||
134 | if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log)) | ||
135 | return -EAGAIN; | ||
136 | |||
137 | if (!buf) | ||
138 | return -EINVAL; | ||
139 | |||
140 | if (count == 0) | ||
141 | return 0; | ||
142 | |||
143 | if (!access_ok(VERIFY_WRITE, buf, count)) | ||
144 | return -EFAULT; | ||
145 | |||
146 | error = wait_event_interruptible(debug_log->queue_wait, | ||
147 | (!batadv_log_empty(debug_log))); | ||
148 | |||
149 | if (error) | ||
150 | return error; | ||
151 | |||
152 | spin_lock_bh(&debug_log->lock); | ||
153 | |||
154 | while ((!error) && (i < count) && | ||
155 | (debug_log->log_start != debug_log->log_end)) { | ||
156 | char_addr = batadv_log_char_addr(debug_log, | ||
157 | debug_log->log_start); | ||
158 | c = *char_addr; | ||
159 | |||
160 | debug_log->log_start++; | ||
161 | |||
162 | spin_unlock_bh(&debug_log->lock); | ||
163 | |||
164 | error = __put_user(c, buf); | ||
165 | |||
166 | spin_lock_bh(&debug_log->lock); | ||
167 | |||
168 | buf++; | ||
169 | i++; | ||
170 | } | ||
171 | |||
172 | spin_unlock_bh(&debug_log->lock); | ||
173 | |||
174 | if (!error) | ||
175 | return i; | ||
176 | |||
177 | return error; | ||
178 | } | ||
179 | |||
180 | static unsigned int batadv_log_poll(struct file *file, poll_table *wait) | ||
181 | { | ||
182 | struct batadv_priv *bat_priv = file->private_data; | ||
183 | struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; | ||
184 | |||
185 | poll_wait(file, &debug_log->queue_wait, wait); | ||
186 | |||
187 | if (!batadv_log_empty(debug_log)) | ||
188 | return POLLIN | POLLRDNORM; | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static const struct file_operations batadv_log_fops = { | ||
194 | .open = batadv_log_open, | ||
195 | .release = batadv_log_release, | ||
196 | .read = batadv_log_read, | ||
197 | .poll = batadv_log_poll, | ||
198 | .llseek = no_llseek, | ||
199 | }; | ||
200 | |||
201 | int batadv_debug_log_setup(struct batadv_priv *bat_priv) | ||
202 | { | ||
203 | struct dentry *d; | ||
204 | |||
205 | if (!bat_priv->debug_dir) | ||
206 | goto err; | ||
207 | |||
208 | bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); | ||
209 | if (!bat_priv->debug_log) | ||
210 | goto err; | ||
211 | |||
212 | spin_lock_init(&bat_priv->debug_log->lock); | ||
213 | init_waitqueue_head(&bat_priv->debug_log->queue_wait); | ||
214 | |||
215 | d = debugfs_create_file("log", S_IFREG | S_IRUSR, | ||
216 | bat_priv->debug_dir, bat_priv, | ||
217 | &batadv_log_fops); | ||
218 | if (!d) | ||
219 | goto err; | ||
220 | |||
221 | return 0; | ||
222 | |||
223 | err: | ||
224 | return -ENOMEM; | ||
225 | } | ||
226 | |||
227 | void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) | ||
228 | { | ||
229 | kfree(bat_priv->debug_log); | ||
230 | bat_priv->debug_log = NULL; | ||
231 | } | ||
diff --git a/net/batman-adv/log.h b/net/batman-adv/log.h new file mode 100644 index 000000000000..9948e56eabaa --- /dev/null +++ b/net/batman-adv/log.h | |||
@@ -0,0 +1,109 @@ | |||
1 | /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: | ||
2 | * | ||
3 | * Marek Lindner, Simon Wunderlich | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of version 2 of the GNU General Public | ||
7 | * License as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef _NET_BATMAN_ADV_LOG_H_ | ||
19 | #define _NET_BATMAN_ADV_LOG_H_ | ||
20 | |||
21 | #include "main.h" | ||
22 | |||
23 | #include <linux/bitops.h> | ||
24 | #include <linux/compiler.h> | ||
25 | #include <linux/printk.h> | ||
26 | |||
27 | #ifdef CONFIG_BATMAN_ADV_DEBUG | ||
28 | |||
29 | int batadv_debug_log_setup(struct batadv_priv *bat_priv); | ||
30 | void batadv_debug_log_cleanup(struct batadv_priv *bat_priv); | ||
31 | |||
32 | #else | ||
33 | |||
34 | static inline int batadv_debug_log_setup(struct batadv_priv *bat_priv) | ||
35 | { | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | static inline void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | #endif | ||
44 | |||
45 | /** | ||
46 | * enum batadv_dbg_level - available log levels | ||
47 | * @BATADV_DBG_BATMAN: OGM and TQ computations related messages | ||
48 | * @BATADV_DBG_ROUTES: route added / changed / deleted | ||
49 | * @BATADV_DBG_TT: translation table messages | ||
50 | * @BATADV_DBG_BLA: bridge loop avoidance messages | ||
51 | * @BATADV_DBG_DAT: ARP snooping and DAT related messages | ||
52 | * @BATADV_DBG_NC: network coding related messages | ||
53 | * @BATADV_DBG_MCAST: multicast related messages | ||
54 | * @BATADV_DBG_ALL: the union of all the above log levels | ||
55 | */ | ||
56 | enum batadv_dbg_level { | ||
57 | BATADV_DBG_BATMAN = BIT(0), | ||
58 | BATADV_DBG_ROUTES = BIT(1), | ||
59 | BATADV_DBG_TT = BIT(2), | ||
60 | BATADV_DBG_BLA = BIT(3), | ||
61 | BATADV_DBG_DAT = BIT(4), | ||
62 | BATADV_DBG_NC = BIT(5), | ||
63 | BATADV_DBG_MCAST = BIT(6), | ||
64 | BATADV_DBG_ALL = 127, | ||
65 | }; | ||
66 | |||
67 | #ifdef CONFIG_BATMAN_ADV_DEBUG | ||
68 | int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) | ||
69 | __printf(2, 3); | ||
70 | |||
71 | /* possibly ratelimited debug output */ | ||
72 | #define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \ | ||
73 | do { \ | ||
74 | if (atomic_read(&bat_priv->log_level) & type && \ | ||
75 | (!ratelimited || net_ratelimit())) \ | ||
76 | batadv_debug_log(bat_priv, fmt, ## arg);\ | ||
77 | } \ | ||
78 | while (0) | ||
79 | #else /* !CONFIG_BATMAN_ADV_DEBUG */ | ||
80 | __printf(4, 5) | ||
81 | static inline void _batadv_dbg(int type __always_unused, | ||
82 | struct batadv_priv *bat_priv __always_unused, | ||
83 | int ratelimited __always_unused, | ||
84 | const char *fmt __always_unused, ...) | ||
85 | { | ||
86 | } | ||
87 | #endif | ||
88 | |||
89 | #define batadv_dbg(type, bat_priv, arg...) \ | ||
90 | _batadv_dbg(type, bat_priv, 0, ## arg) | ||
91 | #define batadv_dbg_ratelimited(type, bat_priv, arg...) \ | ||
92 | _batadv_dbg(type, bat_priv, 1, ## arg) | ||
93 | |||
94 | #define batadv_info(net_dev, fmt, arg...) \ | ||
95 | do { \ | ||
96 | struct net_device *_netdev = (net_dev); \ | ||
97 | struct batadv_priv *_batpriv = netdev_priv(_netdev); \ | ||
98 | batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \ | ||
99 | pr_info("%s: " fmt, _netdev->name, ## arg); \ | ||
100 | } while (0) | ||
101 | #define batadv_err(net_dev, fmt, arg...) \ | ||
102 | do { \ | ||
103 | struct net_device *_netdev = (net_dev); \ | ||
104 | struct batadv_priv *_batpriv = netdev_priv(_netdev); \ | ||
105 | batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \ | ||
106 | pr_err("%s: " fmt, _netdev->name, ## arg); \ | ||
107 | } while (0) | ||
108 | |||
109 | #endif /* _NET_BATMAN_ADV_LOG_H_ */ | ||
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index c5a7cab0f567..05e559c86e82 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/netdevice.h> | 35 | #include <linux/netdevice.h> |
36 | #include <linux/printk.h> | ||
36 | #include <linux/rculist.h> | 37 | #include <linux/rculist.h> |
37 | #include <linux/rcupdate.h> | 38 | #include <linux/rcupdate.h> |
38 | #include <linux/seq_file.h> | 39 | #include <linux/seq_file.h> |
@@ -52,6 +53,7 @@ | |||
52 | #include "gateway_common.h" | 53 | #include "gateway_common.h" |
53 | #include "hard-interface.h" | 54 | #include "hard-interface.h" |
54 | #include "icmp_socket.h" | 55 | #include "icmp_socket.h" |
56 | #include "log.h" | ||
55 | #include "multicast.h" | 57 | #include "multicast.h" |
56 | #include "network-coding.h" | 58 | #include "network-coding.h" |
57 | #include "originator.h" | 59 | #include "originator.h" |
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 3ec62853e519..857fb5a4e37a 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -175,7 +175,6 @@ enum batadv_uev_type { | |||
175 | 175 | ||
176 | /* Kernel headers */ | 176 | /* Kernel headers */ |
177 | 177 | ||
178 | #include <linux/atomic.h> | ||
179 | #include <linux/bitops.h> /* for packet.h */ | 178 | #include <linux/bitops.h> /* for packet.h */ |
180 | #include <linux/compiler.h> | 179 | #include <linux/compiler.h> |
181 | #include <linux/cpumask.h> | 180 | #include <linux/cpumask.h> |
@@ -183,13 +182,13 @@ enum batadv_uev_type { | |||
183 | #include <linux/if_ether.h> /* for packet.h */ | 182 | #include <linux/if_ether.h> /* for packet.h */ |
184 | #include <linux/if_vlan.h> | 183 | #include <linux/if_vlan.h> |
185 | #include <linux/jiffies.h> | 184 | #include <linux/jiffies.h> |
186 | #include <linux/netdevice.h> | ||
187 | #include <linux/percpu.h> | 185 | #include <linux/percpu.h> |
188 | #include <linux/printk.h> | ||
189 | #include <linux/types.h> | 186 | #include <linux/types.h> |
190 | 187 | ||
191 | #include "types.h" | 188 | #include "types.h" |
192 | 189 | ||
190 | struct net_device; | ||
191 | struct packet_type; | ||
193 | struct seq_file; | 192 | struct seq_file; |
194 | struct sk_buff; | 193 | struct sk_buff; |
195 | 194 | ||
@@ -219,70 +218,6 @@ void batadv_recv_handler_unregister(u8 packet_type); | |||
219 | __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr); | 218 | __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr); |
220 | 219 | ||
221 | /** | 220 | /** |
222 | * enum batadv_dbg_level - available log levels | ||
223 | * @BATADV_DBG_BATMAN: OGM and TQ computations related messages | ||
224 | * @BATADV_DBG_ROUTES: route added / changed / deleted | ||
225 | * @BATADV_DBG_TT: translation table messages | ||
226 | * @BATADV_DBG_BLA: bridge loop avoidance messages | ||
227 | * @BATADV_DBG_DAT: ARP snooping and DAT related messages | ||
228 | * @BATADV_DBG_NC: network coding related messages | ||
229 | * @BATADV_DBG_MCAST: multicast related messages | ||
230 | * @BATADV_DBG_ALL: the union of all the above log levels | ||
231 | */ | ||
232 | enum batadv_dbg_level { | ||
233 | BATADV_DBG_BATMAN = BIT(0), | ||
234 | BATADV_DBG_ROUTES = BIT(1), | ||
235 | BATADV_DBG_TT = BIT(2), | ||
236 | BATADV_DBG_BLA = BIT(3), | ||
237 | BATADV_DBG_DAT = BIT(4), | ||
238 | BATADV_DBG_NC = BIT(5), | ||
239 | BATADV_DBG_MCAST = BIT(6), | ||
240 | BATADV_DBG_ALL = 127, | ||
241 | }; | ||
242 | |||
243 | #ifdef CONFIG_BATMAN_ADV_DEBUG | ||
244 | int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) | ||
245 | __printf(2, 3); | ||
246 | |||
247 | /* possibly ratelimited debug output */ | ||
248 | #define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \ | ||
249 | do { \ | ||
250 | if (atomic_read(&bat_priv->log_level) & type && \ | ||
251 | (!ratelimited || net_ratelimit())) \ | ||
252 | batadv_debug_log(bat_priv, fmt, ## arg);\ | ||
253 | } \ | ||
254 | while (0) | ||
255 | #else /* !CONFIG_BATMAN_ADV_DEBUG */ | ||
256 | __printf(4, 5) | ||
257 | static inline void _batadv_dbg(int type __always_unused, | ||
258 | struct batadv_priv *bat_priv __always_unused, | ||
259 | int ratelimited __always_unused, | ||
260 | const char *fmt __always_unused, ...) | ||
261 | { | ||
262 | } | ||
263 | #endif | ||
264 | |||
265 | #define batadv_dbg(type, bat_priv, arg...) \ | ||
266 | _batadv_dbg(type, bat_priv, 0, ## arg) | ||
267 | #define batadv_dbg_ratelimited(type, bat_priv, arg...) \ | ||
268 | _batadv_dbg(type, bat_priv, 1, ## arg) | ||
269 | |||
270 | #define batadv_info(net_dev, fmt, arg...) \ | ||
271 | do { \ | ||
272 | struct net_device *_netdev = (net_dev); \ | ||
273 | struct batadv_priv *_batpriv = netdev_priv(_netdev); \ | ||
274 | batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \ | ||
275 | pr_info("%s: " fmt, _netdev->name, ## arg); \ | ||
276 | } while (0) | ||
277 | #define batadv_err(net_dev, fmt, arg...) \ | ||
278 | do { \ | ||
279 | struct net_device *_netdev = (net_dev); \ | ||
280 | struct batadv_priv *_batpriv = netdev_priv(_netdev); \ | ||
281 | batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \ | ||
282 | pr_err("%s: " fmt, _netdev->name, ## arg); \ | ||
283 | } while (0) | ||
284 | |||
285 | /** | ||
286 | * batadv_compare_eth - Compare two not u16 aligned Ethernet addresses | 221 | * batadv_compare_eth - Compare two not u16 aligned Ethernet addresses |
287 | * @data1: Pointer to a six-byte array containing the Ethernet address | 222 | * @data1: Pointer to a six-byte array containing the Ethernet address |
288 | * @data2: Pointer other six-byte array containing the Ethernet address | 223 | * @data2: Pointer other six-byte array containing the Ethernet address |
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c index 0e7d78f4f1b8..cc915073a753 100644 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c | |||
@@ -55,6 +55,7 @@ | |||
55 | 55 | ||
56 | #include "hard-interface.h" | 56 | #include "hard-interface.h" |
57 | #include "hash.h" | 57 | #include "hash.h" |
58 | #include "log.h" | ||
58 | #include "packet.h" | 59 | #include "packet.h" |
59 | #include "translation-table.h" | 60 | #include "translation-table.h" |
60 | #include "tvlv.h" | 61 | #include "tvlv.h" |
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index d0383dea6440..293ef4ffd4e1 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
@@ -51,6 +51,7 @@ | |||
51 | 51 | ||
52 | #include "hard-interface.h" | 52 | #include "hard-interface.h" |
53 | #include "hash.h" | 53 | #include "hash.h" |
54 | #include "log.h" | ||
54 | #include "originator.h" | 55 | #include "originator.h" |
55 | #include "packet.h" | 56 | #include "packet.h" |
56 | #include "routing.h" | 57 | #include "routing.h" |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 592cbda283e3..8ad17ad477e4 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "gateway_client.h" | 40 | #include "gateway_client.h" |
41 | #include "hard-interface.h" | 41 | #include "hard-interface.h" |
42 | #include "hash.h" | 42 | #include "hash.h" |
43 | #include "log.h" | ||
43 | #include "multicast.h" | 44 | #include "multicast.h" |
44 | #include "network-coding.h" | 45 | #include "network-coding.h" |
45 | #include "routing.h" | 46 | #include "routing.h" |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index b9c7325ea0aa..a5b53a3fc2ba 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "fragmentation.h" | 41 | #include "fragmentation.h" |
42 | #include "hard-interface.h" | 42 | #include "hard-interface.h" |
43 | #include "icmp_socket.h" | 43 | #include "icmp_socket.h" |
44 | #include "log.h" | ||
44 | #include "network-coding.h" | 45 | #include "network-coding.h" |
45 | #include "originator.h" | 46 | #include "originator.h" |
46 | #include "packet.h" | 47 | #include "packet.h" |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 4e49454dfed4..3a59df26ee32 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "fragmentation.h" | 42 | #include "fragmentation.h" |
43 | #include "gateway_client.h" | 43 | #include "gateway_client.h" |
44 | #include "hard-interface.h" | 44 | #include "hard-interface.h" |
45 | #include "log.h" | ||
45 | #include "network-coding.h" | 46 | #include "network-coding.h" |
46 | #include "originator.h" | 47 | #include "originator.h" |
47 | #include "routing.h" | 48 | #include "routing.h" |
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c index 6244a9a336d0..1a7942ddf730 100644 --- a/net/batman-adv/sysfs.c +++ b/net/batman-adv/sysfs.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "gateway_client.h" | 43 | #include "gateway_client.h" |
44 | #include "gateway_common.h" | 44 | #include "gateway_common.h" |
45 | #include "hard-interface.h" | 45 | #include "hard-interface.h" |
46 | #include "log.h" | ||
46 | #include "network-coding.h" | 47 | #include "network-coding.h" |
47 | #include "packet.h" | 48 | #include "packet.h" |
48 | #include "soft-interface.h" | 49 | #include "soft-interface.h" |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 5c3cf7ffc77e..53458d6fb87d 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include "bridge_loop_avoidance.h" | 48 | #include "bridge_loop_avoidance.h" |
49 | #include "hard-interface.h" | 49 | #include "hard-interface.h" |
50 | #include "hash.h" | 50 | #include "hash.h" |
51 | #include "log.h" | ||
51 | #include "multicast.h" | 52 | #include "multicast.h" |
52 | #include "originator.h" | 53 | #include "originator.h" |
53 | #include "packet.h" | 54 | #include "packet.h" |