Skip to contentSkip to conversation

ipv4: move proc stuff from net/ipv4/af_inet.c to net/ipv4/proc.c

PATCH In review [email protected] 2 participants 2 messages Oct 29, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv4: move proc stuff from net/ipv4/af_inet.c to net/ipv4/proc.c

David,

Please consider pulling from:

kernel.bkbits.net:/home/acme/net-2.5

This is to just flush my tree, I have confirmed the crash when
using cat /proc/net/llc/core after psnap.o is loaded, will be fixing it, have not confirmed the crash using cat /proc/net/arp, will try it again in a different test case tho.

- Arnaldo

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================

[email protected], 2002-10-29 10:31:48-03:00, [email protected]
ipv4: move proc stuff from net/ipv4/af_inet.c to net/ipv4/proc.c

Also make compilation of this misc proc stuff not compile/link if CONFIG_PROC_FS is not set. Now to seq_file this routines.

 include/net/ip_fib.h |    1 +
 net/ipv4/Makefile    |    3 ++-
 net/ipv4/af_inet.c   |   29 +++++------------------------
 net/ipv4/fib_hash.c  |   12 ++++++++++++
 net/ipv4/proc.c      |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 52 insertions(+), 25 deletions(-)
include/net/ip_fib.h +1 -0
diff -Nru a/include/net/ip_fib.h b/include/net/ip_fib.h
@@ -277,5 +277,6 @@
 }
 
 extern int fib_proc_init(void);
+extern void fib_proc_exit(void);
 
 #endif  /* _NET_FIB_H */
net/ipv4/Makefile +2 -1
diff -Nru a/net/ipv4/Makefile b/net/ipv4/Makefile
@@ -2,13 +2,14 @@
 # Makefile for the Linux TCP/IP (INET) layer.
 #
 
-obj-y     := utils.o route.o inetpeer.o proc.o protocol.o \
+obj-y     := utils.o route.o inetpeer.o protocol.o \
 	     ip_input.o ip_fragment.o ip_forward.o ip_options.o \
 	     ip_output.o ip_sockglue.o \
 	     tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \
 	     tcp_diag.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
 	     sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o
 
+obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
 obj-$(CONFIG_IP_ROUTE_NAT) += ip_nat_dumb.o
 obj-$(CONFIG_IP_MROUTE) += ipmr.o
net/ipv4/af_inet.c +5 -24
diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
@@ -1155,12 +1155,9 @@
 
 #ifdef CONFIG_PROC_FS
 
+extern int ip_misc_proc_init(void);
 extern int raw_get_info(char *, char **, off_t, int);
-extern int snmp_get_info(char *, char **, off_t, int);
-extern int netstat_get_info(char *, char **, off_t, int);
-extern int afinet_get_info(char *, char **, off_t, int);
 extern int tcp_get_info(char *, char **, off_t, int);
-extern int udp_get_info(char *, char **, off_t, int);
 
 int __init ipv4_proc_init(void)
 {
@@ -1168,45 +1165,29 @@
 
 	if (!proc_net_create("raw", 0, raw_get_info))
 		goto out_raw;
-	if (!proc_net_create("netstat", 0, netstat_get_info))
-		goto out_netstat;
-	if (!proc_net_create("snmp", 0, snmp_get_info))
-		goto out_snmp;
-	if (!proc_net_create("sockstat", 0, afinet_get_info))
-		goto out_sockstat;
 	if (!proc_net_create("tcp", 0, tcp_get_info))
 		goto out_tcp;
 	if (udp_proc_init())
 		goto out_udp;
 	if (fib_proc_init())
 		goto out_fib;
+	if (ip_misc_proc_init())
+		goto out_misc;
 out:
 	return rc;
+out_misc:
+	fib_proc_exit();
 out_fib:
 	udp_proc_exit();
 out_udp:
 	proc_net_remove("tcp");
 out_tcp:
-	proc_net_remove("sockstat");
-out_sockstat:
-	proc_net_remove("snmp");
-out_snmp:
-	proc_net_remove("netstat");
-out_netstat:
 	proc_net_remove("raw");
 out_raw:
 	rc = -ENOMEM;
 	goto out;
 }
 
