Skip to content

Commit b5ccd79

Browse files
xemuldavem330
authored andcommitted
[NET]: Simple ctl_table to ctl_path conversions.
This patch includes many places, that only required replacing the ctl_table-s with appropriate ctl_paths and call register_sysctl_paths(). Nothing special was done with them. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cb7928a commit b5ccd79

10 files changed

Lines changed: 52 additions & 204 deletions

File tree

‎net/appletalk/sysctl_net_atalk.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,17 @@ static struct ctl_table atalk_table[] = {
4949
{ 0 },
5050
};
5151

52-
static struct ctl_table atalk_dir_table[] = {
53-
{
54-
.ctl_name = NET_ATALK,
55-
.procname = "appletalk",
56-
.mode = 0555,
57-
.child = atalk_table,
58-
},
59-
{ 0 },
60-
};
61-
62-
static struct ctl_table atalk_root_table[] = {
63-
{
64-
.ctl_name = CTL_NET,
65-
.procname = "net",
66-
.mode = 0555,
67-
.child = atalk_dir_table,
68-
},
69-
{ 0 },
52+
static struct ctl_path atalk_path[] = {
53+
{ .procname = "net", .ctl_name = CTL_NET, },
54+
{ .procname = "appletalk", .ctl_name = NET_ATALK, },
55+
{ }
7056
};
7157

7258
static struct ctl_table_header *atalk_table_header;
7359

7460
void atalk_register_sysctl(void)
7561
{
76-
atalk_table_header = register_sysctl_table(atalk_root_table);
62+
atalk_table_header = register_sysctl_paths(atalk_path, atalk_table);
7763
}
7864

7965
void atalk_unregister_sysctl(void)

‎net/bridge/br_netfilter.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -967,24 +967,10 @@ static ctl_table brnf_table[] = {
967967
{ .ctl_name = 0 }
968968
};
969969

970-
static ctl_table brnf_bridge_table[] = {
971-
{
972-
.ctl_name = NET_BRIDGE,
973-
.procname = "bridge",
974-
.mode = 0555,
975-
.child = brnf_table,
976-
},
977-
{ .ctl_name = 0 }
978-
};
979-
980-
static ctl_table brnf_net_table[] = {
981-
{
982-
.ctl_name = CTL_NET,
983-
.procname = "net",
984-
.mode = 0555,
985-
.child = brnf_bridge_table,
986-
},
987-
{ .ctl_name = 0 }
970+
static struct ctl_path brnf_path[] = {
971+
{ .procname = "net", .ctl_name = CTL_NET, },
972+
{ .procname = "bridge", .ctl_name = NET_BRIDGE, },
973+
{ }
988974
};
989975
#endif
990976

@@ -996,7 +982,7 @@ int __init br_netfilter_init(void)
996982
if (ret < 0)
997983
return ret;
998984
#ifdef CONFIG_SYSCTL
999-
brnf_sysctl_header = register_sysctl_table(brnf_net_table);
985+
brnf_sysctl_header = register_sysctl_paths(brnf_path, brnf_table);
1000986
if (brnf_sysctl_header == NULL) {
1001987
printk(KERN_WARNING
1002988
"br_netfilter: can't register to sysctl.\n");

‎net/dccp/sysctl.c‎

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -100,41 +100,19 @@ static struct ctl_table dccp_default_table[] = {
100100
{ .ctl_name = 0, }
101101
};
102102

103-
static struct ctl_table dccp_table[] = {
104-
{
105-
.ctl_name = NET_DCCP_DEFAULT,
106-
.procname = "default",
107-
.mode = 0555,
108-
.child = dccp_default_table,
109-
},
110-
{ .ctl_name = 0, },
111-
};
112-
113-
static struct ctl_table dccp_dir_table[] = {
114-
{
115-
.ctl_name = NET_DCCP,
116-
.procname = "dccp",
117-
.mode = 0555,
118-
.child = dccp_table,
119-
},
120-
{ .ctl_name = 0, },
121-
};
122-
123-
static struct ctl_table dccp_root_table[] = {
124-
{
125-
.ctl_name = CTL_NET,
126-
.procname = "net",
127-
.mode = 0555,
128-
.child = dccp_dir_table,
129-
},
130-
{ .ctl_name = 0, },
103+
static struct ctl_path dccp_path[] = {
104+
{ .procname = "net", .ctl_name = CTL_NET, },
105+
{ .procname = "dccp", .ctl_name = NET_DCCP, },
106+
{ .procname = "default", .ctl_name = NET_DCCP_DEFAULT, },
107+
{ }
131108
};
132109

133110
static struct ctl_table_header *dccp_table_header;
134111

135112
int __init dccp_sysctl_init(void)
136113
{
137-
dccp_table_header = register_sysctl_table(dccp_root_table);
114+
dccp_table_header = register_sysctl_paths(dccp_path,
115+
dccp_default_table);
138116

139117
return dccp_table_header != NULL ? 0 : -ENOMEM;
140118
}

‎net/ipx/sysctl_net_ipx.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,17 @@ static struct ctl_table ipx_table[] = {
2828
{ 0 },
2929
};
3030

31-
static struct ctl_table ipx_dir_table[] = {
32-
{
33-
.ctl_name = NET_IPX,
34-
.procname = "ipx",
35-
.mode = 0555,
36-
.child = ipx_table,
37-
},
38-
{ 0 },
39-
};
40-
41-
static struct ctl_table ipx_root_table[] = {
42-
{
43-
.ctl_name = CTL_NET,
44-
.procname = "net",
45-
.mode = 0555,
46-
.child = ipx_dir_table,
47-
},
48-
{ 0 },
31+
static struct ctl_path ipx_path[] = {
32+
{ .procname = "net", .ctl_name = CTL_NET, },
33+
{ .procname = "ipx", .ctl_name = NET_IPX, },
34+
{ }
4935
};
5036

5137
static struct ctl_table_header *ipx_table_header;
5238

5339
void ipx_register_sysctl(void)
5440
{
55-
ipx_table_header = register_sysctl_table(ipx_root_table);
41+
ipx_table_header = register_sysctl_paths(ipx_path, ipx_table);
5642
}
5743

5844
void ipx_unregister_sysctl(void)

‎net/irda/irsysctl.c‎

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -234,28 +234,10 @@ static ctl_table irda_table[] = {
234234
{ .ctl_name = 0 }
235235
};
236236

237-
/* One directory */
238-
static ctl_table irda_net_table[] = {
239-
{
240-
.ctl_name = NET_IRDA,
241-
.procname = "irda",
242-
.maxlen = 0,
243-
.mode = 0555,
244-
.child = irda_table
245-
},
246-
{ .ctl_name = 0 }
247-
};
248-
249-
/* The parent directory */
250-
static ctl_table irda_root_table[] = {
251-
{
252-
.ctl_name = CTL_NET,
253-
.procname = "net",
254-
.maxlen = 0,
255-
.mode = 0555,
256-
.child = irda_net_table
257-
},
258-
{ .ctl_name = 0 }
237+
static struct ctl_path irda_path[] = {
238+
{ .procname = "net", .ctl_name = CTL_NET, },
239+
{ .procname = "irda", .ctl_name = NET_IRDA, },
240+
{ }
259241
};
260242

261243
static struct ctl_table_header *irda_table_header;
@@ -268,7 +250,7 @@ static struct ctl_table_header *irda_table_header;
268250
*/
269251
int __init irda_sysctl_register(void)
270252
{
271-
irda_table_header = register_sysctl_table(irda_root_table);
253+
irda_table_header = register_sysctl_paths(irda_path, irda_table);
272254
if (!irda_table_header)
273255
return -ENOMEM;
274256

‎net/llc/sysctl_net_llc.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,17 @@ static struct ctl_table llc_table[] = {
9292
{ 0 },
9393
};
9494

95-
static struct ctl_table llc_dir_table[] = {
96-
{
97-
.ctl_name = NET_LLC,
98-
.procname = "llc",
99-
.mode = 0555,
100-
.child = llc_table,
101-
},
102-
{ 0 },
103-
};
104-
105-
static struct ctl_table llc_root_table[] = {
106-
{
107-
.ctl_name = CTL_NET,
108-
.procname = "net",
109-
.mode = 0555,
110-
.child = llc_dir_table,
111-
},
112-
{ 0 },
95+
static struct ctl_path llc_path[] = {
96+
{ .procname = "net", .ctl_name = CTL_NET, },
97+
{ .procname = "llc", .ctl_name = NET_LLC, },
98+
{ }
11399
};
114100

115101
static struct ctl_table_header *llc_table_header;
116102

117103
int __init llc_sysctl_init(void)
118104
{
119-
llc_table_header = register_sysctl_table(llc_root_table);
105+
llc_table_header = register_sysctl_paths(llc_path, llc_table);
120106

121107
return llc_table_header ? 0 : -ENOMEM;
122108
}

‎net/netrom/sysctl_net_netrom.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -170,29 +170,15 @@ static ctl_table nr_table[] = {
170170
{ .ctl_name = 0 }
171171
};
172172

173-
static ctl_table nr_dir_table[] = {
174-
{
175-
.ctl_name = NET_NETROM,
176-
.procname = "netrom",
177-
.mode = 0555,
178-
.child = nr_table
179-
},
180-
{ .ctl_name = 0 }
181-
};
182-
183-
static ctl_table nr_root_table[] = {
184-
{
185-
.ctl_name = CTL_NET,
186-
.procname = "net",
187-
.mode = 0555,
188-
.child = nr_dir_table
189-
},
190-
{ .ctl_name = 0 }
173+
static struct ctl_path nr_path[] = {
174+
{ .procname = "net", .ctl_name = CTL_NET, },
175+
{ .procname = "netrom", .ctl_name = NET_NETROM, },
176+
{ }
191177
};
192178

193179
void __init nr_register_sysctl(void)
194180
{
195-
nr_table_header = register_sysctl_table(nr_root_table);
181+
nr_table_header = register_sysctl_paths(nr_path, nr_table);
196182
}
197183

198184
void nr_unregister_sysctl(void)

‎net/rose/sysctl_net_rose.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,29 +138,15 @@ static ctl_table rose_table[] = {
138138
{ .ctl_name = 0 }
139139
};
140140

141-
static ctl_table rose_dir_table[] = {
142-
{
143-
.ctl_name = NET_ROSE,
144-
.procname = "rose",
145-
.mode = 0555,
146-
.child = rose_table
147-
},
148-
{ .ctl_name = 0 }
149-
};
150-
151-
static ctl_table rose_root_table[] = {
152-
{
153-
.ctl_name = CTL_NET,
154-
.procname = "net",
155-
.mode = 0555,
156-
.child = rose_dir_table
157-
},
158-
{ .ctl_name = 0 }
141+
static struct ctl_path rose_path[] = {
142+
{ .procname = "net", .ctl_name = CTL_NET, },
143+
{ .procname = "rose", .ctl_name = NET_ROSE, },
144+
{ }
159145
};
160146

161147
void __init rose_register_sysctl(void)
162148
{
163-
rose_table_header = register_sysctl_table(rose_root_table);
149+
rose_table_header = register_sysctl_paths(rose_path, rose_table);
164150
}
165151

166152
void rose_unregister_sysctl(void)

‎net/sctp/sysctl.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -275,32 +275,18 @@ static ctl_table sctp_table[] = {
275275
{ .ctl_name = 0 }
276276
};
277277

278-
static ctl_table sctp_net_table[] = {
279-
{
280-
.ctl_name = NET_SCTP,
281-
.procname = "sctp",
282-
.mode = 0555,
283-
.child = sctp_table
284-
},
285-
{ .ctl_name = 0 }
286-
};
287-
288-
static ctl_table sctp_root_table[] = {
289-
{
290-
.ctl_name = CTL_NET,
291-
.procname = "net",
292-
.mode = 0555,
293-
.child = sctp_net_table
294-
},
295-
{ .ctl_name = 0 }
278+
static struct ctl_path sctp_path[] = {
279+
{ .procname = "net", .ctl_name = CTL_NET, },
280+
{ .procname = "sctp", .ctl_name = NET_SCTP, },
281+
{ }
296282
};
297283

298284
static struct ctl_table_header * sctp_sysctl_header;
299285

300286
/* Sysctl registration. */
301287
void sctp_sysctl_register(void)
302288
{
303-
sctp_sysctl_header = register_sysctl_table(sctp_root_table);
289+
sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
304290
}
305291

306292
/* Sysctl deregistration. */

‎net/x25/sysctl_net_x25.c‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,29 +84,15 @@ static struct ctl_table x25_table[] = {
8484
{ 0, },
8585
};
8686

87-
static struct ctl_table x25_dir_table[] = {
88-
{
89-
.ctl_name = NET_X25,
90-
.procname = "x25",
91-
.mode = 0555,
92-
.child = x25_table,
93-
},
94-
{ 0, },
95-
};
96-
97-
static struct ctl_table x25_root_table[] = {
98-
{
99-
.ctl_name = CTL_NET,
100-
.procname = "net",
101-
.mode = 0555,
102-
.child = x25_dir_table,
103-
},
104-
{ 0, },
87+
static struct ctl_path x25_path[] = {
88+
{ .procname = "net", .ctl_name = CTL_NET, },
89+
{ .procname = "x25", .ctl_name = NET_X25, },
90+
{ }
10591
};
10692

10793
void __init x25_register_sysctl(void)
10894
{
109-
x25_table_header = register_sysctl_table(x25_root_table);
95+
x25_table_header = register_sysctl_paths(x25_path, x25_table);
11096
}
11197

11298
void x25_unregister_sysctl(void)

0 commit comments

Comments
 (0)