Kmalloc-kmem-cache-tests » 0001-export-global-translation-table-count-to-debugfs.patch
net/batman-adv/debugfs.c | ||
---|---|---|
return single_open(file, batadv_tt_global_seq_print_text, net_dev);
|
||
}
|
||
static int batadv_transtable_global_count_open(struct inode *inode, struct file *file)
|
||
{
|
||
struct net_device *net_dev = (struct net_device *)inode->i_private;
|
||
return single_open(file, batadv_tt_global_count_seq_print_text, net_dev);
|
||
}
|
||
#ifdef CONFIG_BATMAN_ADV_BLA
|
||
static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
|
||
{
|
||
... | ... | |
static BATADV_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open);
|
||
static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
|
||
batadv_transtable_global_open);
|
||
static BATADV_DEBUGINFO(transtable_global_count, S_IRUGO,
|
||
batadv_transtable_global_count_open);
|
||
#ifdef CONFIG_BATMAN_ADV_BLA
|
||
static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
|
||
static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
|
||
... | ... | |
&batadv_debuginfo_originators,
|
||
&batadv_debuginfo_gateways,
|
||
&batadv_debuginfo_transtable_global,
|
||
&batadv_debuginfo_transtable_global_count,
|
||
#ifdef CONFIG_BATMAN_ADV_BLA
|
||
&batadv_debuginfo_bla_claim_table,
|
||
&batadv_debuginfo_bla_backbone_table,
|
net/batman-adv/translation-table.c | ||
---|---|---|
return 0;
|
||
}
|
||
int batadv_tt_global_count_seq_print_text(struct seq_file *seq, void *offset)
|
||
{
|
||
struct net_device *net_dev = (struct net_device *)seq->private;
|
||
struct batadv_priv *bat_priv = netdev_priv(net_dev);
|
||
struct batadv_hashtable *hash = bat_priv->tt.global_hash;
|
||
struct batadv_tt_common_entry *tt_common_entry;
|
||
struct batadv_hard_iface *primary_if;
|
||
struct hlist_head *head;
|
||
unsigned int count = 0;
|
||
u32 i;
|
||
primary_if = batadv_seq_print_text_primary_if_get(seq);
|
||
if (!primary_if)
|
||
goto out;
|
||
for (i = 0; i < hash->size; i++) {
|
||
head = &hash->table[i];
|
||
rcu_read_lock();
|
||
hlist_for_each_entry_rcu(tt_common_entry,
|
||
head, hash_entry) {
|
||
count++;
|
||
}
|
||
rcu_read_unlock();
|
||
}
|
||
seq_printf(seq, "%u\n", count);
|
||
out:
|
||
if (primary_if)
|
||
batadv_hardif_put(primary_if);
|
||
return 0;
|
||
}
|
||
/**
|
||
* _batadv_tt_global_del_orig_entry - remove and free an orig_entry
|
||
* @tt_global_entry: the global entry to remove the orig_entry from
|
net/batman-adv/translation-table.h | ||
---|---|---|
const char *message, bool roaming);
|
||
int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
|
||
int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
|
||
int batadv_tt_global_count_seq_print_text(struct seq_file *seq, void *offset);
|
||
void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
|
||
struct batadv_orig_node *orig_node,
|
||
s32 match_vid, const char *message);
|