aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2007-11-05 23:33:46 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-11-07 07:08:20 -0500
commit7351a22a3ae005422488139365e9a80f560c80b9 (patch)
tree566d9ccf3f7c6b0ecbb4bed84482e8511786d9c7 /net/ipv6
parentdbeeb816e805091e7cfc03baf36dc40b4adb2bbd (diff)
[NETFILTER]: ip{,6}_queue: convert to seq_file interface
I plan to kill ->get_info which means killing proc_net_create(). Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/netfilter/ip6_queue.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 6413a30d9f68..e273605eef85 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -23,6 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/sysctl.h> 24#include <linux/sysctl.h>
25#include <linux/proc_fs.h> 25#include <linux/proc_fs.h>
26#include <linux/seq_file.h>
26#include <linux/mutex.h> 27#include <linux/mutex.h>
27#include <net/net_namespace.h> 28#include <net/net_namespace.h>
28#include <net/sock.h> 29#include <net/sock.h>
@@ -596,15 +597,11 @@ static ctl_table ipq_root_table[] = {
596 { .ctl_name = 0 } 597 { .ctl_name = 0 }
597}; 598};
598 599
599#ifdef CONFIG_PROC_FS 600static int ip6_queue_show(struct seq_file *m, void *v)
600static int
601ipq_get_info(char *buffer, char **start, off_t offset, int length)
602{ 601{
603 int len;
604
605 read_lock_bh(&queue_lock); 602 read_lock_bh(&queue_lock);
606 603
607 len = sprintf(buffer, 604 seq_printf(m,
608 "Peer PID : %d\n" 605 "Peer PID : %d\n"
609 "Copy mode : %hu\n" 606 "Copy mode : %hu\n"
610 "Copy range : %u\n" 607 "Copy range : %u\n"
@@ -621,16 +618,21 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length)
621 queue_user_dropped); 618 queue_user_dropped);
622 619
623 read_unlock_bh(&queue_lock); 620 read_unlock_bh(&queue_lock);
621 return 0;
622}
624 623
625 *start = buffer + offset; 624static int ip6_queue_open(struct inode *inode, struct file *file)
626 len -= offset; 625{
627 if (len > length) 626 return single_open(file, ip6_queue_show, NULL);
628 len = length;
629 else if (len < 0)
630 len = 0;
631 return len;
632} 627}
633#endif /* CONFIG_PROC_FS */ 628
629static const struct file_operations ip6_queue_proc_fops = {
630 .open = ip6_queue_open,
631 .read = seq_read,
632 .llseek = seq_lseek,
633 .release = single_release,
634 .owner = THIS_MODULE,
635};
634 636
635static struct nf_queue_handler nfqh = { 637static struct nf_queue_handler nfqh = {
636 .name = "ip6_queue", 638 .name = "ip6_queue",
@@ -650,10 +652,11 @@ static int __init ip6_queue_init(void)
650 goto cleanup_netlink_notifier; 652 goto cleanup_netlink_notifier;
651 } 653 }
652 654
653 proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); 655 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net);
654 if (proc) 656 if (proc) {
655 proc->owner = THIS_MODULE; 657 proc->owner = THIS_MODULE;
656 else { 658 proc->proc_fops = &ip6_queue_proc_fops;
659 } else {
657 printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); 660 printk(KERN_ERR "ip6_queue: failed to create proc entry\n");
658 goto cleanup_ipqnl; 661 goto cleanup_ipqnl;
659 } 662 }