[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>
This commit is contained in:
Eric W. Biederman 2007-02-14 00:33:54 -08:00 committed by Linus Torvalds
parent 59fc5313b3
commit 2564b7bd9b

View file

@ -233,12 +233,12 @@ static int do_hardware_modes (ctl_table *table, int write,
return copy_to_user(result, buffer, len) ? -EFAULT : 0; return copy_to_user(result, buffer, len) ? -EFAULT : 0;
} }
#define PARPORT_PORT_DIR(child) { 0, NULL, NULL, 0, 0555, child } #define PARPORT_PORT_DIR(CHILD) { .ctl_name = 0, .procname = NULL, .mode = 0555, .child = CHILD }
#define PARPORT_PARPORT_DIR(child) { DEV_PARPORT, "parport", \ #define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \
NULL, 0, 0555, child } .mode = 0555, .child = CHILD }
#define PARPORT_DEV_DIR(child) { CTL_DEV, "dev", NULL, 0, 0555, child } #define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD }
#define PARPORT_DEVICES_ROOT_DIR { DEV_PARPORT_DEVICES, "devices", \ #define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \
NULL, 0, 0555, NULL } .mode = 0555, .child = NULL }
static const unsigned long parport_min_timeslice_value = static const unsigned long parport_min_timeslice_value =
PARPORT_MIN_TIMESLICE_VALUE; PARPORT_MIN_TIMESLICE_VALUE;
@ -263,50 +263,118 @@ struct parport_sysctl_table {
}; };
static const struct parport_sysctl_table parport_sysctl_template = { static const struct parport_sysctl_table parport_sysctl_template = {
NULL, .sysctl_header = NULL,
{ {
{ DEV_PARPORT_SPINTIME, "spintime", {
NULL, sizeof(int), 0644, NULL, .ctl_name = DEV_PARPORT_SPINTIME,
&proc_dointvec_minmax, NULL, NULL, .procname = "spintime",
(void*) &parport_min_spintime_value, .data = NULL,
(void*) &parport_max_spintime_value }, .maxlen = sizeof(int),
{ DEV_PARPORT_BASE_ADDR, "base-addr", .mode = 0644,
NULL, 0, 0444, NULL, .proc_handler = &proc_dointvec_minmax,
&do_hardware_base_addr }, .extra1 = (void*) &parport_min_spintime_value,
{ DEV_PARPORT_IRQ, "irq", .extra2 = (void*) &parport_max_spintime_value
NULL, 0, 0444, NULL, },
&do_hardware_irq }, {
{ DEV_PARPORT_DMA, "dma", .ctl_name = DEV_PARPORT_BASE_ADDR,
NULL, 0, 0444, NULL, .procname = "base-addr",
&do_hardware_dma }, .data = NULL,
{ DEV_PARPORT_MODES, "modes", .maxlen = 0,
NULL, 0, 0444, NULL, .mode = 0444,
&do_hardware_modes }, .proc_handler = &do_hardware_base_addr
},
{
.ctl_name = DEV_PARPORT_IRQ,
.procname = "irq",
.data = NULL,
.maxlen = 0,
.mode = 0444,
.proc_handler = &do_hardware_irq
},
{
.ctl_name = DEV_PARPORT_DMA,
.procname = "dma",
.data = NULL,
.maxlen = 0,
.mode = 0444,
.proc_handler = &do_hardware_dma
},
{
.ctl_name = DEV_PARPORT_MODES,
.procname = "modes",
.data = NULL,
.maxlen = 0,
.mode = 0444,
.proc_handler = &do_hardware_modes
},
PARPORT_DEVICES_ROOT_DIR, PARPORT_DEVICES_ROOT_DIR,
#ifdef CONFIG_PARPORT_1284 #ifdef CONFIG_PARPORT_1284
{ DEV_PARPORT_AUTOPROBE, "autoprobe", {
NULL, 0, 0444, NULL, .ctl_name = DEV_PARPORT_AUTOPROBE,
&do_autoprobe }, .procname = "autoprobe",
{ DEV_PARPORT_AUTOPROBE + 1, "autoprobe0", .data = NULL,
NULL, 0, 0444, NULL, .maxlen = 0,
&do_autoprobe }, .mode = 0444,
{ DEV_PARPORT_AUTOPROBE + 2, "autoprobe1", .proc_handler = &do_autoprobe
NULL, 0, 0444, NULL, },
&do_autoprobe }, {
{ DEV_PARPORT_AUTOPROBE + 3, "autoprobe2", .ctl_name = DEV_PARPORT_AUTOPROBE + 1,
NULL, 0, 0444, NULL, .procname = "autoprobe0",
&do_autoprobe }, .data = NULL,
{ DEV_PARPORT_AUTOPROBE + 4, "autoprobe3", .maxlen = 0,
NULL, 0, 0444, NULL, .mode = 0444,
&do_autoprobe }, .proc_handler = &do_autoprobe
},
{
.ctl_name = DEV_PARPORT_AUTOPROBE + 2,
.procname = "autoprobe1",
.data = NULL,
.maxlen = 0,
.mode = 0444,
.proc_handler = &do_autoprobe
},
{
.ctl_name = DEV_PARPORT_AUTOPROBE + 3,
.procname = "autoprobe2",
.data = NULL,
.maxlen = 0,
.mode = 0444,
.proc_handler = &do_autoprobe
},
{
.ctl_name = DEV_PARPORT_AUTOPROBE + 4,
.procname = "autoprobe3",
.data = NULL,
.maxlen = 0,
.mode = 0444,
.proc_handler = &do_autoprobe
},
#endif /* IEEE 1284 support */ #endif /* IEEE 1284 support */
{0} {}
}, },
{ {DEV_PARPORT_DEVICES_ACTIVE, "active", NULL, 0, 0444, NULL, {
&do_active_device }, {0}}, {
{ PARPORT_PORT_DIR(NULL), {0}}, .ctl_name = DEV_PARPORT_DEVICES_ACTIVE,
{ PARPORT_PARPORT_DIR(NULL), {0}}, .procname = "active",
{ PARPORT_DEV_DIR(NULL), {0}} .data = NULL,
.maxlen = 0,
.mode = 0444,
.proc_handler = &do_active_device
},
{}
},
{
PARPORT_PORT_DIR(NULL),
{}
},
{
PARPORT_PARPORT_DIR(NULL),
{}
},
{
PARPORT_DEV_DIR(NULL),
{}
}
}; };
struct parport_device_sysctl_table struct parport_device_sysctl_table
@ -322,19 +390,46 @@ struct parport_device_sysctl_table
static const struct parport_device_sysctl_table static const struct parport_device_sysctl_table
parport_device_sysctl_template = { parport_device_sysctl_template = {
NULL, .sysctl_header = NULL,
{ {
{ DEV_PARPORT_DEVICE_TIMESLICE, "timeslice", {
NULL, sizeof(int), 0644, NULL, .ctl_name = DEV_PARPORT_DEVICE_TIMESLICE,
&proc_doulongvec_ms_jiffies_minmax, NULL, NULL, .procname = "timeslice",
(void*) &parport_min_timeslice_value, .data = NULL,
(void*) &parport_max_timeslice_value }, .maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_doulongvec_ms_jiffies_minmax,
.extra1 = (void*) &parport_min_timeslice_value,
.extra2 = (void*) &parport_max_timeslice_value
},
}, },
{ {0, NULL, NULL, 0, 0555, NULL}, {0}}, {
{ PARPORT_DEVICES_ROOT_DIR, {0}}, {
{ PARPORT_PORT_DIR(NULL), {0}}, .ctl_name = 0,
{ PARPORT_PARPORT_DIR(NULL), {0}}, .procname = NULL,
{ PARPORT_DEV_DIR(NULL), {0}} .data = NULL,
.maxlen = 0,
.mode = 0555,
.child = NULL
},
{}
},
{
PARPORT_DEVICES_ROOT_DIR,
{}
},
{
PARPORT_PORT_DIR(NULL),
{}
},
{
PARPORT_PARPORT_DIR(NULL),
{}
},
{
PARPORT_DEV_DIR(NULL),
{}
}
}; };
struct parport_default_sysctl_table struct parport_default_sysctl_table
@ -351,28 +446,47 @@ extern int parport_default_spintime;
static struct parport_default_sysctl_table static struct parport_default_sysctl_table
parport_default_sysctl_table = { parport_default_sysctl_table = {
NULL, .sysctl_header = NULL,
{ {
{ DEV_PARPORT_DEFAULT_TIMESLICE, "timeslice", {
&parport_default_timeslice, .ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE,
sizeof(parport_default_timeslice), 0644, NULL, .procname = "timeslice",
&proc_doulongvec_ms_jiffies_minmax, NULL, NULL, .data = &parport_default_timeslice,
(void*) &parport_min_timeslice_value, .maxlen = sizeof(parport_default_timeslice),
(void*) &parport_max_timeslice_value }, .mode = 0644,
{ DEV_PARPORT_DEFAULT_SPINTIME, "spintime", .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
&parport_default_spintime, .extra1 = (void*) &parport_min_timeslice_value,
sizeof(parport_default_spintime), 0644, NULL, .extra2 = (void*) &parport_max_timeslice_value
&proc_dointvec_minmax, NULL, NULL, },
(void*) &parport_min_spintime_value, {
(void*) &parport_max_spintime_value }, .ctl_name = DEV_PARPORT_DEFAULT_SPINTIME,
{0} .procname = "spintime",
.data = &parport_default_spintime,
.maxlen = sizeof(parport_default_spintime),
.mode = 0644,
.proc_handler = &proc_dointvec_minmax,
.extra1 = (void*) &parport_min_spintime_value,
.extra2 = (void*) &parport_max_spintime_value
},
{}
}, },
{ { DEV_PARPORT_DEFAULT, "default", NULL, 0, 0555,
parport_default_sysctl_table.vars },{0}},
{ {
PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), {
{0}}, .ctl_name = DEV_PARPORT_DEFAULT,
{ PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), {0}} .procname = "default",
.mode = 0555,
.child = parport_default_sysctl_table.vars
},
{}
},
{
PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir),
{}
},
{
PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir),
{}
}
}; };