Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[linux-2.6] / net / dccp / sysctl.c
1 /*
2  *  net/dccp/sysctl.c
3  *
4  *  An implementation of the DCCP protocol
5  *  Arnaldo Carvalho de Melo <acme@mandriva.com>
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 v2
9  *      as published by the Free Software Foundation.
10  */
11
12 #include <linux/mm.h>
13 #include <linux/sysctl.h>
14 #include "feat.h"
15
16 #ifndef CONFIG_SYSCTL
17 #error This file should not be compiled without CONFIG_SYSCTL defined
18 #endif
19
20 static struct ctl_table dccp_default_table[] = {
21         {
22                 .ctl_name       = NET_DCCP_DEFAULT_SEQ_WINDOW,
23                 .procname       = "seq_window",
24                 .data           = &dccp_feat_default_sequence_window,
25                 .maxlen         = sizeof(dccp_feat_default_sequence_window),
26                 .mode           = 0644,
27                 .proc_handler   = proc_dointvec,
28         },
29         {
30                 .ctl_name       = NET_DCCP_DEFAULT_RX_CCID,
31                 .procname       = "rx_ccid",
32                 .data           = &dccp_feat_default_rx_ccid,
33                 .maxlen         = sizeof(dccp_feat_default_rx_ccid),
34                 .mode           = 0644,
35                 .proc_handler   = proc_dointvec,
36         },
37         {
38                 .ctl_name       = NET_DCCP_DEFAULT_TX_CCID,
39                 .procname       = "tx_ccid",
40                 .data           = &dccp_feat_default_tx_ccid,
41                 .maxlen         = sizeof(dccp_feat_default_tx_ccid),
42                 .mode           = 0644,
43                 .proc_handler   = proc_dointvec,
44         },
45         {
46                 .ctl_name       = NET_DCCP_DEFAULT_ACK_RATIO,
47                 .procname       = "ack_ratio",
48                 .data           = &dccp_feat_default_ack_ratio,
49                 .maxlen         = sizeof(dccp_feat_default_ack_ratio),
50                 .mode           = 0644,
51                 .proc_handler   = proc_dointvec,
52         },
53         {
54                 .ctl_name       = NET_DCCP_DEFAULT_SEND_ACKVEC,
55                 .procname       = "send_ackvec",
56                 .data           = &dccp_feat_default_send_ack_vector,
57                 .maxlen         = sizeof(dccp_feat_default_send_ack_vector),
58                 .mode           = 0644,
59                 .proc_handler   = proc_dointvec,
60         },
61         {
62                 .ctl_name       = NET_DCCP_DEFAULT_SEND_NDP,
63                 .procname       = "send_ndp",
64                 .data           = &dccp_feat_default_send_ndp_count,
65                 .maxlen         = sizeof(dccp_feat_default_send_ndp_count),
66                 .mode           = 0644,
67                 .proc_handler   = proc_dointvec,
68         },
69         { .ctl_name = 0, }
70 };
71
72 static struct ctl_table dccp_table[] = {
73         {
74                 .ctl_name       = NET_DCCP_DEFAULT,
75                 .procname       = "default",
76                 .mode           = 0555,
77                 .child          = dccp_default_table,
78         },
79         { .ctl_name = 0, },
80 };
81
82 static struct ctl_table dccp_dir_table[] = {
83         {
84                 .ctl_name       = NET_DCCP,
85                 .procname       = "dccp",
86                 .mode           = 0555,
87                 .child          = dccp_table,
88         },
89         { .ctl_name = 0, },
90 };
91
92 static struct ctl_table dccp_root_table[] = {
93         {
94                 .ctl_name       = CTL_NET,
95                 .procname       = "net",
96                 .mode           = 0555,
97                 .child          = dccp_dir_table,
98         },
99         { .ctl_name = 0, },
100 };
101
102 static struct ctl_table_header *dccp_table_header;
103
104 int __init dccp_sysctl_init(void)
105 {
106         dccp_table_header = register_sysctl_table(dccp_root_table, 1);
107
108         return dccp_table_header != NULL ? 0 : -ENOMEM;
109 }
110
111 void dccp_sysctl_exit(void)
112 {
113         if (dccp_table_header != NULL) {
114                 unregister_sysctl_table(dccp_table_header);
115                 dccp_table_header = NULL;
116         }
117 }