aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 10:38:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 10:38:50 -0500
commit1557d33007f63dd96e5d15f33af389378e5f2e54 (patch)
tree06d05722b2ba5d2a67532f779fa8a88efe3c88f1 /arch/mips
parent6ec22f9b037fc0c2e00ddb7023fad279c365324d (diff)
parentc656ae95d1c5c8ed5763356263ace2d03087efec (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl-2.6: (43 commits) security/tomoyo: Remove now unnecessary handling of security_sysctl. security/tomoyo: Add a special case to handle accesses through the internal proc mount. sysctl: Drop & in front of every proc_handler. sysctl: Remove CTL_NONE and CTL_UNNUMBERED sysctl: kill dead ctl_handler definitions. sysctl: Remove the last of the generic binary sysctl support sysctl net: Remove unused binary sysctl code sysctl security/tomoyo: Don't look at ctl_name sysctl arm: Remove binary sysctl support sysctl x86: Remove dead binary sysctl support sysctl sh: Remove dead binary sysctl support sysctl powerpc: Remove dead binary sysctl support sysctl ia64: Remove dead binary sysctl support sysctl s390: Remove dead sysctl binary support sysctl frv: Remove dead binary sysctl support sysctl mips/lasat: Remove dead binary sysctl support sysctl drivers: Remove dead binary sysctl support sysctl crypto: Remove dead binary sysctl support sysctl security/keys: Remove dead binary sysctl support sysctl kernel: Remove binary sysctl logic ...
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/linux32.c61
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/lasat/sysctl.c121
4 files changed, 14 insertions, 172 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index b77fefaff9da..1a2793efdc4e 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -265,67 +265,6 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
265} 265}
266#endif 266#endif
267 267
268struct sysctl_args32
269{
270 compat_caddr_t name;
271 int nlen;
272 compat_caddr_t oldval;
273 compat_caddr_t oldlenp;
274 compat_caddr_t newval;
275 compat_size_t newlen;
276 unsigned int __unused[4];
277};
278
279#ifdef CONFIG_SYSCTL_SYSCALL
280
281SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
282{
283 struct sysctl_args32 tmp;
284 int error;
285 size_t oldlen;
286 size_t __user *oldlenp = NULL;
287 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
288
289 if (copy_from_user(&tmp, args, sizeof(tmp)))
290 return -EFAULT;
291
292 if (tmp.oldval && tmp.oldlenp) {
293 /* Duh, this is ugly and might not work if sysctl_args
294 is in read-only memory, but do_sysctl does indirectly
295 a lot of uaccess in both directions and we'd have to
296 basically copy the whole sysctl.c here, and
297 glibc's __sysctl uses rw memory for the structure
298 anyway. */
299 if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
300 put_user(oldlen, (size_t __user *)addr))
301 return -EFAULT;
302 oldlenp = (size_t __user *)addr;
303 }
304
305 lock_kernel();
306 error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval),
307 oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
308 unlock_kernel();
309 if (oldlenp) {
310 if (!error) {
311 if (get_user(oldlen, (size_t __user *)addr) ||
312 put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
313 error = -EFAULT;
314 }
315 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
316 }
317 return error;
318}
319
320#else
321
322SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
323{
324 return -ENOSYS;
325}
326
327#endif /* CONFIG_SYSCTL_SYSCALL */
328
329SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name) 268SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name)
330{ 269{
331 int ret = 0; 270 int ret = 0;
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 6ebc07976694..8a0be0bdebad 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -272,7 +272,7 @@ EXPORT(sysn32_call_table)
272 PTR sys_munlockall 272 PTR sys_munlockall
273 PTR sys_vhangup /* 6150 */ 273 PTR sys_vhangup /* 6150 */
274 PTR sys_pivot_root 274 PTR sys_pivot_root
275 PTR sys_32_sysctl 275 PTR compat_sys_sysctl
276 PTR sys_prctl 276 PTR sys_prctl
277 PTR compat_sys_adjtimex 277 PTR compat_sys_adjtimex
278 PTR compat_sys_setrlimit /* 6155 */ 278 PTR compat_sys_setrlimit /* 6155 */
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 14dde4ca932e..41dbdb7d67e5 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -356,7 +356,7 @@ sys_call_table:
356 PTR sys_ni_syscall /* 4150 */ 356 PTR sys_ni_syscall /* 4150 */
357 PTR sys_getsid 357 PTR sys_getsid
358 PTR sys_fdatasync 358 PTR sys_fdatasync
359 PTR sys_32_sysctl 359 PTR compat_sys_sysctl
360 PTR sys_mlock 360 PTR sys_mlock
361 PTR sys_munlock /* 4155 */ 361 PTR sys_munlock /* 4155 */
362 PTR sys_mlockall 362 PTR sys_mlockall
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 */
41int 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 */
59int proc_dolasatstring(ctl_table *table, int write, 42int 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 */
117int 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 */
135int 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
157int proc_lasat_ip(ctl_table *table, int write, 100int 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
217static 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
234int proc_lasat_prid(ctl_table *table, int write, 160int 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
253static ctl_table lasat_table[] = { 179static 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
361static ctl_table lasat_root_table[] = { 265static 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