xfrm_proc.c (bba9525520b6028ecbe7486e13216e9ede8636be) xfrm_proc.c (3617d9496cd92dcca4d0893191d95554590d8d9f)
1/*
2 * xfrm_proc.c
3 *
4 * Copyright (C)2006-2007 USAGI/WIDE Project
5 *
6 * Authors: Masahide NAKAMURA <nakam@linux-ipv6.org>
7 *
8 * This program is free software; you can redistribute it and/or

--- 51 unchanged lines hidden (view full) ---

60 net->mib.xfrm_statistics);
61 for (i = 0; xfrm_mib_list[i].name; i++)
62 seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name,
63 buff[i]);
64
65 return 0;
66}
67
1/*
2 * xfrm_proc.c
3 *
4 * Copyright (C)2006-2007 USAGI/WIDE Project
5 *
6 * Authors: Masahide NAKAMURA <nakam@linux-ipv6.org>
7 *
8 * This program is free software; you can redistribute it and/or

--- 51 unchanged lines hidden (view full) ---

60 net->mib.xfrm_statistics);
61 for (i = 0; xfrm_mib_list[i].name; i++)
62 seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name,
63 buff[i]);
64
65 return 0;
66}
67
68static int xfrm_statistics_seq_open(struct inode *inode, struct file *file)
69{
70 return single_open_net(inode, file, xfrm_statistics_seq_show);
71}
72
73static const struct file_operations xfrm_statistics_seq_fops = {
74 .open = xfrm_statistics_seq_open,
75 .read = seq_read,
76 .llseek = seq_lseek,
77 .release = single_release_net,
78};
79
80int __net_init xfrm_proc_init(struct net *net)
81{
68int __net_init xfrm_proc_init(struct net *net)
69{
82 if (!proc_create("xfrm_stat", 0444, net->proc_net,
83 &xfrm_statistics_seq_fops))
70 if (!proc_create_net_single("xfrm_stat", 0444, net->proc_net,
71 xfrm_statistics_seq_show, NULL))
84 return -ENOMEM;
85 return 0;
86}
87
88void xfrm_proc_fini(struct net *net)
89{
90 remove_proc_entry("xfrm_stat", net->proc_net);
91}
72 return -ENOMEM;
73 return 0;
74}
75
76void xfrm_proc_fini(struct net *net)
77{
78 remove_proc_entry("xfrm_stat", net->proc_net);
79}