procfs.c (46557bef3f3834ac33031c7be27d39d90d507442) | procfs.c (6d4561110a3e9fa742aeec6717248a491dfb1878) |
---|---|
1/* Sysctl interface for parport devices. 2 * 3 * Authors: David Campbell 4 * Tim Waugh <tim@cyberelk.demon.co.uk> 5 * Philip Blundell <philb@gnu.org> 6 * Andrea Arcangeli 7 * Riccardo Facchetti <fizban@tin.it> 8 * --- 219 unchanged lines hidden (view full) --- 228 else 229 *lenp = len; 230 231 *ppos += len; 232 233 return copy_to_user(result, buffer, len) ? -EFAULT : 0; 234} 235 | 1/* Sysctl interface for parport devices. 2 * 3 * Authors: David Campbell 4 * Tim Waugh <tim@cyberelk.demon.co.uk> 5 * Philip Blundell <philb@gnu.org> 6 * Andrea Arcangeli 7 * Riccardo Facchetti <fizban@tin.it> 8 * --- 219 unchanged lines hidden (view full) --- 228 else 229 *lenp = len; 230 231 *ppos += len; 232 233 return copy_to_user(result, buffer, len) ? -EFAULT : 0; 234} 235 |
236#define PARPORT_PORT_DIR(CHILD) { .ctl_name = 0, .procname = NULL, .mode = 0555, .child = CHILD } 237#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ | 236#define PARPORT_PORT_DIR(CHILD) { .procname = NULL, .mode = 0555, .child = CHILD } 237#define PARPORT_PARPORT_DIR(CHILD) { .procname = "parport", \ |
238 .mode = 0555, .child = CHILD } | 238 .mode = 0555, .child = CHILD } |
239#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD } | 239#define PARPORT_DEV_DIR(CHILD) { .procname = "dev", .mode = 0555, .child = CHILD } |
240#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \ 241 .mode = 0555, .child = NULL } 242 243static const unsigned long parport_min_timeslice_value = 244PARPORT_MIN_TIMESLICE_VALUE; 245 246static const unsigned long parport_max_timeslice_value = 247PARPORT_MAX_TIMESLICE_VALUE; --- 17 unchanged lines hidden (view full) --- 265static const struct parport_sysctl_table parport_sysctl_template = { 266 .sysctl_header = NULL, 267 { 268 { 269 .procname = "spintime", 270 .data = NULL, 271 .maxlen = sizeof(int), 272 .mode = 0644, | 240#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \ 241 .mode = 0555, .child = NULL } 242 243static const unsigned long parport_min_timeslice_value = 244PARPORT_MIN_TIMESLICE_VALUE; 245 246static const unsigned long parport_max_timeslice_value = 247PARPORT_MAX_TIMESLICE_VALUE; --- 17 unchanged lines hidden (view full) --- 265static const struct parport_sysctl_table parport_sysctl_template = { 266 .sysctl_header = NULL, 267 { 268 { 269 .procname = "spintime", 270 .data = NULL, 271 .maxlen = sizeof(int), 272 .mode = 0644, |
273 .proc_handler = &proc_dointvec_minmax, | 273 .proc_handler = proc_dointvec_minmax, |
274 .extra1 = (void*) &parport_min_spintime_value, 275 .extra2 = (void*) &parport_max_spintime_value 276 }, 277 { 278 .procname = "base-addr", 279 .data = NULL, 280 .maxlen = 0, 281 .mode = 0444, | 274 .extra1 = (void*) &parport_min_spintime_value, 275 .extra2 = (void*) &parport_max_spintime_value 276 }, 277 { 278 .procname = "base-addr", 279 .data = NULL, 280 .maxlen = 0, 281 .mode = 0444, |
282 .proc_handler = &do_hardware_base_addr | 282 .proc_handler = do_hardware_base_addr |
283 }, 284 { 285 .procname = "irq", 286 .data = NULL, 287 .maxlen = 0, 288 .mode = 0444, | 283 }, 284 { 285 .procname = "irq", 286 .data = NULL, 287 .maxlen = 0, 288 .mode = 0444, |
289 .proc_handler = &do_hardware_irq | 289 .proc_handler = do_hardware_irq |
290 }, 291 { 292 .procname = "dma", 293 .data = NULL, 294 .maxlen = 0, 295 .mode = 0444, | 290 }, 291 { 292 .procname = "dma", 293 .data = NULL, 294 .maxlen = 0, 295 .mode = 0444, |
296 .proc_handler = &do_hardware_dma | 296 .proc_handler = do_hardware_dma |
297 }, 298 { 299 .procname = "modes", 300 .data = NULL, 301 .maxlen = 0, 302 .mode = 0444, | 297 }, 298 { 299 .procname = "modes", 300 .data = NULL, 301 .maxlen = 0, 302 .mode = 0444, |
303 .proc_handler = &do_hardware_modes | 303 .proc_handler = do_hardware_modes |
304 }, 305 PARPORT_DEVICES_ROOT_DIR, 306#ifdef CONFIG_PARPORT_1284 307 { 308 .procname = "autoprobe", 309 .data = NULL, 310 .maxlen = 0, 311 .mode = 0444, | 304 }, 305 PARPORT_DEVICES_ROOT_DIR, 306#ifdef CONFIG_PARPORT_1284 307 { 308 .procname = "autoprobe", 309 .data = NULL, 310 .maxlen = 0, 311 .mode = 0444, |
312 .proc_handler = &do_autoprobe | 312 .proc_handler = do_autoprobe |
313 }, 314 { 315 .procname = "autoprobe0", 316 .data = NULL, 317 .maxlen = 0, 318 .mode = 0444, | 313 }, 314 { 315 .procname = "autoprobe0", 316 .data = NULL, 317 .maxlen = 0, 318 .mode = 0444, |
319 .proc_handler = &do_autoprobe | 319 .proc_handler = do_autoprobe |
320 }, 321 { 322 .procname = "autoprobe1", 323 .data = NULL, 324 .maxlen = 0, 325 .mode = 0444, | 320 }, 321 { 322 .procname = "autoprobe1", 323 .data = NULL, 324 .maxlen = 0, 325 .mode = 0444, |
326 .proc_handler = &do_autoprobe | 326 .proc_handler = do_autoprobe |
327 }, 328 { 329 .procname = "autoprobe2", 330 .data = NULL, 331 .maxlen = 0, 332 .mode = 0444, | 327 }, 328 { 329 .procname = "autoprobe2", 330 .data = NULL, 331 .maxlen = 0, 332 .mode = 0444, |
333 .proc_handler = &do_autoprobe | 333 .proc_handler = do_autoprobe |
334 }, 335 { 336 .procname = "autoprobe3", 337 .data = NULL, 338 .maxlen = 0, 339 .mode = 0444, | 334 }, 335 { 336 .procname = "autoprobe3", 337 .data = NULL, 338 .maxlen = 0, 339 .mode = 0444, |
340 .proc_handler = &do_autoprobe | 340 .proc_handler = do_autoprobe |
341 }, 342#endif /* IEEE 1284 support */ 343 {} 344 }, 345 { 346 { 347 .procname = "active", 348 .data = NULL, 349 .maxlen = 0, 350 .mode = 0444, | 341 }, 342#endif /* IEEE 1284 support */ 343 {} 344 }, 345 { 346 { 347 .procname = "active", 348 .data = NULL, 349 .maxlen = 0, 350 .mode = 0444, |
351 .proc_handler = &do_active_device | 351 .proc_handler = do_active_device |
352 }, 353 {} 354 }, 355 { 356 PARPORT_PORT_DIR(NULL), 357 {} 358 }, 359 { --- 21 unchanged lines hidden (view full) --- 381parport_device_sysctl_template = { 382 .sysctl_header = NULL, 383 { 384 { 385 .procname = "timeslice", 386 .data = NULL, 387 .maxlen = sizeof(unsigned long), 388 .mode = 0644, | 352 }, 353 {} 354 }, 355 { 356 PARPORT_PORT_DIR(NULL), 357 {} 358 }, 359 { --- 21 unchanged lines hidden (view full) --- 381parport_device_sysctl_template = { 382 .sysctl_header = NULL, 383 { 384 { 385 .procname = "timeslice", 386 .data = NULL, 387 .maxlen = sizeof(unsigned long), 388 .mode = 0644, |
389 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 389 .proc_handler = proc_doulongvec_ms_jiffies_minmax, |
390 .extra1 = (void*) &parport_min_timeslice_value, 391 .extra2 = (void*) &parport_max_timeslice_value 392 }, 393 }, 394 { 395 { | 390 .extra1 = (void*) &parport_min_timeslice_value, 391 .extra2 = (void*) &parport_max_timeslice_value 392 }, 393 }, 394 { 395 { |
396 .ctl_name = 0, | |
397 .procname = NULL, 398 .data = NULL, 399 .maxlen = 0, 400 .mode = 0555, 401 .child = NULL 402 }, 403 {} 404 }, --- 28 unchanged lines hidden (view full) --- 433parport_default_sysctl_table = { 434 .sysctl_header = NULL, 435 { 436 { 437 .procname = "timeslice", 438 .data = &parport_default_timeslice, 439 .maxlen = sizeof(parport_default_timeslice), 440 .mode = 0644, | 396 .procname = NULL, 397 .data = NULL, 398 .maxlen = 0, 399 .mode = 0555, 400 .child = NULL 401 }, 402 {} 403 }, --- 28 unchanged lines hidden (view full) --- 432parport_default_sysctl_table = { 433 .sysctl_header = NULL, 434 { 435 { 436 .procname = "timeslice", 437 .data = &parport_default_timeslice, 438 .maxlen = sizeof(parport_default_timeslice), 439 .mode = 0644, |
441 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | 440 .proc_handler = proc_doulongvec_ms_jiffies_minmax, |
442 .extra1 = (void*) &parport_min_timeslice_value, 443 .extra2 = (void*) &parport_max_timeslice_value 444 }, 445 { 446 .procname = "spintime", 447 .data = &parport_default_spintime, 448 .maxlen = sizeof(parport_default_spintime), 449 .mode = 0644, | 441 .extra1 = (void*) &parport_min_timeslice_value, 442 .extra2 = (void*) &parport_max_timeslice_value 443 }, 444 { 445 .procname = "spintime", 446 .data = &parport_default_spintime, 447 .maxlen = sizeof(parport_default_spintime), 448 .mode = 0644, |
450 .proc_handler = &proc_dointvec_minmax, | 449 .proc_handler = proc_dointvec_minmax, |
451 .extra1 = (void*) &parport_min_spintime_value, 452 .extra2 = (void*) &parport_max_spintime_value 453 }, 454 {} 455 }, 456 { 457 { | 450 .extra1 = (void*) &parport_min_spintime_value, 451 .extra2 = (void*) &parport_max_spintime_value 452 }, 453 {} 454 }, 455 { 456 { |
458 .ctl_name = DEV_PARPORT_DEFAULT, | |
459 .procname = "default", 460 .mode = 0555, 461 .child = parport_default_sysctl_table.vars 462 }, 463 {} 464 }, 465 { 466 PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), --- 23 unchanged lines hidden (view full) --- 490 491 t->vars[0].data = &port->spintime; 492 t->vars[5].child = t->device_dir; 493 494 for (i = 0; i < 5; i++) 495 t->vars[6 + i].extra2 = &port->probe_info[i]; 496 497 t->port_dir[0].procname = port->name; | 457 .procname = "default", 458 .mode = 0555, 459 .child = parport_default_sysctl_table.vars 460 }, 461 {} 462 }, 463 { 464 PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), --- 23 unchanged lines hidden (view full) --- 488 489 t->vars[0].data = &port->spintime; 490 t->vars[5].child = t->device_dir; 491 492 for (i = 0; i < 5; i++) 493 t->vars[6 + i].extra2 = &port->probe_info[i]; 494 495 t->port_dir[0].procname = port->name; |
498 t->port_dir[0].ctl_name = 0; | |
499 500 t->port_dir[0].child = t->vars; 501 t->parport_dir[0].child = t->port_dir; 502 t->dev_dir[0].child = t->parport_dir; 503 504 t->sysctl_header = register_sysctl_table(t->dev_dir); 505 if (t->sysctl_header == NULL) { 506 kfree(t); --- 22 unchanged lines hidden (view full) --- 529 t = kmalloc(sizeof(*t), GFP_KERNEL); 530 if (t == NULL) 531 return -ENOMEM; 532 memcpy(t, &parport_device_sysctl_template, sizeof(*t)); 533 534 t->dev_dir[0].child = t->parport_dir; 535 t->parport_dir[0].child = t->port_dir; 536 t->port_dir[0].procname = port->name; | 496 497 t->port_dir[0].child = t->vars; 498 t->parport_dir[0].child = t->port_dir; 499 t->dev_dir[0].child = t->parport_dir; 500 501 t->sysctl_header = register_sysctl_table(t->dev_dir); 502 if (t->sysctl_header == NULL) { 503 kfree(t); --- 22 unchanged lines hidden (view full) --- 526 t = kmalloc(sizeof(*t), GFP_KERNEL); 527 if (t == NULL) 528 return -ENOMEM; 529 memcpy(t, &parport_device_sysctl_template, sizeof(*t)); 530 531 t->dev_dir[0].child = t->parport_dir; 532 t->parport_dir[0].child = t->port_dir; 533 t->port_dir[0].procname = port->name; |
537 t->port_dir[0].ctl_name = 0; | |
538 t->port_dir[0].child = t->devices_root_dir; 539 t->devices_root_dir[0].child = t->device_dir; 540 | 534 t->port_dir[0].child = t->devices_root_dir; 535 t->devices_root_dir[0].child = t->device_dir; 536 |
541 t->device_dir[0].ctl_name = 0; | |
542 t->device_dir[0].procname = device->name; 543 t->device_dir[0].child = t->vars; 544 t->vars[0].data = &device->timeslice; 545 546 t->sysctl_header = register_sysctl_table(t->dev_dir); 547 if (t->sysctl_header == NULL) { 548 kfree(t); 549 t = NULL; --- 66 unchanged lines hidden --- | 537 t->device_dir[0].procname = device->name; 538 t->device_dir[0].child = t->vars; 539 t->vars[0].data = &device->timeslice; 540 541 t->sysctl_header = register_sysctl_table(t->dev_dir); 542 if (t->sysctl_header == NULL) { 543 kfree(t); 544 t = NULL; --- 66 unchanged lines hidden --- |