aboutsummaryrefslogtreecommitdiffstats
path: root/net/x25/x25_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/x25/x25_proc.c')
-rw-r--r--net/x25/x25_proc.c47
1 files changed, 14 insertions, 33 deletions
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c
index 2ffde4631ae2..0917f047f2cf 100644
--- a/net/x25/x25_proc.c
+++ b/net/x25/x25_proc.c
@@ -187,7 +187,6 @@ static int x25_seq_forward_open(struct inode *inode, struct file *file)
187} 187}
188 188
189static const struct file_operations x25_seq_socket_fops = { 189static const struct file_operations x25_seq_socket_fops = {
190 .owner = THIS_MODULE,
191 .open = x25_seq_socket_open, 190 .open = x25_seq_socket_open,
192 .read = seq_read, 191 .read = seq_read,
193 .llseek = seq_lseek, 192 .llseek = seq_lseek,
@@ -195,7 +194,6 @@ static const struct file_operations x25_seq_socket_fops = {
195}; 194};
196 195
197static const struct file_operations x25_seq_route_fops = { 196static const struct file_operations x25_seq_route_fops = {
198 .owner = THIS_MODULE,
199 .open = x25_seq_route_open, 197 .open = x25_seq_route_open,
200 .read = seq_read, 198 .read = seq_read,
201 .llseek = seq_lseek, 199 .llseek = seq_lseek,
@@ -203,55 +201,38 @@ static const struct file_operations x25_seq_route_fops = {
203}; 201};
204 202
205static const struct file_operations x25_seq_forward_fops = { 203static const struct file_operations x25_seq_forward_fops = {
206 .owner = THIS_MODULE,
207 .open = x25_seq_forward_open, 204 .open = x25_seq_forward_open,
208 .read = seq_read, 205 .read = seq_read,
209 .llseek = seq_lseek, 206 .llseek = seq_lseek,
210 .release = seq_release, 207 .release = seq_release,
211}; 208};
212 209
213static struct proc_dir_entry *x25_proc_dir;
214
215int __init x25_proc_init(void) 210int __init x25_proc_init(void)
216{ 211{
217 struct proc_dir_entry *p; 212 if (!proc_mkdir("x25", init_net.proc_net))
218 int rc = -ENOMEM; 213 return -ENOMEM;
219 214
220 x25_proc_dir = proc_mkdir("x25", init_net.proc_net); 215 if (!proc_create("x25/route", S_IRUGO, init_net.proc_net,
221 if (!x25_proc_dir) 216 &x25_seq_route_fops))
222 goto out; 217 goto out;
223 218
224 p = proc_create("route", S_IRUGO, x25_proc_dir, &x25_seq_route_fops); 219 if (!proc_create("x25/socket", S_IRUGO, init_net.proc_net,
225 if (!p) 220 &x25_seq_socket_fops))
226 goto out_route; 221 goto out;
227
228 p = proc_create("socket", S_IRUGO, x25_proc_dir, &x25_seq_socket_fops);
229 if (!p)
230 goto out_socket;
231 222
232 p = proc_create("forward", S_IRUGO, x25_proc_dir, 223 if (!proc_create("x25/forward", S_IRUGO, init_net.proc_net,
233 &x25_seq_forward_fops); 224 &x25_seq_forward_fops))
234 if (!p) 225 goto out;
235 goto out_forward; 226 return 0;
236 rc = 0;
237 227
238out: 228out:
239 return rc; 229 remove_proc_subtree("x25", init_net.proc_net);
240out_forward: 230 return -ENOMEM;
241 remove_proc_entry("socket", x25_proc_dir);
242out_socket:
243 remove_proc_entry("route", x25_proc_dir);
244out_route:
245 remove_proc_entry("x25", init_net.proc_net);
246 goto out;
247} 231}
248 232
249void __exit x25_proc_exit(void) 233void __exit x25_proc_exit(void)
250{ 234{
251 remove_proc_entry("forward", x25_proc_dir); 235 remove_proc_subtree("x25", init_net.proc_net);
252 remove_proc_entry("route", x25_proc_dir);
253 remove_proc_entry("socket", x25_proc_dir);
254 remove_proc_entry("x25", init_net.proc_net);
255} 236}
256 237
257#else /* CONFIG_PROC_FS */ 238#else /* CONFIG_PROC_FS */