Commit 36f0bebd9865dc7e327777fca34b75e65cbfd1a6

Authored by Pavel Emelyanov
Committed by David S. Miller
1 parent 3e37c3f997

[TR]: Use ctl paths to register net/token-ring/ table

The same thing for token-ring - use ctl paths and get
rid of external references on the tr_table.

Unfortunately, I couldn't split this patch into cleanup and
use-the-paths parts.

As a lame excuse I can say, that the cleanup is just moving
the tr_table from one file to another - closet to a single
variable, that this ctl table tunes. Since the source  file
becomes empty after the move, I remove it.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 5 changed files with 25 additions and 47 deletions Side-by-side Diff

include/linux/if_tr.h
... ... @@ -49,9 +49,6 @@
49 49 {
50 50 return (struct trh_hdr *)skb_mac_header(skb);
51 51 }
52   -#ifdef CONFIG_SYSCTL
53   -extern struct ctl_table tr_table[];
54   -#endif
55 52 #endif
56 53  
57 54 /* This is an Token-Ring LLC structure */
... ... @@ -3,9 +3,8 @@
3 3 #
4 4  
5 5 # Check the p8022 selections against net/core/Makefile.
6   -obj-$(CONFIG_SYSCTL) += sysctl_net_802.o
7 6 obj-$(CONFIG_LLC) += p8022.o psnap.o
8   -obj-$(CONFIG_TR) += p8022.o psnap.o tr.o sysctl_net_802.o
  7 +obj-$(CONFIG_TR) += p8022.o psnap.o tr.o
9 8 obj-$(CONFIG_NET_FC) += fc.o
10 9 obj-$(CONFIG_FDDI) += fddi.o
11 10 obj-$(CONFIG_HIPPI) += hippi.o
net/802/sysctl_net_802.c
1   -/* -*- linux-c -*-
2   - * sysctl_net_802.c: sysctl interface to net 802 subsystem.
3   - *
4   - * Begun April 1, 1996, Mike Shaver.
5   - * Added /proc/sys/net/802 directory entry (empty =) ). [MS]
6   - *
7   - * This program is free software; you can redistribute it and/or
8   - * modify it under the terms of the GNU General Public License
9   - * as published by the Free Software Foundation; either version
10   - * 2 of the License, or (at your option) any later version.
11   - */
12   -
13   -#include <linux/mm.h>
14   -#include <linux/if_tr.h>
15   -#include <linux/sysctl.h>
16   -
17   -#ifdef CONFIG_TR
18   -extern int sysctl_tr_rif_timeout;
19   -#endif
20   -
21   -struct ctl_table tr_table[] = {
22   -#ifdef CONFIG_TR
23   - {
24   - .ctl_name = NET_TR_RIF_TIMEOUT,
25   - .procname = "rif_timeout",
26   - .data = &sysctl_tr_rif_timeout,
27   - .maxlen = sizeof(int),
28   - .mode = 0644,
29   - .proc_handler = &proc_dointvec
30   - },
31   -#endif /* CONFIG_TR */
32   - { 0 },
33   -};
... ... @@ -35,6 +35,7 @@
35 35 #include <linux/proc_fs.h>
36 36 #include <linux/seq_file.h>
37 37 #include <linux/init.h>
  38 +#include <linux/sysctl.h>
38 39 #include <net/arp.h>
39 40 #include <net/net_namespace.h>
40 41  
... ... @@ -634,6 +635,26 @@
634 635 return alloc_netdev(sizeof_priv, "tr%d", tr_setup);
635 636 }
636 637  
  638 +#ifdef CONFIG_SYSCTL
  639 +static struct ctl_table tr_table[] = {
  640 + {
  641 + .ctl_name = NET_TR_RIF_TIMEOUT,
  642 + .procname = "rif_timeout",
  643 + .data = &sysctl_tr_rif_timeout,
  644 + .maxlen = sizeof(int),
  645 + .mode = 0644,
  646 + .proc_handler = &proc_dointvec
  647 + },
  648 + { 0 },
  649 +};
  650 +
  651 +static __initdata struct ctl_path tr_path[] = {
  652 + { .procname = "net", .ctl_name = CTL_NET, },
  653 + { .procname = "token-ring", .ctl_name = NET_TR, },
  654 + { }
  655 +};
  656 +#endif
  657 +
637 658 /*
638 659 * Called during bootup. We don't actually have to initialise
639 660 * too much for this.
... ... @@ -644,7 +665,9 @@
644 665 rif_timer.expires = jiffies + sysctl_tr_rif_timeout;
645 666 setup_timer(&rif_timer, rif_check_expire, 0);
646 667 add_timer(&rif_timer);
647   -
  668 +#ifdef CONFIG_SYSCTL
  669 + register_sysctl_paths(tr_path, tr_table);
  670 +#endif
648 671 proc_net_fops_create(&init_net, "tr_rif", S_IRUGO, &rif_seq_fops);
649 672 return 0;
650 673 }
... ... @@ -31,14 +31,6 @@
31 31 #endif
32 32  
33 33 struct ctl_table net_table[] = {
34   -#ifdef CONFIG_TR
35   - {
36   - .ctl_name = NET_TR,
37   - .procname = "token-ring",
38   - .mode = 0555,
39   - .child = tr_table,
40   - },
41   -#endif
42 34 { 0 },
43 35 };
44 36