cregit-Linux how code gets into the kernel

Release 4.11 drivers/net/bonding/bond_debugfs.c

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/netdevice.h>

#include <net/bonding.h>
#include <net/bond_alb.h>

#if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_NET_NS)

#include <linux/debugfs.h>
#include <linux/seq_file.h>


static struct dentry *bonding_debug_root;

/* Show RLB hash table */

static int bond_debug_rlb_hash_show(struct seq_file *m, void *v) { struct bonding *bond = m->private; struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); struct rlb_client_info *client_info; u32 hash_index; if (BOND_MODE(bond) != BOND_MODE_ALB) return 0; seq_printf(m, "SourceIP DestinationIP " "Destination MAC DEV\n"); spin_lock_bh(&bond->mode_lock); hash_index = bond_info->rx_hashtbl_used_head; for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->used_next) { client_info = &(bond_info->rx_hashtbl[hash_index]); seq_printf(m, "%-15pI4 %-15pI4 %-17pM %s\n", &client_info->ip_src, &client_info->ip_dst, &client_info->mac_dst, client_info->slave->dev->name); } spin_unlock_bh(&bond->mode_lock); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi13893.88%125.00%
Nikolay Aleksandrov42.72%125.00%
Veaceslav Falico32.04%125.00%
Jiri Bohac21.36%125.00%
Total147100.00%4100.00%


static int bond_debug_rlb_hash_open(struct inode *inode, struct file *file) { return single_open(file, bond_debug_rlb_hash_show, inode->i_private); }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi28100.00%1100.00%
Total28100.00%1100.00%

static const struct file_operations bond_debug_rlb_hash_fops = { .owner = THIS_MODULE, .open = bond_debug_rlb_hash_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, };
void bond_debug_register(struct bonding *bond) { if (!bonding_debug_root) return; bond->debug_dir = debugfs_create_dir(bond->dev->name, bonding_debug_root); if (!bond->debug_dir) { netdev_warn(bond->dev, "failed to register to debugfs\n"); return; } debugfs_create_file("rlb_hash_table", 0400, bond->debug_dir, bond, &bond_debug_rlb_hash_fops); }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi6395.45%266.67%
Veaceslav Falico34.55%133.33%
Total66100.00%3100.00%


void bond_debug_unregister(struct bonding *bond) { if (!bonding_debug_root) return; debugfs_remove_recursive(bond->debug_dir); }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi23100.00%1100.00%
Total23100.00%1100.00%


void bond_debug_reregister(struct bonding *bond) { struct dentry *d; if (!bonding_debug_root) return; d = debugfs_rename(bonding_debug_root, bond->debug_dir, bonding_debug_root, bond->dev->name); if (d) { bond->debug_dir = d; } else { netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n"); bond_debug_unregister(bond); } }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi6695.65%150.00%
Veaceslav Falico34.35%150.00%
Total69100.00%2100.00%


void bond_create_debugfs(void) { bonding_debug_root = debugfs_create_dir("bonding", NULL); if (!bonding_debug_root) { pr_warn("Warning: Cannot create bonding directory in debugfs\n"); } }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi2692.86%150.00%
Joe Perches27.14%150.00%
Total28100.00%2100.00%


void bond_destroy_debugfs(void) { debugfs_remove_recursive(bonding_debug_root); bonding_debug_root = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi16100.00%1100.00%
Total16100.00%1100.00%

#else /* !CONFIG_DEBUG_FS */
void bond_debug_register(struct bonding *bond) { }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi9100.00%1100.00%
Total9100.00%1100.00%


void bond_debug_unregister(struct bonding *bond) { }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi9100.00%1100.00%
Total9100.00%1100.00%


void bond_debug_reregister(struct bonding *bond) { }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi9100.00%1100.00%
Total9100.00%1100.00%


void bond_create_debugfs(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi6100.00%1100.00%
Total6100.00%1100.00%


void bond_destroy_debugfs(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi6100.00%1100.00%
Total6100.00%1100.00%

#endif /* CONFIG_DEBUG_FS */

Overall Contributors

PersonTokensPropCommitsCommitProp
Taku Izumi46793.78%220.00%
Eric W. Biedermann112.21%110.00%
Veaceslav Falico91.81%220.00%
Nikolay Aleksandrov51.00%220.00%
Joe Perches20.40%110.00%
Jiri Bohac20.40%110.00%
David S. Miller20.40%110.00%
Total498100.00%10100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.