aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2008-07-19 02:03:44 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-19 02:03:44 -0400
commitc4e85f82edcd6027cfe67331a2e00741b009756b (patch)
tree12ac8ea4bb89dbb5671022361dd0c0b78f10ec87 /net/sctp
parentc1e20f7c8b9ccbafc9ea78f2b406738728ce6b81 (diff)
sctp: Don't abort initialization when CONFIG_PROC_FS=n
This puts CONFIG_PROC_FS defines around the proc init/exit functions and also avoids compiling proc.c if procfs is not supported. Also make SCTP_DBG_OBJCNT depend on procfs. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/Kconfig4
-rw-r--r--net/sctp/Makefile4
-rw-r--r--net/sctp/protocol.c11
3 files changed, 14 insertions, 5 deletions
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index 0b79f869c4ea..58b3e882a187 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -47,11 +47,11 @@ config SCTP_DBG_MSG
47 47
48config SCTP_DBG_OBJCNT 48config SCTP_DBG_OBJCNT
49 bool "SCTP: Debug object counts" 49 bool "SCTP: Debug object counts"
50 depends on PROC_FS
50 help 51 help
51 If you say Y, this will enable debugging support for counting the 52 If you say Y, this will enable debugging support for counting the
52 type of objects that are currently allocated. This is useful for 53 type of objects that are currently allocated. This is useful for
53 identifying memory leaks. If the /proc filesystem is enabled this 54 identifying memory leaks. This debug information can be viewed by
54 debug information can be viewed by
55 'cat /proc/net/sctp/sctp_dbg_objcnt' 55 'cat /proc/net/sctp/sctp_dbg_objcnt'
56 56
57 If unsure, say N 57 If unsure, say N
diff --git a/net/sctp/Makefile b/net/sctp/Makefile
index f5356b9d5ee3..6b794734380a 100644
--- a/net/sctp/Makefile
+++ b/net/sctp/Makefile
@@ -9,10 +9,10 @@ sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \
9 transport.o chunk.o sm_make_chunk.o ulpevent.o \ 9 transport.o chunk.o sm_make_chunk.o ulpevent.o \
10 inqueue.o outqueue.o ulpqueue.o command.o \ 10 inqueue.o outqueue.o ulpqueue.o command.o \
11 tsnmap.o bind_addr.o socket.o primitive.o \ 11 tsnmap.o bind_addr.o socket.o primitive.o \
12 output.o input.o debug.o ssnmap.o proc.o \ 12 output.o input.o debug.o ssnmap.o auth.o
13 auth.o
14 13
15sctp-$(CONFIG_SCTP_DBG_OBJCNT) += objcnt.o 14sctp-$(CONFIG_SCTP_DBG_OBJCNT) += objcnt.o
15sctp-$(CONFIG_PROC_FS) += proc.o
16sctp-$(CONFIG_SYSCTL) += sysctl.o 16sctp-$(CONFIG_SYSCTL) += sysctl.o
17 17
18sctp-$(subst m,y,$(CONFIG_IPV6)) += ipv6.o 18sctp-$(subst m,y,$(CONFIG_IPV6)) += ipv6.o
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 98c6a882016a..dd811a8456a8 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -64,9 +64,12 @@
64 64
65/* Global data structures. */ 65/* Global data structures. */
66struct sctp_globals sctp_globals __read_mostly; 66struct sctp_globals sctp_globals __read_mostly;
67struct proc_dir_entry *proc_net_sctp;
68DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics) __read_mostly; 67DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics) __read_mostly;
69 68
69#ifdef CONFIG_PROC_FS
70struct proc_dir_entry *proc_net_sctp;
71#endif
72
70struct idr sctp_assocs_id; 73struct idr sctp_assocs_id;
71DEFINE_SPINLOCK(sctp_assocs_id_lock); 74DEFINE_SPINLOCK(sctp_assocs_id_lock);
72 75
@@ -97,6 +100,7 @@ struct sock *sctp_get_ctl_sock(void)
97/* Set up the proc fs entry for the SCTP protocol. */ 100/* Set up the proc fs entry for the SCTP protocol. */
98static __init int sctp_proc_init(void) 101static __init int sctp_proc_init(void)
99{ 102{
103#ifdef CONFIG_PROC_FS
100 if (!proc_net_sctp) { 104 if (!proc_net_sctp) {
101 struct proc_dir_entry *ent; 105 struct proc_dir_entry *ent;
102 ent = proc_mkdir("sctp", init_net.proc_net); 106 ent = proc_mkdir("sctp", init_net.proc_net);
@@ -131,6 +135,9 @@ out_snmp_proc_init:
131 } 135 }
132out_nomem: 136out_nomem:
133 return -ENOMEM; 137 return -ENOMEM;
138#else
139 return 0;
140#endif /* CONFIG_PROC_FS */
134} 141}
135 142
136/* Clean up the proc fs entry for the SCTP protocol. 143/* Clean up the proc fs entry for the SCTP protocol.
@@ -139,6 +146,7 @@ out_nomem:
139 */ 146 */
140static void sctp_proc_exit(void) 147static void sctp_proc_exit(void)
141{ 148{
149#ifdef CONFIG_PROC_FS
142 sctp_snmp_proc_exit(); 150 sctp_snmp_proc_exit();
143 sctp_eps_proc_exit(); 151 sctp_eps_proc_exit();
144 sctp_assocs_proc_exit(); 152 sctp_assocs_proc_exit();
@@ -148,6 +156,7 @@ static void sctp_proc_exit(void)
148 proc_net_sctp = NULL; 156 proc_net_sctp = NULL;
149 remove_proc_entry("sctp", init_net.proc_net); 157 remove_proc_entry("sctp", init_net.proc_net);
150 } 158 }
159#endif
151} 160}
152 161
153/* Private helper to extract ipv4 address and stash them in 162/* Private helper to extract ipv4 address and stash them in