diff options
Diffstat (limited to 'arch/mips/lasat/sysctl.c')
-rw-r--r-- | arch/mips/lasat/sysctl.c | 121 |
1 files changed, 12 insertions, 109 deletions
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c index b3deed8db619..14b9a28a4aec 100644 --- a/arch/mips/lasat/sysctl.c +++ b/arch/mips/lasat/sysctl.c | |||
@@ -37,23 +37,6 @@ | |||
37 | #include "ds1603.h" | 37 | #include "ds1603.h" |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | /* Strategy function to write EEPROM after changing string entry */ | ||
41 | int sysctl_lasatstring(ctl_table *table, | ||
42 | void *oldval, size_t *oldlenp, | ||
43 | void *newval, size_t newlen) | ||
44 | { | ||
45 | int r; | ||
46 | |||
47 | r = sysctl_string(table, oldval, oldlenp, newval, newlen); | ||
48 | if (r < 0) | ||
49 | return r; | ||
50 | |||
51 | if (newval && newlen) | ||
52 | lasat_write_eeprom_info(); | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | 40 | ||
58 | /* And the same for proc */ | 41 | /* And the same for proc */ |
59 | int proc_dolasatstring(ctl_table *table, int write, | 42 | int proc_dolasatstring(ctl_table *table, int write, |
@@ -113,46 +96,6 @@ int proc_dolasatrtc(ctl_table *table, int write, | |||
113 | } | 96 | } |
114 | #endif | 97 | #endif |
115 | 98 | ||
116 | /* Sysctl for setting the IP addresses */ | ||
117 | int sysctl_lasat_intvec(ctl_table *table, | ||
118 | void *oldval, size_t *oldlenp, | ||
119 | void *newval, size_t newlen) | ||
120 | { | ||
121 | int r; | ||
122 | |||
123 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); | ||
124 | if (r < 0) | ||
125 | return r; | ||
126 | |||
127 | if (newval && newlen) | ||
128 | lasat_write_eeprom_info(); | ||
129 | |||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | #ifdef CONFIG_DS1603 | ||
134 | /* Same for RTC */ | ||
135 | int sysctl_lasat_rtc(ctl_table *table, | ||
136 | void *oldval, size_t *oldlenp, | ||
137 | void *newval, size_t newlen) | ||
138 | { | ||
139 | struct timespec ts; | ||
140 | int r; | ||
141 | |||
142 | read_persistent_clock(&ts); | ||
143 | rtctmp = ts.tv_sec; | ||
144 | if (rtctmp < 0) | ||
145 | rtctmp = 0; | ||
146 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); | ||
147 | if (r < 0) | ||
148 | return r; | ||
149 | if (newval && newlen) | ||
150 | rtc_mips_set_mmss(rtctmp); | ||
151 | |||
152 | return r; | ||
153 | } | ||
154 | #endif | ||
155 | |||
156 | #ifdef CONFIG_INET | 99 | #ifdef CONFIG_INET |
157 | int proc_lasat_ip(ctl_table *table, int write, | 100 | int proc_lasat_ip(ctl_table *table, int write, |
158 | void *buffer, size_t *lenp, loff_t *ppos) | 101 | void *buffer, size_t *lenp, loff_t *ppos) |
@@ -214,23 +157,6 @@ int proc_lasat_ip(ctl_table *table, int write, | |||
214 | } | 157 | } |
215 | #endif | 158 | #endif |
216 | 159 | ||
217 | static int sysctl_lasat_prid(ctl_table *table, | ||
218 | void *oldval, size_t *oldlenp, | ||
219 | void *newval, size_t newlen) | ||
220 | { | ||
221 | int r; | ||
222 | |||
223 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); | ||
224 | if (r < 0) | ||
225 | return r; | ||
226 | if (newval && newlen) { | ||
227 | lasat_board_info.li_eeprom_info.prid = *(int *)newval; | ||
228 | lasat_write_eeprom_info(); | ||
229 | lasat_init_board_info(); | ||
230 | } | ||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | int proc_lasat_prid(ctl_table *table, int write, | 160 | int proc_lasat_prid(ctl_table *table, int write, |
235 | void *buffer, size_t *lenp, loff_t *ppos) | 161 | void *buffer, size_t *lenp, loff_t *ppos) |
236 | { | 162 | { |
@@ -252,115 +178,92 @@ extern int lasat_boot_to_service; | |||
252 | 178 | ||
253 | static ctl_table lasat_table[] = { | 179 | static ctl_table lasat_table[] = { |
254 | { | 180 | { |
255 | .ctl_name = CTL_UNNUMBERED, | ||
256 | .procname = "cpu-hz", | 181 | .procname = "cpu-hz", |
257 | .data = &lasat_board_info.li_cpu_hz, | 182 | .data = &lasat_board_info.li_cpu_hz, |
258 | .maxlen = sizeof(int), | 183 | .maxlen = sizeof(int), |
259 | .mode = 0444, | 184 | .mode = 0444, |
260 | .proc_handler = &proc_dointvec, | 185 | .proc_handler = proc_dointvec, |
261 | .strategy = &sysctl_intvec | ||
262 | }, | 186 | }, |
263 | { | 187 | { |
264 | .ctl_name = CTL_UNNUMBERED, | ||
265 | .procname = "bus-hz", | 188 | .procname = "bus-hz", |
266 | .data = &lasat_board_info.li_bus_hz, | 189 | .data = &lasat_board_info.li_bus_hz, |
267 | .maxlen = sizeof(int), | 190 | .maxlen = sizeof(int), |
268 | .mode = 0444, | 191 | .mode = 0444, |
269 | .proc_handler = &proc_dointvec, | 192 | .proc_handler = proc_dointvec, |
270 | .strategy = &sysctl_intvec | ||
271 | }, | 193 | }, |
272 | { | 194 | { |
273 | .ctl_name = CTL_UNNUMBERED, | ||
274 | .procname = "bmid", | 195 | .procname = "bmid", |
275 | .data = &lasat_board_info.li_bmid, | 196 | .data = &lasat_board_info.li_bmid, |
276 | .maxlen = sizeof(int), | 197 | .maxlen = sizeof(int), |
277 | .mode = 0444, | 198 | .mode = 0444, |
278 | .proc_handler = &proc_dointvec, | 199 | .proc_handler = proc_dointvec, |
279 | .strategy = &sysctl_intvec | ||
280 | }, | 200 | }, |
281 | { | 201 | { |
282 | .ctl_name = CTL_UNNUMBERED, | ||
283 | .procname = "prid", | 202 | .procname = "prid", |
284 | .data = &lasat_board_info.li_prid, | 203 | .data = &lasat_board_info.li_prid, |
285 | .maxlen = sizeof(int), | 204 | .maxlen = sizeof(int), |
286 | .mode = 0644, | 205 | .mode = 0644, |
287 | .proc_handler = &proc_lasat_prid, | 206 | .proc_handler = proc_lasat_prid, |
288 | .strategy = &sysctl_lasat_prid | 207 | . }, |
289 | }, | ||
290 | #ifdef CONFIG_INET | 208 | #ifdef CONFIG_INET |
291 | { | 209 | { |
292 | .ctl_name = CTL_UNNUMBERED, | ||
293 | .procname = "ipaddr", | 210 | .procname = "ipaddr", |
294 | .data = &lasat_board_info.li_eeprom_info.ipaddr, | 211 | .data = &lasat_board_info.li_eeprom_info.ipaddr, |
295 | .maxlen = sizeof(int), | 212 | .maxlen = sizeof(int), |
296 | .mode = 0644, | 213 | .mode = 0644, |
297 | .proc_handler = &proc_lasat_ip, | 214 | .proc_handler = proc_lasat_ip, |
298 | .strategy = &sysctl_lasat_intvec | ||
299 | }, | 215 | }, |
300 | { | 216 | { |
301 | .ctl_name = CTL_UNNUMBERED, | ||
302 | .procname = "netmask", | 217 | .procname = "netmask", |
303 | .data = &lasat_board_info.li_eeprom_info.netmask, | 218 | .data = &lasat_board_info.li_eeprom_info.netmask, |
304 | .maxlen = sizeof(int), | 219 | .maxlen = sizeof(int), |
305 | .mode = 0644, | 220 | .mode = 0644, |
306 | .proc_handler = &proc_lasat_ip, | 221 | .proc_handler = proc_lasat_ip, |
307 | .strategy = &sysctl_lasat_intvec | ||
308 | }, | 222 | }, |
309 | #endif | 223 | #endif |
310 | { | 224 | { |
311 | .ctl_name = CTL_UNNUMBERED, | ||
312 | .procname = "passwd_hash", | 225 | .procname = "passwd_hash", |
313 | .data = &lasat_board_info.li_eeprom_info.passwd_hash, | 226 | .data = &lasat_board_info.li_eeprom_info.passwd_hash, |
314 | .maxlen = | 227 | .maxlen = |
315 | sizeof(lasat_board_info.li_eeprom_info.passwd_hash), | 228 | sizeof(lasat_board_info.li_eeprom_info.passwd_hash), |
316 | .mode = 0600, | 229 | .mode = 0600, |
317 | .proc_handler = &proc_dolasatstring, | 230 | .proc_handler = proc_dolasatstring, |
318 | .strategy = &sysctl_lasatstring | ||
319 | }, | 231 | }, |
320 | { | 232 | { |
321 | .ctl_name = CTL_UNNUMBERED, | ||
322 | .procname = "boot-service", | 233 | .procname = "boot-service", |
323 | .data = &lasat_boot_to_service, | 234 | .data = &lasat_boot_to_service, |
324 | .maxlen = sizeof(int), | 235 | .maxlen = sizeof(int), |
325 | .mode = 0644, | 236 | .mode = 0644, |
326 | .proc_handler = &proc_dointvec, | 237 | .proc_handler = proc_dointvec, |
327 | .strategy = &sysctl_intvec | ||
328 | }, | 238 | }, |
329 | #ifdef CONFIG_DS1603 | 239 | #ifdef CONFIG_DS1603 |
330 | { | 240 | { |
331 | .ctl_name = CTL_UNNUMBERED, | ||
332 | .procname = "rtc", | 241 | .procname = "rtc", |
333 | .data = &rtctmp, | 242 | .data = &rtctmp, |
334 | .maxlen = sizeof(int), | 243 | .maxlen = sizeof(int), |
335 | .mode = 0644, | 244 | .mode = 0644, |
336 | .proc_handler = &proc_dolasatrtc, | 245 | .proc_handler = proc_dolasatrtc, |
337 | .strategy = &sysctl_lasat_rtc | ||
338 | }, | 246 | }, |
339 | #endif | 247 | #endif |
340 | { | 248 | { |
341 | .ctl_name = CTL_UNNUMBERED, | ||
342 | .procname = "namestr", | 249 | .procname = "namestr", |
343 | .data = &lasat_board_info.li_namestr, | 250 | .data = &lasat_board_info.li_namestr, |
344 | .maxlen = sizeof(lasat_board_info.li_namestr), | 251 | .maxlen = sizeof(lasat_board_info.li_namestr), |
345 | .mode = 0444, | 252 | .mode = 0444, |
346 | .proc_handler = &proc_dostring, | 253 | .proc_handler = proc_dostring, |
347 | .strategy = &sysctl_string | ||
348 | }, | 254 | }, |
349 | { | 255 | { |
350 | .ctl_name = CTL_UNNUMBERED, | ||
351 | .procname = "typestr", | 256 | .procname = "typestr", |
352 | .data = &lasat_board_info.li_typestr, | 257 | .data = &lasat_board_info.li_typestr, |
353 | .maxlen = sizeof(lasat_board_info.li_typestr), | 258 | .maxlen = sizeof(lasat_board_info.li_typestr), |
354 | .mode = 0444, | 259 | .mode = 0444, |
355 | .proc_handler = &proc_dostring, | 260 | .proc_handler = proc_dostring, |
356 | .strategy = &sysctl_string | ||
357 | }, | 261 | }, |
358 | {} | 262 | {} |
359 | }; | 263 | }; |
360 | 264 | ||
361 | static ctl_table lasat_root_table[] = { | 265 | static ctl_table lasat_root_table[] = { |
362 | { | 266 | { |
363 | .ctl_name = CTL_UNNUMBERED, | ||
364 | .procname = "lasat", | 267 | .procname = "lasat", |
365 | .mode = 0555, | 268 | .mode = 0555, |
366 | .child = lasat_table | 269 | .child = lasat_table |