diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2007-02-14 03:33:54 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-14 11:09:57 -0500 |
| commit | 2564b7bd9ba4b4bf941b90f1ccd5e2c00e0f83d3 (patch) | |
| tree | 7e1823889b98a7c4abbe6c0991e0f10c23abc6e1 | |
| parent | 59fc5313b37328f850105d5f1caa18f11089c9ba (diff) | |
[PATCH] sysctl: C99 convert ctl_tables in drivers/parport/procfs.c
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | drivers/parport/procfs.c | 264 |
1 files changed, 189 insertions, 75 deletions
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index 2e744a274517..9a7f1d49dec1 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c | |||
| @@ -233,12 +233,12 @@ static int do_hardware_modes (ctl_table *table, int write, | |||
| 233 | return copy_to_user(result, buffer, len) ? -EFAULT : 0; | 233 | return copy_to_user(result, buffer, len) ? -EFAULT : 0; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | #define PARPORT_PORT_DIR(child) { 0, NULL, NULL, 0, 0555, child } | 236 | #define PARPORT_PORT_DIR(CHILD) { .ctl_name = 0, .procname = NULL, .mode = 0555, .child = CHILD } |
| 237 | #define PARPORT_PARPORT_DIR(child) { DEV_PARPORT, "parport", \ | 237 | #define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ |
| 238 | NULL, 0, 0555, child } | 238 | .mode = 0555, .child = CHILD } |
| 239 | #define PARPORT_DEV_DIR(child) { CTL_DEV, "dev", NULL, 0, 0555, child } | 239 | #define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD } |
| 240 | #define PARPORT_DEVICES_ROOT_DIR { DEV_PARPORT_DEVICES, "devices", \ | 240 | #define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \ |
| 241 | NULL, 0, 0555, NULL } | 241 | .mode = 0555, .child = NULL } |
| 242 | 242 | ||
| 243 | static const unsigned long parport_min_timeslice_value = | 243 | static const unsigned long parport_min_timeslice_value = |
| 244 | PARPORT_MIN_TIMESLICE_VALUE; | 244 | PARPORT_MIN_TIMESLICE_VALUE; |
| @@ -263,50 +263,118 @@ struct parport_sysctl_table { | |||
| 263 | }; | 263 | }; |
| 264 | 264 | ||
| 265 | static const struct parport_sysctl_table parport_sysctl_template = { | 265 | static const struct parport_sysctl_table parport_sysctl_template = { |
| 266 | NULL, | 266 | .sysctl_header = NULL, |
| 267 | { | 267 | { |
| 268 | { DEV_PARPORT_SPINTIME, "spintime", | 268 | { |
| 269 | NULL, sizeof(int), 0644, NULL, | 269 | .ctl_name = DEV_PARPORT_SPINTIME, |
| 270 | &proc_dointvec_minmax, NULL, NULL, | 270 | .procname = "spintime", |
| 271 | (void*) &parport_min_spintime_value, | 271 | .data = NULL, |
| 272 | (void*) &parport_max_spintime_value }, | 272 | .maxlen = sizeof(int), |
| 273 | { DEV_PARPORT_BASE_ADDR, "base-addr", | 273 | .mode = 0644, |
| 274 | NULL, 0, 0444, NULL, | 274 | .proc_handler = &proc_dointvec_minmax, |
| 275 | &do_hardware_base_addr }, | 275 | .extra1 = (void*) &parport_min_spintime_value, |
| 276 | { DEV_PARPORT_IRQ, "irq", | 276 | .extra2 = (void*) &parport_max_spintime_value |
| 277 | NULL, 0, 0444, NULL, | 277 | }, |
| 278 | &do_hardware_irq }, | 278 | { |
| 279 | { DEV_PARPORT_DMA, "dma", | 279 | .ctl_name = DEV_PARPORT_BASE_ADDR, |
| 280 | NULL, 0, 0444, NULL, | 280 | .procname = "base-addr", |
| 281 | &do_hardware_dma }, | 281 | .data = NULL, |
| 282 | { DEV_PARPORT_MODES, "modes", | 282 | .maxlen = 0, |
| 283 | NULL, 0, 0444, NULL, | 283 | .mode = 0444, |
| 284 | &do_hardware_modes }, | 284 | .proc_handler = &do_hardware_base_addr |
| 285 | }, | ||
| 286 | { | ||
| 287 | .ctl_name = DEV_PARPORT_IRQ, | ||
| 288 | .procname = "irq", | ||
| 289 | .data = NULL, | ||
| 290 | .maxlen = 0, | ||
| 291 | .mode = 0444, | ||
| 292 | .proc_handler = &do_hardware_irq | ||
| 293 | }, | ||
| 294 | { | ||
| 295 | .ctl_name = DEV_PARPORT_DMA, | ||
| 296 | .procname = "dma", | ||
| 297 | .data = NULL, | ||
| 298 | .maxlen = 0, | ||
| 299 | .mode = 0444, | ||
| 300 | .proc_handler = &do_hardware_dma | ||
| 301 | }, | ||
| 302 | { | ||
| 303 | .ctl_name = DEV_PARPORT_MODES, | ||
| 304 | .procname = "modes", | ||
| 305 | .data = NULL, | ||
| 306 | .maxlen = 0, | ||
| 307 | .mode = 0444, | ||
| 308 | .proc_handler = &do_hardware_modes | ||
| 309 | }, | ||
| 285 | PARPORT_DEVICES_ROOT_DIR, | 310 | PARPORT_DEVICES_ROOT_DIR, |
| 286 | #ifdef CONFIG_PARPORT_1284 | 311 | #ifdef CONFIG_PARPORT_1284 |
| 287 | { DEV_PARPORT_AUTOPROBE, "autoprobe", | 312 | { |
| 288 | NULL, 0, 0444, NULL, | 313 | .ctl_name = DEV_PARPORT_AUTOPROBE, |
| 289 | &do_autoprobe }, | 314 | .procname = "autoprobe", |
| 290 | { DEV_PARPORT_AUTOPROBE + 1, "autoprobe0", | 315 | .data = NULL, |
| 291 | NULL, 0, 0444, NULL, | 316 | .maxlen = 0, |
| 292 | &do_autoprobe }, | 317 | .mode = 0444, |
| 293 | { DEV_PARPORT_AUTOPROBE + 2, "autoprobe1", | 318 | .proc_handler = &do_autoprobe |
| 294 | NULL, 0, 0444, NULL, | 319 | }, |
| 295 | &do_autoprobe }, | 320 | { |
| 296 | { DEV_PARPORT_AUTOPROBE + 3, "autoprobe2", | 321 | .ctl_name = DEV_PARPORT_AUTOPROBE + 1, |
| 297 | NULL, 0, 0444, NULL, | 322 | .procname = "autoprobe0", |
| 298 | &do_autoprobe }, | 323 | .data = NULL, |
| 299 | { DEV_PARPORT_AUTOPROBE + 4, "autoprobe3", | 324 | .maxlen = 0, |
| 300 | NULL, 0, 0444, NULL, | 325 | .mode = 0444, |
| 301 | &do_autoprobe }, | 326 | .proc_handler = &do_autoprobe |
| 327 | }, | ||
| 328 | { | ||
| 329 | .ctl_name = DEV_PARPORT_AUTOPROBE + 2, | ||
| 330 | .procname = "autoprobe1", | ||
| 331 | .data = NULL, | ||
| 332 | .maxlen = 0, | ||
| 333 | .mode = 0444, | ||
| 334 | .proc_handler = &do_autoprobe | ||
| 335 | }, | ||
| 336 | { | ||
| 337 | .ctl_name = DEV_PARPORT_AUTOPROBE + 3, | ||
| 338 | .procname = "autoprobe2", | ||
| 339 | .data = NULL, | ||
| 340 | .maxlen = 0, | ||
| 341 | .mode = 0444, | ||
| 342 | .proc_handler = &do_autoprobe | ||
| 343 | }, | ||
| 344 | { | ||
| 345 | .ctl_name = DEV_PARPORT_AUTOPROBE + 4, | ||
| 346 | .procname = "autoprobe3", | ||
| 347 | .data = NULL, | ||
| 348 | .maxlen = 0, | ||
| 349 | .mode = 0444, | ||
| 350 | .proc_handler = &do_autoprobe | ||
| 351 | }, | ||
| 302 | #endif /* IEEE 1284 support */ | 352 | #endif /* IEEE 1284 support */ |
| 303 | {0} | 353 | {} |
| 304 | }, | 354 | }, |
| 305 | { {DEV_PARPORT_DEVICES_ACTIVE, "active", NULL, 0, 0444, NULL, | 355 | { |
| 306 | &do_active_device }, {0}}, | 356 | { |
| 307 | { PARPORT_PORT_DIR(NULL), {0}}, | 357 | .ctl_name = DEV_PARPORT_DEVICES_ACTIVE, |
| 308 | { PARPORT_PARPORT_DIR(NULL), {0}}, | 358 | .procname = "active", |
| 309 | { PARPORT_DEV_DIR(NULL), {0}} | 359 | .data = NULL, |
| 360 | .maxlen = 0, | ||
| 361 | .mode = 0444, | ||
| 362 | .proc_handler = &do_active_device | ||
| 363 | }, | ||
| 364 | {} | ||
| 365 | }, | ||
| 366 | { | ||
| 367 | PARPORT_PORT_DIR(NULL), | ||
| 368 | {} | ||
| 369 | }, | ||
| 370 | { | ||
| 371 | PARPORT_PARPORT_DIR(NULL), | ||
| 372 | {} | ||
| 373 | }, | ||
| 374 | { | ||
| 375 | PARPORT_DEV_DIR(NULL), | ||
| 376 | {} | ||
| 377 | } | ||
| 310 | }; | 378 | }; |
| 311 | 379 | ||
| 312 | struct parport_device_sysctl_table | 380 | struct parport_device_sysctl_table |
| @@ -322,19 +390,46 @@ struct parport_device_sysctl_table | |||
| 322 | 390 | ||
| 323 | static const struct parport_device_sysctl_table | 391 | static const struct parport_device_sysctl_table |
| 324 | parport_device_sysctl_template = { | 392 | parport_device_sysctl_template = { |
| 325 | NULL, | 393 | .sysctl_header = NULL, |
| 394 | { | ||
| 395 | { | ||
| 396 | .ctl_name = DEV_PARPORT_DEVICE_TIMESLICE, | ||
| 397 | .procname = "timeslice", | ||
| 398 | .data = NULL, | ||
| 399 | .maxlen = sizeof(int), | ||
| 400 | .mode = 0644, | ||
| 401 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | ||
| 402 | .extra1 = (void*) &parport_min_timeslice_value, | ||
| 403 | .extra2 = (void*) &parport_max_timeslice_value | ||
| 404 | }, | ||
| 405 | }, | ||
| 406 | { | ||
| 407 | { | ||
| 408 | .ctl_name = 0, | ||
| 409 | .procname = NULL, | ||
| 410 | .data = NULL, | ||
| 411 | .maxlen = 0, | ||
| 412 | .mode = 0555, | ||
| 413 | .child = NULL | ||
| 414 | }, | ||
| 415 | {} | ||
| 416 | }, | ||
| 326 | { | 417 | { |
| 327 | { DEV_PARPORT_DEVICE_TIMESLICE, "timeslice", | 418 | PARPORT_DEVICES_ROOT_DIR, |
| 328 | NULL, sizeof(int), 0644, NULL, | 419 | {} |
| 329 | &proc_doulongvec_ms_jiffies_minmax, NULL, NULL, | 420 | }, |
| 330 | (void*) &parport_min_timeslice_value, | 421 | { |
| 331 | (void*) &parport_max_timeslice_value }, | 422 | PARPORT_PORT_DIR(NULL), |
| 423 | {} | ||
| 332 | }, | 424 | }, |
| 333 | { {0, NULL, NULL, 0, 0555, NULL}, {0}}, | 425 | { |
| 334 | { PARPORT_DEVICES_ROOT_DIR, {0}}, | 426 | PARPORT_PARPORT_DIR(NULL), |
| 335 | { PARPORT_PORT_DIR(NULL), {0}}, | 427 | {} |
| 336 | { PARPORT_PARPORT_DIR(NULL), {0}}, | 428 | }, |
| 337 | { PARPORT_DEV_DIR(NULL), {0}} | 429 | { |
| 430 | PARPORT_DEV_DIR(NULL), | ||
| 431 | {} | ||
| 432 | } | ||
| 338 | }; | 433 | }; |
| 339 | 434 | ||
| 340 | struct parport_default_sysctl_table | 435 | struct parport_default_sysctl_table |
| @@ -351,28 +446,47 @@ extern int parport_default_spintime; | |||
| 351 | 446 | ||
| 352 | static struct parport_default_sysctl_table | 447 | static struct parport_default_sysctl_table |
| 353 | parport_default_sysctl_table = { | 448 | parport_default_sysctl_table = { |
| 354 | NULL, | 449 | .sysctl_header = NULL, |
| 450 | { | ||
| 451 | { | ||
| 452 | .ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE, | ||
| 453 | .procname = "timeslice", | ||
| 454 | .data = &parport_default_timeslice, | ||
| 455 | .maxlen = sizeof(parport_default_timeslice), | ||
| 456 | .mode = 0644, | ||
| 457 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | ||
| 458 | .extra1 = (void*) &parport_min_timeslice_value, | ||
| 459 | .extra2 = (void*) &parport_max_timeslice_value | ||
| 460 | }, | ||
| 461 | { | ||
| 462 | .ctl_name = DEV_PARPORT_DEFAULT_SPINTIME, | ||
| 463 | .procname = "spintime", | ||
| 464 | .data = &parport_default_spintime, | ||
| 465 | .maxlen = sizeof(parport_default_spintime), | ||
| 466 | .mode = 0644, | ||
| 467 | .proc_handler = &proc_dointvec_minmax, | ||
| 468 | .extra1 = (void*) &parport_min_spintime_value, | ||
| 469 | .extra2 = (void*) &parport_max_spintime_value | ||
| 470 | }, | ||
| 471 | {} | ||
| 472 | }, | ||
| 355 | { | 473 | { |
| 356 | { DEV_PARPORT_DEFAULT_TIMESLICE, "timeslice", | 474 | { |
| 357 | &parport_default_timeslice, | 475 | .ctl_name = DEV_PARPORT_DEFAULT, |
| 358 | sizeof(parport_default_timeslice), 0644, NULL, | 476 | .procname = "default", |
| 359 | &proc_doulongvec_ms_jiffies_minmax, NULL, NULL, | 477 | .mode = 0555, |
| 360 | (void*) &parport_min_timeslice_value, | 478 | .child = parport_default_sysctl_table.vars |
| 361 | (void*) &parport_max_timeslice_value }, | 479 | }, |
| 362 | { DEV_PARPORT_DEFAULT_SPINTIME, "spintime", | 480 | {} |
| 363 | &parport_default_spintime, | ||
| 364 | sizeof(parport_default_spintime), 0644, NULL, | ||
| 365 | &proc_dointvec_minmax, NULL, NULL, | ||
| 366 | (void*) &parport_min_spintime_value, | ||
| 367 | (void*) &parport_max_spintime_value }, | ||
| 368 | {0} | ||
| 369 | }, | 481 | }, |
| 370 | { { DEV_PARPORT_DEFAULT, "default", NULL, 0, 0555, | ||
| 371 | parport_default_sysctl_table.vars },{0}}, | ||
| 372 | { | 482 | { |
| 373 | PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), | 483 | PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), |
| 374 | {0}}, | 484 | {} |
| 375 | { PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), {0}} | 485 | }, |
| 486 | { | ||
| 487 | PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), | ||
| 488 | {} | ||
| 489 | } | ||
| 376 | }; | 490 | }; |
| 377 | 491 | ||
| 378 | 492 | ||