-int ip_seq_release(struct inode *inode, struct file *file)
-{
-	struct seq_file *seq = (struct seq_file *)file->private_data;
-
-	kfree(seq->private);
-	seq->private = NULL;
-	return seq_release(inode, file);
-}
 #else /* CONFIG_PROC_FS */
 int __init ipv4_proc_init(void)
 {
net/ipv4/fib_hash.c +12 -0
diff -Nru a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
@@ -1086,8 +1086,20 @@
 		rc = -ENOMEM;
 	return rc;
 }
+
+void __init fib_proc_exit(void)
+{
+	remove_proc_entry("route", proc_net);
+}
+
 #else /* CONFIG_PROC_FS */
+
 int __init fib_proc_init(void)
+{
+	return 0;
+}
+
+void __init fib_proc_exit(void)
 {
 	return 0;
 }
net/ipv4/proc.c +32 -0
diff -Nru a/net/ipv4/proc.c b/net/ipv4/proc.c
@@ -47,6 +47,8 @@
 #include <net/tcp.h>
 #include <net/udp.h>
 #include <linux/skbuff.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <net/sock.h>
 #include <net/raw.h>
 
@@ -211,4 +213,34 @@
 	if (len < 0)
 		len = 0; 
 	return len;
+}
+
+int __init ip_misc_proc_init(void)
+{
+	int rc = 0;
+
+	if (!proc_net_create("netstat", 0, netstat_get_info))
+		goto out_netstat;
+	if (!proc_net_create("snmp", 0, snmp_get_info))
+		goto out_snmp;
+	if (!proc_net_create("sockstat", 0, afinet_get_info))
+		goto out_sockstat;
+out:
+	return rc;
+out_sockstat:
+	proc_net_remove("snmp");
+out_snmp:
+	proc_net_remove("netstat");
+out_netstat:
+	rc = -ENOMEM;
+	goto out;
+}
+
+int ip_seq_release(struct inode *inode, struct file *file)
+{
+	struct seq_file *seq = (struct seq_file *)file->private_data;
+
+	kfree(seq->private);
+	seq->private = NULL;
+	return seq_release(inode, file);
 }

===================================================================

This BitKeeper patch contains the following changesets:
1.821
## Wrapped with gzip_uu ##

begin 664 bkpatch13737 M'XL(`#F.OCT``^U8;7/:.!#^C'Z%KKT/I"U&+[:1X>BD35\NTS;)I--OF6&, M+0<W8%%;T&:.^^^WDAU>0AP*<Q\##)*UTNK1[K.KA>?X6R'S;B.,)A(]QW^K M0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@8O\1^2 M0RGU.JLDFF8:3#8P)RKS:)JM\N@[F!M@;EJ?PQIH.Q3[1H=@F*%&FN#F]NJC M(]1H7/O,9S("GMVB0M+[D:ZJ+&9NLOMH+[UH05?8[$9"*MB;8](V+=BW)7* MMRO&NX*">M3C!Q84[*FB>/PWF2G&ZV)AY9*#@H$(8R[0K:8&%C^/E13H']0 M(Y?&DI4DT_EM\YE-^,]>V?,/!*0^%]T9=6:0L7V@-)>N5S/(.!(.677?AO< M+[VQ!^_W^>F&BFBD9);DQ]=A*'.=P;T5RX=U!9P0X!PD?T("2BS?O7WYSI_X M_BC?RU_%=7ROD![=3>_/N\*L7Q7_;O)JMND!3.Z/66ZZAD9TRRC$GEKKF MRJB86W-S&+J;63EPUA#^JKPI_K@+DT&4RU#+YC/H%SK4$$'D%:X>!M<P(<T2 MM7F-5-)>G:HBFTQ+/:97H\2(ZC6HZ&:%)DP,3>KT5%-[YC[K+F,[C^S4@R2 MY2YE]JAP'E7SH/_0G#NS5-.J1[./,6CK_=GYE_=?X!QW>'I+OX!#C-MR.99A M(9N%SF<1C&8*W/K"-F"?<M"2[X7YMOZJ1I>T?$]V*RY-7YDFM;K:0XQK>4@ M#G5H/7R3Y!)VE#^6,H#?6'\&=6??/G_N+>VU#K4"9_'T5G_.1B,)MIQ-^FX< />\/A,$'_22`$,GW%0``
`
end

#1 lore raw

From: [email protected]
Date: Tue, 29 Oct 2002 11:42:07 -0200 (BRDT)

Please consider pulling from:

kernel.bkbits.net:/home/acme/net-2.5

Pulled, thanks.

I just did a push to Linus, so this will go show up in the next round.