test Blog
Happy living

[PATCH] [TCP]: Move seq_ops from tcp_iter_state to tcp_seq_afinfo.

老鼠 posted @ 2009年4月15日 23:48 in patch , 2642 阅读
To: <davem@...>
Cc: <netdev@...>, Denis V. Lunev <den@...>
 
Date: Tuesday, April 8, 2008 - 9:29 am


 

No need to create seq_operations for each instance of 'netstat'.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 include/net/tcp.h   |    3 +--
 net/ipv4/tcp_ipv4.c |   14 ++++++++------
 net/ipv6/tcp_ipv6.c |    4 +++-
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index f9d6b89..a386bdd 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1324,8 +1324,8 @@ struct tcp_seq_afinfo {
 	struct module		*owner;
 	char			*name;
 	sa_family_t		family;
-	int			(*seq_show) (struct seq_file *m, void *v);
 	struct file_operations	*seq_fops;
+	struct seq_operations	seq_ops;
 };
 
 struct tcp_iter_state {
@@ -1334,7 +1334,6 @@ struct tcp_iter_state {
 	enum tcp_seq_states	state;
 	struct sock		*syn_wait_sk;
 	int			bucket, sbucket, num, uid;
-	struct seq_operations	seq_ops;
 };
 
 extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index e5dd52b..0d0e220 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2230,13 +2230,9 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
 		goto out_kfree;
 
 	s->family		= afinfo->family;
-	s->seq_ops.start	= tcp_seq_start;
-	s->seq_ops.next		= tcp_seq_next;
-	s->seq_ops.show		= afinfo->seq_show;
-	s->seq_ops.stop		= tcp_seq_stop;
 	s->p.net                = net;
 
-	rc = seq_open(file, &s->seq_ops);
+	rc = seq_open(file, &afinfo->seq_ops);
 	if (rc)
 		goto out_put_net;
 	seq = file->private_data;
@@ -2270,6 +2266,10 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
 	afinfo->seq_fops->llseek	= seq_lseek;
 	afinfo->seq_fops->release	= tcp_seq_release;
 
+	afinfo->seq_ops.start		= tcp_seq_start;
+	afinfo->seq_ops.next		= tcp_seq_next;
+	afinfo->seq_ops.stop		= tcp_seq_stop;
+
 	p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
 	if (p)
 		p->data = afinfo;
@@ -2415,8 +2415,10 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = {
 	.owner		= THIS_MODULE,
 	.name		= "tcp",
 	.family		= AF_INET,
-	.seq_show	= tcp4_seq_show,
 	.seq_fops	= &tcp4_seq_fops,
+	.seq_ops	= {
+		.show		= tcp4_seq_show,
+	},
 };
 
 static int tcp4_proc_init_net(struct net *net)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 378cc40..09d9184 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2126,8 +2126,10 @@ static struct tcp_seq_afinfo tcp6_seq_afinfo = {
 	.owner		= THIS_MODULE,
 	.name		= "tcp6",
 	.family		= AF_INET6,
-	.seq_show	= tcp6_seq_show,
 	.seq_fops	= &tcp6_seq_fops,
+	.seq_ops	= {
+		.show		= tcp6_seq_show,
+	},
 };
 
 int tcp6_proc_init(struct net *net)
-- 
1.5.3.rc5

 

TNEGA Application St 说:
2022年11月08日 22:33

To avoid congestion and providing transparent public services. The Tamil Nadu state government has implemented general software. For citizens to access all government services such as income certificate, residence certificate, solvency certificate, and more. TNEGA Application Status 2023 The online platform is accessible to all TN citizens making it easy to avail services through mobile or computer devices.

Pshr.pspcl.in 说:
2022年11月14日 12:28

The Punjab State Power Corporation Limited (PSPCL) is a famous power generating and distributing situated in Punjab under the State government of Punjab. The Company serves millions of residents in the state, ensuring 24/7 power distribution to all connected users. Pshr.pspcl.in The busy power plant offers employment to thousands of people in the state and hires new employees every year. To cater for the large number and ensure all employees receive their salaries on time.

NCERT 9th Class Exe 说:
2023年9月08日 19:20

Exemplar Problems and Solutions Required for CBSE Exam, as well as useful to form the Foundation in the NCERT Examination, Students Download the latest NCERT Maths Exemplar Problems Class 9 in Pdf Format, in both Hindi and English. Urdu Medium You can also buy them from the links given.Our website we are Providing the NCERT Maths Exemplar 2024 for all Chapters of class 9, All the Questions are NCERT 9th Class Exemplar for Maths 2024 very Important for the Upcoming class 9 Maths Exam, All the NCERT Class 9 Exemplar Solutions 2024 have been Explained in a way to help Students Thoroughly Understand the concept.For All class 9 Students Preparing for their Maths Exam 2024, Solving the NCERT Maths Exemplar Problems 2024 is the best way to Tackle the Complex Problems asked in Science Exam, we are Providing the NCERT Class 9 Maths Exemplar Problems


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter