Blame view
net/batman-adv/debugfs.c
12.3 KB
7db7d9f36 batman-adv: Add S... |
1 |
// SPDX-License-Identifier: GPL-2.0 |
68e039f96 batman-adv: Updat... |
2 |
/* Copyright (C) 2010-2020 B.A.T.M.A.N. contributors: |
c6c8fea29 net: Add batman-a... |
3 4 |
* * Marek Lindner |
c6c8fea29 net: Add batman-a... |
5 |
*/ |
1e2c2a4fe batman-adv: Add r... |
6 |
#include "debugfs.h" |
c6c8fea29 net: Add batman-a... |
7 |
#include "main.h" |
a5dac4da7 batman-adv: Add i... |
8 |
#include <asm/current.h> |
36dc621ce batman-adv: Fix d... |
9 |
#include <linux/dcache.h> |
c6c8fea29 net: Add batman-a... |
10 |
#include <linux/debugfs.h> |
1e2c2a4fe batman-adv: Add r... |
11 12 |
#include <linux/errno.h> #include <linux/export.h> |
1e2c2a4fe batman-adv: Add r... |
13 |
#include <linux/fs.h> |
1e2c2a4fe batman-adv: Add r... |
14 |
#include <linux/netdevice.h> |
1e2c2a4fe batman-adv: Add r... |
15 |
#include <linux/printk.h> |
a5dac4da7 batman-adv: Add i... |
16 |
#include <linux/sched.h> |
1e2c2a4fe batman-adv: Add r... |
17 |
#include <linux/seq_file.h> |
1e2c2a4fe batman-adv: Add r... |
18 19 20 21 |
#include <linux/stat.h> #include <linux/stddef.h> #include <linux/stringify.h> #include <linux/sysfs.h> |
94969208c batman-adv: Suppr... |
22 |
#include <net/net_namespace.h> |
c6c8fea29 net: Add batman-a... |
23 |
|
01d350d14 batman-adv: move ... |
24 |
#include "bat_algo.h" |
9bf8e4d42 batman-adv: expor... |
25 |
#include "bridge_loop_avoidance.h" |
2f1dfbe18 batman-adv: Distr... |
26 |
#include "distributed-arp-table.h" |
1e2c2a4fe batman-adv: Add r... |
27 28 |
#include "gateway_client.h" #include "icmp_socket.h" |
ba412080f batman-adv: Conso... |
29 |
#include "log.h" |
4e3e823b5 batman-adv: Add d... |
30 |
#include "multicast.h" |
d56b1705e batman-adv: netwo... |
31 |
#include "network-coding.h" |
1e2c2a4fe batman-adv: Add r... |
32 33 |
#include "originator.h" #include "translation-table.h" |
c6c8fea29 net: Add batman-a... |
34 |
|
9e466250e batman-adv: Prefi... |
35 |
static struct dentry *batadv_debugfs; |
c6c8fea29 net: Add batman-a... |
36 |
|
00caf6a2b batman-adv: Mark ... |
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
/** * batadv_debugfs_deprecated() - Log use of deprecated batadv debugfs access * @file: file which was accessed * @alt: explanation what can be used as alternative */ void batadv_debugfs_deprecated(struct file *file, const char *alt) { struct dentry *dentry = file_dentry(file); const char *name = dentry->d_name.name; pr_warn_ratelimited(DEPRECATED "%s (pid %d) Use of debugfs file \"%s\". %s", current->comm, task_pid_nr(current), name, alt); } |
9e466250e batman-adv: Prefi... |
51 |
static int batadv_algorithms_open(struct inode *inode, struct file *file) |
1c280471b batman-adv: add i... |
52 |
{ |
00caf6a2b batman-adv: Mark ... |
53 54 55 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_ROUTING_ALGOS instead "); |
3193e8fdf batman-adv: Prefi... |
56 |
return single_open(file, batadv_algo_seq_print_text, NULL); |
1c280471b batman-adv: add i... |
57 |
} |
7587405ab batman-adv: expor... |
58 59 60 |
static int neighbors_open(struct inode *inode, struct file *file) { struct net_device *net_dev = (struct net_device *)inode->i_private; |
00caf6a2b batman-adv: Mark ... |
61 62 63 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_NEIGHBORS instead "); |
7587405ab batman-adv: expor... |
64 65 |
return single_open(file, batadv_hardif_neigh_seq_print_text, net_dev); } |
9e466250e batman-adv: Prefi... |
66 |
static int batadv_originators_open(struct inode *inode, struct file *file) |
c6c8fea29 net: Add batman-a... |
67 68 |
{ struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
69 |
|
00caf6a2b batman-adv: Mark ... |
70 71 72 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_ORIGINATORS instead "); |
7d211efc5 batman-adv: Prefi... |
73 |
return single_open(file, batadv_orig_seq_print_text, net_dev); |
c6c8fea29 net: Add batman-a... |
74 |
} |
cb1c92ec3 batman-adv: add d... |
75 |
/** |
7e9a8c2ce batman-adv: Use p... |
76 77 |
* batadv_originators_hardif_open() - handles debugfs output for the originator * table of an hard interface |
cb1c92ec3 batman-adv: add d... |
78 79 |
* @inode: inode pointer to debugfs file * @file: pointer to the seq_file |
7afcbbef6 batman-adv: Fix k... |
80 81 |
* * Return: 0 on success or negative error number in case of failure |
cb1c92ec3 batman-adv: add d... |
82 83 84 85 86 |
*/ static int batadv_originators_hardif_open(struct inode *inode, struct file *file) { struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
87 |
|
00caf6a2b batman-adv: Mark ... |
88 89 90 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_HARDIFS instead "); |
cb1c92ec3 batman-adv: add d... |
91 92 |
return single_open(file, batadv_orig_hardif_seq_print_text, net_dev); } |
9e466250e batman-adv: Prefi... |
93 |
static int batadv_gateways_open(struct inode *inode, struct file *file) |
c6c8fea29 net: Add batman-a... |
94 95 |
{ struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
96 |
|
00caf6a2b batman-adv: Mark ... |
97 98 99 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_GATEWAYS instead "); |
7cf06bc6f batman-adv: Prefi... |
100 |
return single_open(file, batadv_gw_client_seq_print_text, net_dev); |
c6c8fea29 net: Add batman-a... |
101 |
} |
9e466250e batman-adv: Prefi... |
102 |
static int batadv_transtable_global_open(struct inode *inode, struct file *file) |
c6c8fea29 net: Add batman-a... |
103 104 |
{ struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
105 |
|
00caf6a2b batman-adv: Mark ... |
106 107 108 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_TRANSTABLE_GLOBAL instead "); |
08c36d3e8 batman-adv: Prefi... |
109 |
return single_open(file, batadv_tt_global_seq_print_text, net_dev); |
c6c8fea29 net: Add batman-a... |
110 |
} |
7a5cc2427 batman-adv: add b... |
111 |
#ifdef CONFIG_BATMAN_ADV_BLA |
9e466250e batman-adv: Prefi... |
112 |
static int batadv_bla_claim_table_open(struct inode *inode, struct file *file) |
9bf8e4d42 batman-adv: expor... |
113 114 |
{ struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
115 |
|
00caf6a2b batman-adv: Mark ... |
116 117 118 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_BLA_CLAIM instead "); |
08adf1512 batman-adv: Prefi... |
119 120 |
return single_open(file, batadv_bla_claim_table_seq_print_text, net_dev); |
9bf8e4d42 batman-adv: expor... |
121 |
} |
536a23f11 batman-adv: Add t... |
122 123 124 125 126 |
static int batadv_bla_backbone_table_open(struct inode *inode, struct file *file) { struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
127 |
|
00caf6a2b batman-adv: Mark ... |
128 129 130 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_BLA_BACKBONE instead "); |
536a23f11 batman-adv: Add t... |
131 132 133 |
return single_open(file, batadv_bla_backbone_table_seq_print_text, net_dev); } |
7a5cc2427 batman-adv: add b... |
134 |
#endif |
9bf8e4d42 batman-adv: expor... |
135 |
|
172244748 batman-adv: Distr... |
136 |
#ifdef CONFIG_BATMAN_ADV_DAT |
2f1dfbe18 batman-adv: Distr... |
137 |
/** |
be01dc33b batman-adv: fix c... |
138 |
* batadv_dat_cache_open() - Prepare file handler for reads from dat_cache |
2f1dfbe18 batman-adv: Distr... |
139 140 |
* @inode: inode which was opened * @file: file handle to be initialized |
7afcbbef6 batman-adv: Fix k... |
141 142 |
* * Return: 0 on success or negative error number in case of failure |
2f1dfbe18 batman-adv: Distr... |
143 144 145 146 |
*/ static int batadv_dat_cache_open(struct inode *inode, struct file *file) { struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
147 |
|
00caf6a2b batman-adv: Mark ... |
148 149 150 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_DAT_CACHE instead "); |
2f1dfbe18 batman-adv: Distr... |
151 152 |
return single_open(file, batadv_dat_cache_seq_print_text, net_dev); } |
172244748 batman-adv: Distr... |
153 |
#endif |
2f1dfbe18 batman-adv: Distr... |
154 |
|
9e466250e batman-adv: Prefi... |
155 |
static int batadv_transtable_local_open(struct inode *inode, struct file *file) |
c6c8fea29 net: Add batman-a... |
156 157 |
{ struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
158 |
|
00caf6a2b batman-adv: Mark ... |
159 160 161 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_TRANSTABLE_LOCAL instead "); |
08c36d3e8 batman-adv: Prefi... |
162 |
return single_open(file, batadv_tt_local_seq_print_text, net_dev); |
c6c8fea29 net: Add batman-a... |
163 |
} |
7f223c0c3 batman-adv: Prefi... |
164 |
struct batadv_debuginfo { |
c6c8fea29 net: Add batman-a... |
165 166 167 |
struct attribute attr; const struct file_operations fops; }; |
d56b1705e batman-adv: netwo... |
168 169 170 171 |
#ifdef CONFIG_BATMAN_ADV_NC static int batadv_nc_nodes_open(struct inode *inode, struct file *file) { struct net_device *net_dev = (struct net_device *)inode->i_private; |
f138694b1 batman-adv: add b... |
172 |
|
00caf6a2b batman-adv: Mark ... |
173 |
batadv_debugfs_deprecated(file, ""); |
d56b1705e batman-adv: netwo... |
174 175 176 |
return single_open(file, batadv_nc_nodes_seq_print_text, net_dev); } #endif |
4e3e823b5 batman-adv: Add d... |
177 178 |
#ifdef CONFIG_BATMAN_ADV_MCAST /** |
7e9a8c2ce batman-adv: Use p... |
179 |
* batadv_mcast_flags_open() - prepare file handler for reads from mcast_flags |
4e3e823b5 batman-adv: Add d... |
180 181 182 183 184 185 186 187 |
* @inode: inode which was opened * @file: file handle to be initialized * * Return: 0 on success or negative error number in case of failure */ static int batadv_mcast_flags_open(struct inode *inode, struct file *file) { struct net_device *net_dev = (struct net_device *)inode->i_private; |
00caf6a2b batman-adv: Mark ... |
188 189 190 |
batadv_debugfs_deprecated(file, "Use genl command BATADV_CMD_GET_MCAST_FLAGS instead "); |
4e3e823b5 batman-adv: Add d... |
191 192 193 |
return single_open(file, batadv_mcast_flags_seq_print_text, net_dev); } #endif |
347c80f0f batman-adv: Prefi... |
194 |
#define BATADV_DEBUGINFO(_name, _mode, _open) \ |
7f223c0c3 batman-adv: Prefi... |
195 |
struct batadv_debuginfo batadv_debuginfo_##_name = { \ |
121bdca0d batman-adv: fix d... |
196 197 198 199 200 201 202 203 204 205 206 |
.attr = { \ .name = __stringify(_name), \ .mode = _mode, \ }, \ .fops = { \ .owner = THIS_MODULE, \ .open = _open, \ .read = seq_read, \ .llseek = seq_lseek, \ .release = single_release, \ }, \ |
2b64df205 batman-adv: remov... |
207 |
} |
c6c8fea29 net: Add batman-a... |
208 |
|
637fbd129 batman-adv: suppo... |
209 210 211 |
/* the following attributes are general and therefore they will be directly * placed in the BATADV_DEBUGFS_SUBDIR subdirectory of debugfs */ |
507b37cf7 batman-adv: Use o... |
212 |
static BATADV_DEBUGINFO(routing_algos, 0444, batadv_algorithms_open); |
637fbd129 batman-adv: suppo... |
213 214 215 216 217 218 219 |
static struct batadv_debuginfo *batadv_general_debuginfos[] = { &batadv_debuginfo_routing_algos, NULL, }; /* The following attributes are per soft interface */ |
507b37cf7 batman-adv: Use o... |
220 221 222 223 |
static BATADV_DEBUGINFO(neighbors, 0444, neighbors_open); static BATADV_DEBUGINFO(originators, 0444, batadv_originators_open); static BATADV_DEBUGINFO(gateways, 0444, batadv_gateways_open); static BATADV_DEBUGINFO(transtable_global, 0444, batadv_transtable_global_open); |
7a5cc2427 batman-adv: add b... |
224 |
#ifdef CONFIG_BATMAN_ADV_BLA |
507b37cf7 batman-adv: Use o... |
225 226 |
static BATADV_DEBUGINFO(bla_claim_table, 0444, batadv_bla_claim_table_open); static BATADV_DEBUGINFO(bla_backbone_table, 0444, |
536a23f11 batman-adv: Add t... |
227 |
batadv_bla_backbone_table_open); |
7a5cc2427 batman-adv: add b... |
228 |
#endif |
172244748 batman-adv: Distr... |
229 |
#ifdef CONFIG_BATMAN_ADV_DAT |
507b37cf7 batman-adv: Use o... |
230 |
static BATADV_DEBUGINFO(dat_cache, 0444, batadv_dat_cache_open); |
172244748 batman-adv: Distr... |
231 |
#endif |
507b37cf7 batman-adv: Use o... |
232 |
static BATADV_DEBUGINFO(transtable_local, 0444, batadv_transtable_local_open); |
d56b1705e batman-adv: netwo... |
233 |
#ifdef CONFIG_BATMAN_ADV_NC |
507b37cf7 batman-adv: Use o... |
234 |
static BATADV_DEBUGINFO(nc_nodes, 0444, batadv_nc_nodes_open); |
d56b1705e batman-adv: netwo... |
235 |
#endif |
4e3e823b5 batman-adv: Add d... |
236 |
#ifdef CONFIG_BATMAN_ADV_MCAST |
507b37cf7 batman-adv: Use o... |
237 |
static BATADV_DEBUGINFO(mcast_flags, 0444, batadv_mcast_flags_open); |
4e3e823b5 batman-adv: Add d... |
238 |
#endif |
c6c8fea29 net: Add batman-a... |
239 |
|
7f223c0c3 batman-adv: Prefi... |
240 |
static struct batadv_debuginfo *batadv_mesh_debuginfos[] = { |
7587405ab batman-adv: expor... |
241 |
&batadv_debuginfo_neighbors, |
9e466250e batman-adv: Prefi... |
242 243 244 |
&batadv_debuginfo_originators, &batadv_debuginfo_gateways, &batadv_debuginfo_transtable_global, |
7a5cc2427 batman-adv: add b... |
245 |
#ifdef CONFIG_BATMAN_ADV_BLA |
9e466250e batman-adv: Prefi... |
246 |
&batadv_debuginfo_bla_claim_table, |
536a23f11 batman-adv: Add t... |
247 |
&batadv_debuginfo_bla_backbone_table, |
7a5cc2427 batman-adv: add b... |
248 |
#endif |
172244748 batman-adv: Distr... |
249 |
#ifdef CONFIG_BATMAN_ADV_DAT |
2f1dfbe18 batman-adv: Distr... |
250 |
&batadv_debuginfo_dat_cache, |
172244748 batman-adv: Distr... |
251 |
#endif |
9e466250e batman-adv: Prefi... |
252 |
&batadv_debuginfo_transtable_local, |
d56b1705e batman-adv: netwo... |
253 254 255 |
#ifdef CONFIG_BATMAN_ADV_NC &batadv_debuginfo_nc_nodes, #endif |
4e3e823b5 batman-adv: Add d... |
256 257 258 |
#ifdef CONFIG_BATMAN_ADV_MCAST &batadv_debuginfo_mcast_flags, #endif |
c6c8fea29 net: Add batman-a... |
259 260 |
NULL, }; |
5bc7c1eb4 batman-adv: add d... |
261 262 263 264 265 266 267 268 269 270 271 272 273 |
#define BATADV_HARDIF_DEBUGINFO(_name, _mode, _open) \ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = { \ .attr = { \ .name = __stringify(_name), \ .mode = _mode, \ }, \ .fops = { \ .owner = THIS_MODULE, \ .open = _open, \ .read = seq_read, \ .llseek = seq_lseek, \ .release = single_release, \ }, \ |
2b64df205 batman-adv: remov... |
274 |
} |
aa143d283 batman-adv: check... |
275 |
|
507b37cf7 batman-adv: Use o... |
276 |
static BATADV_HARDIF_DEBUGINFO(originators, 0444, |
cb1c92ec3 batman-adv: add d... |
277 |
batadv_originators_hardif_open); |
5bc7c1eb4 batman-adv: add d... |
278 279 |
static struct batadv_debuginfo *batadv_hardif_debuginfos[] = { |
cb1c92ec3 batman-adv: add d... |
280 |
&batadv_hardif_debuginfo_originators, |
5bc7c1eb4 batman-adv: add d... |
281 282 |
NULL, }; |
ff15c27c9 batman-adv: Add k... |
283 284 285 |
/** * batadv_debugfs_init() - Initialize soft interface independent debugfs entries */ |
40a072d77 batman-adv: Prefi... |
286 |
void batadv_debugfs_init(void) |
c6c8fea29 net: Add batman-a... |
287 |
{ |
637fbd129 batman-adv: suppo... |
288 |
struct batadv_debuginfo **bat_debug; |
1c280471b batman-adv: add i... |
289 |
|
54590e4d4 batman-adv: Prefi... |
290 |
batadv_debugfs = debugfs_create_dir(BATADV_DEBUGFS_SUBDIR, NULL); |
1c280471b batman-adv: add i... |
291 |
|
3bcacd1e0 batman-adv: no ne... |
292 293 294 295 |
for (bat_debug = batadv_general_debuginfos; *bat_debug; ++bat_debug) debugfs_create_file(((*bat_debug)->attr).name, S_IFREG | ((*bat_debug)->attr).mode, batadv_debugfs, NULL, &(*bat_debug)->fops); |
c6c8fea29 net: Add batman-a... |
296 |
} |
ff15c27c9 batman-adv: Add k... |
297 298 299 |
/** * batadv_debugfs_destroy() - Remove all debugfs entries */ |
40a072d77 batman-adv: Prefi... |
300 |
void batadv_debugfs_destroy(void) |
c6c8fea29 net: Add batman-a... |
301 |
{ |
3f87c4239 batman-adv: remov... |
302 303 |
debugfs_remove_recursive(batadv_debugfs); batadv_debugfs = NULL; |
c6c8fea29 net: Add batman-a... |
304 |
} |
5bc7c1eb4 batman-adv: add d... |
305 |
/** |
7e9a8c2ce batman-adv: Use p... |
306 |
* batadv_debugfs_add_hardif() - creates the base directory for a hard interface |
5bc7c1eb4 batman-adv: add d... |
307 308 309 |
* in debugfs. * @hard_iface: hard interface which should be added. */ |
3bcacd1e0 batman-adv: no ne... |
310 |
void batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface) |
5bc7c1eb4 batman-adv: add d... |
311 |
{ |
94969208c batman-adv: Suppr... |
312 |
struct net *net = dev_net(hard_iface->net_dev); |
5bc7c1eb4 batman-adv: add d... |
313 |
struct batadv_debuginfo **bat_debug; |
5bc7c1eb4 batman-adv: add d... |
314 |
|
94969208c batman-adv: Suppr... |
315 |
if (net != &init_net) |
3bcacd1e0 batman-adv: no ne... |
316 |
return; |
94969208c batman-adv: Suppr... |
317 |
|
5bc7c1eb4 batman-adv: add d... |
318 319 |
hard_iface->debug_dir = debugfs_create_dir(hard_iface->net_dev->name, batadv_debugfs); |
5bc7c1eb4 batman-adv: add d... |
320 |
|
3bcacd1e0 batman-adv: no ne... |
321 322 323 324 325 |
for (bat_debug = batadv_hardif_debuginfos; *bat_debug; ++bat_debug) debugfs_create_file(((*bat_debug)->attr).name, S_IFREG | ((*bat_debug)->attr).mode, hard_iface->debug_dir, hard_iface->net_dev, &(*bat_debug)->fops); |
5bc7c1eb4 batman-adv: add d... |
326 327 328 |
} /** |
36dc621ce batman-adv: Fix d... |
329 330 331 332 333 334 335 |
* batadv_debugfs_rename_hardif() - Fix debugfs path for renamed hardif * @hard_iface: hard interface which was renamed */ void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface) { const char *name = hard_iface->net_dev->name; struct dentry *dir; |
36dc621ce batman-adv: Fix d... |
336 337 338 339 |
dir = hard_iface->debug_dir; if (!dir) return; |
3bcacd1e0 batman-adv: no ne... |
340 |
debugfs_rename(dir->d_parent, dir, dir->d_parent, name); |
36dc621ce batman-adv: Fix d... |
341 342 343 |
} /** |
7e9a8c2ce batman-adv: Use p... |
344 |
* batadv_debugfs_del_hardif() - delete the base directory for a hard interface |
5bc7c1eb4 batman-adv: add d... |
345 346 347 348 349 |
* in debugfs. * @hard_iface: hard interface which is deleted. */ void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface) { |
94969208c batman-adv: Suppr... |
350 351 352 353 |
struct net *net = dev_net(hard_iface->net_dev); if (net != &init_net) return; |
5bc7c1eb4 batman-adv: add d... |
354 355 356 357 358 |
if (batadv_debugfs) { debugfs_remove_recursive(hard_iface->debug_dir); hard_iface->debug_dir = NULL; } } |
ff15c27c9 batman-adv: Add k... |
359 360 361 362 363 364 |
/** * batadv_debugfs_add_meshif() - Initialize interface dependent debugfs entries * @dev: netdev struct of the soft interface * * Return: 0 on success or negative error number in case of failure */ |
40a072d77 batman-adv: Prefi... |
365 |
int batadv_debugfs_add_meshif(struct net_device *dev) |
c6c8fea29 net: Add batman-a... |
366 |
{ |
56303d34a batman-adv: Prefi... |
367 |
struct batadv_priv *bat_priv = netdev_priv(dev); |
7f223c0c3 batman-adv: Prefi... |
368 |
struct batadv_debuginfo **bat_debug; |
94969208c batman-adv: Suppr... |
369 |
struct net *net = dev_net(dev); |
c6c8fea29 net: Add batman-a... |
370 |
|
94969208c batman-adv: Suppr... |
371 372 |
if (net != &init_net) return 0; |
9e466250e batman-adv: Prefi... |
373 |
bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs); |
c6c8fea29 net: Add batman-a... |
374 |
|
3bcacd1e0 batman-adv: no ne... |
375 |
batadv_socket_setup(bat_priv); |
5346c35eb batman-adv: Retur... |
376 |
|
9e466250e batman-adv: Prefi... |
377 |
if (batadv_debug_log_setup(bat_priv) < 0) |
5346c35eb batman-adv: Retur... |
378 |
goto rem_attr; |
c6c8fea29 net: Add batman-a... |
379 |
|
3bcacd1e0 batman-adv: no ne... |
380 381 382 383 384 |
for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) debugfs_create_file(((*bat_debug)->attr).name, S_IFREG | ((*bat_debug)->attr).mode, bat_priv->debug_dir, dev, &(*bat_debug)->fops); |
c6c8fea29 net: Add batman-a... |
385 |
|
3bcacd1e0 batman-adv: no ne... |
386 |
batadv_nc_init_debugfs(bat_priv); |
d56b1705e batman-adv: netwo... |
387 |
|
c6c8fea29 net: Add batman-a... |
388 389 390 391 |
return 0; rem_attr: debugfs_remove_recursive(bat_priv->debug_dir); bat_priv->debug_dir = NULL; |
c6c8fea29 net: Add batman-a... |
392 |
return -ENOMEM; |
c6c8fea29 net: Add batman-a... |
393 |
} |
ff15c27c9 batman-adv: Add k... |
394 |
/** |
6da7be7d2 batman-adv: Fix d... |
395 396 397 398 399 400 401 402 |
* batadv_debugfs_rename_meshif() - Fix debugfs path for renamed softif * @dev: net_device which was renamed */ void batadv_debugfs_rename_meshif(struct net_device *dev) { struct batadv_priv *bat_priv = netdev_priv(dev); const char *name = dev->name; struct dentry *dir; |
6da7be7d2 batman-adv: Fix d... |
403 404 405 406 |
dir = bat_priv->debug_dir; if (!dir) return; |
3bcacd1e0 batman-adv: no ne... |
407 |
debugfs_rename(dir->d_parent, dir, dir->d_parent, name); |
6da7be7d2 batman-adv: Fix d... |
408 409 410 |
} /** |
ff15c27c9 batman-adv: Add k... |
411 412 413 |
* batadv_debugfs_del_meshif() - Remove interface dependent debugfs entries * @dev: netdev struct of the soft interface */ |
40a072d77 batman-adv: Prefi... |
414 |
void batadv_debugfs_del_meshif(struct net_device *dev) |
c6c8fea29 net: Add batman-a... |
415 |
{ |
56303d34a batman-adv: Prefi... |
416 |
struct batadv_priv *bat_priv = netdev_priv(dev); |
94969208c batman-adv: Suppr... |
417 418 419 420 |
struct net *net = dev_net(dev); if (net != &init_net) return; |
c6c8fea29 net: Add batman-a... |
421 |
|
9e466250e batman-adv: Prefi... |
422 |
batadv_debug_log_cleanup(bat_priv); |
c6c8fea29 net: Add batman-a... |
423 |
|
9e466250e batman-adv: Prefi... |
424 |
if (batadv_debugfs) { |
c6c8fea29 net: Add batman-a... |
425 426 427 428 |
debugfs_remove_recursive(bat_priv->debug_dir); bat_priv->debug_dir = NULL; } } |