Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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