net/can/proc.c
Source file repositories/reference/linux-study-clean/net/can/proc.c
File Facts
- System
- Linux kernel
- Corpus path
net/can/proc.c- Extension
.c- Size
- 15452 bytes
- Lines
- 508
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/proc_fs.hlinux/list.hlinux/rcupdate.hlinux/if_arp.hlinux/can/can-ml.hlinux/can/core.haf_can.h
Detected Declarations
function can_init_statsfunction calc_ratefunction can_stat_updatefunction can_print_rcvlistfunction hlist_for_each_entry_rcufunction can_print_recv_bannerfunction can_stats_proc_showfunction can_reset_stats_proc_showfunction can_rcvlist_proc_show_onefunction can_rcvlist_proc_showfunction can_rcvlist_proc_show_arrayfunction can_rcvlist_sff_proc_showfunction can_rcvlist_eff_proc_showfunction can_init_procfunction can_remove_proc
Annotated Snippet
if (!hlist_empty(&rcv_array[i])) {
all_empty = 0;
break;
}
if (!all_empty) {
can_print_recv_banner(m);
for (i = 0; i < rcv_array_sz; i++) {
if (!hlist_empty(&rcv_array[i]))
can_print_rcvlist(m, &rcv_array[i], dev);
}
} else
seq_printf(m, " (%s: no entry)\n", DNAME(dev));
}
static int can_rcvlist_sff_proc_show(struct seq_file *m, void *v)
{
struct net_device *dev;
struct can_dev_rcv_lists *dev_rcv_lists;
struct net *net = m->private;
/* RX_SFF */
seq_puts(m, "\nreceive list 'rx_sff':\n");
rcu_read_lock();
/* sff receive list for 'all' CAN devices (dev == NULL) */
dev_rcv_lists = net->can.rx_alldev_list;
can_rcvlist_proc_show_array(m, NULL, dev_rcv_lists->rx_sff,
ARRAY_SIZE(dev_rcv_lists->rx_sff));
/* sff receive list for registered CAN devices */
for_each_netdev_rcu(net, dev) {
struct can_ml_priv *can_ml = can_get_ml_priv(dev);
if (can_ml) {
dev_rcv_lists = &can_ml->dev_rcv_lists;
can_rcvlist_proc_show_array(m, dev, dev_rcv_lists->rx_sff,
ARRAY_SIZE(dev_rcv_lists->rx_sff));
}
}
rcu_read_unlock();
seq_putc(m, '\n');
return 0;
}
static int can_rcvlist_eff_proc_show(struct seq_file *m, void *v)
{
struct net_device *dev;
struct can_dev_rcv_lists *dev_rcv_lists;
struct net *net = m->private;
/* RX_EFF */
seq_puts(m, "\nreceive list 'rx_eff':\n");
rcu_read_lock();
/* eff receive list for 'all' CAN devices (dev == NULL) */
dev_rcv_lists = net->can.rx_alldev_list;
can_rcvlist_proc_show_array(m, NULL, dev_rcv_lists->rx_eff,
ARRAY_SIZE(dev_rcv_lists->rx_eff));
/* eff receive list for registered CAN devices */
for_each_netdev_rcu(net, dev) {
struct can_ml_priv *can_ml = can_get_ml_priv(dev);
if (can_ml) {
dev_rcv_lists = &can_ml->dev_rcv_lists;
can_rcvlist_proc_show_array(m, dev, dev_rcv_lists->rx_eff,
ARRAY_SIZE(dev_rcv_lists->rx_eff));
}
}
rcu_read_unlock();
seq_putc(m, '\n');
return 0;
}
/*
* can_init_proc - create main CAN proc directory and procfs entries
*/
void can_init_proc(struct net *net)
{
/* create /proc/net/can directory */
net->can.proc_dir = proc_net_mkdir(net, "can", net->proc_net);
if (!net->can.proc_dir) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/proc_fs.h`, `linux/list.h`, `linux/rcupdate.h`, `linux/if_arp.h`, `linux/can/can-ml.h`, `linux/can/core.h`, `af_can.h`.
- Detected declarations: `function can_init_stats`, `function calc_rate`, `function can_stat_update`, `function can_print_rcvlist`, `function hlist_for_each_entry_rcu`, `function can_print_recv_banner`, `function can_stats_proc_show`, `function can_reset_stats_proc_show`, `function can_rcvlist_proc_show_one`, `function can_rcvlist_proc_show`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.