Pull bugzilla-1641 into release branch
[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 "dccp.h"
15 #include "feat.h"
16
17 #ifndef CONFIG_SYSCTL
18 #error This file should not be compiled without CONFIG_SYSCTL defined
19 #endif
20
21 static struct ctl_table dccp_default_table[] = {
22         {
23                 .procname       = "seq_window",
24                 .data           = &sysctl_dccp_feat_sequence_window,
25                 .maxlen         = sizeof(sysctl_dccp_feat_sequence_window),
26                 .mode           = 0644,
27                 .proc_handler   = proc_dointvec,
28         },
29         {
30                 .procname       = "rx_ccid",
31                 .data           = &sysctl_dccp_feat_rx_ccid,
32                 .maxlen         = sizeof(sysctl_dccp_feat_rx_ccid),
33                 .mode           = 0644,
34                 .proc_handler   = proc_dointvec,
35         },
36         {
37                 .procname       = "tx_ccid",
38                 .data           = &sysctl_dccp_feat_tx_ccid,
39                 .maxlen         = sizeof(sysctl_dccp_feat_tx_ccid),
40                 .mode           = 0644,
41                 .proc_handler   = proc_dointvec,
42         },
43         {
44                 .procname       = "ack_ratio",
45                 .data           = &sysctl_dccp_feat_ack_ratio,
46                 .maxlen         = sizeof(sysctl_dccp_feat_ack_ratio),
47                 .mode           = 0644,
48                 .proc_handler   = proc_dointvec,
49         },
50         {
51                 .procname       = "send_ackvec",
52                 .data           = &sysctl_dccp_feat_send_ack_vector,
53                 .maxlen         = sizeof(sysctl_dccp_feat_send_ack_vector),
54                 .mode           = 0644,
55                 .proc_handler   = proc_dointvec,
56         },
57         {
58                 .procname       = "send_ndp",
59                 .data           = &sysctl_dccp_feat_send_ndp_count,
60                 .maxlen         = sizeof(sysctl_dccp_feat_send_ndp_count),
61                 .mode           = 0644,
62                 .proc_handler   = proc_dointvec,
63         },
64         {
65                 .procname       = "request_retries",
66                 .data           = &sysctl_dccp_request_retries,
67                 .maxlen         = sizeof(sysctl_dccp_request_retries),
68                 .mode           = 0644,
69                 .proc_handler   = proc_dointvec,
70         },
71         {
72                 .procname       = "retries1",
73                 .data           = &sysctl_dccp_retries1,
74                 .maxlen         = sizeof(sysctl_dccp_retries1),
75                 .mode           = 0644,
76                 .proc_handler   = proc_dointvec,
77         },
78         {
79                 .procname       = "retries2",
80                 .data           = &sysctl_dccp_retries2,
81                 .maxlen         = sizeof(sysctl_dccp_retries2),
82                 .mode           = 0644,
83                 .proc_handler   = proc_dointvec,
84         },
85         {
86                 .procname       = "tx_qlen",
87                 .data           = &sysctl_dccp_tx_qlen,
88                 .maxlen         = sizeof(sysctl_dccp_tx_qlen),
89                 .mode           = 0644,
90                 .proc_handler   = proc_dointvec,
91         },
92
93         { .ctl_name = 0, }
94 };
95
96 static struct ctl_table dccp_table[] = {
97         {
98                 .ctl_name       = NET_DCCP_DEFAULT,
99                 .procname       = "default",
100                 .mode           = 0555,
101                 .child          = dccp_default_table,
102         },
103         { .ctl_name = 0, },
104 };
105
106 static struct ctl_table dccp_dir_table[] = {
107         {
108                 .ctl_name       = NET_DCCP,
109                 .procname       = "dccp",
110                 .mode           = 0555,
111                 .child          = dccp_table,
112         },
113         { .ctl_name = 0, },
114 };
115
116 static struct ctl_table dccp_root_table[] = {
117         {
118                 .ctl_name       = CTL_NET,
119                 .procname       = "net",
120                 .mode           = 0555,
121                 .child          = dccp_dir_table,
122         },
123         { .ctl_name = 0, },
124 };
125
126 static struct ctl_table_header *dccp_table_header;
127
128 int __init dccp_sysctl_init(void)
129 {
130         dccp_table_header = register_sysctl_table(dccp_root_table);
131
132         return dccp_table_header != NULL ? 0 : -ENOMEM;
133 }
134
135 void dccp_sysctl_exit(void)
136 {
137         if (dccp_table_header != NULL) {
138                 unregister_sysctl_table(dccp_table_header);
139                 dccp_table_header = NULL;
140         }
141 }