Name: Parameter Changes: Core Author: Rusty Russell Depends: Module/param.patch.gz D: This replaces all the occurrances of __setup and MODULE_PARM in the D: core files with the new PARAM calls. diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/fs/devfs/base.c working-2.4.14-param-all/fs/devfs/base.c --- working-2.4.14-param/fs/devfs/base.c Tue Nov 6 11:41:39 2001 +++ working-2.4.14-param-all/fs/devfs/base.c Thu Nov 22 08:21:31 2001 @@ -2043,7 +2043,7 @@ * @str: The boot options after the "devfs=". */ -static int __init devfs_setup (char *str) +static int __init devfs_setup (char *str, struct kernel_param *kp) { static struct { @@ -2093,14 +2093,14 @@ break; } } - if (!found) return 0; /* No match */ - if (*str != ',') return 0; /* No more options */ + if (!found) return -EINVAL; /* No match */ + if (*str != ',') return -EINVAL; /* No more options */ ++str; } - return 1; + return 0; } /* End Function devfs_setup */ -__setup("devfs=", devfs_setup); +PARAM_CALL(devfs, devfs_setup, NULL); EXPORT_SYMBOL(devfs_register); EXPORT_SYMBOL(devfs_unregister); diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/fs/lockd/svc.c working-2.4.14-param-all/fs/lockd/svc.c --- working-2.4.14-param/fs/lockd/svc.c Mon Oct 22 03:32:33 2001 +++ working-2.4.14-param-all/fs/lockd/svc.c Thu Nov 22 08:21:31 2001 @@ -34,6 +34,7 @@ #include #include #include +#include #define NLMDBG_FACILITY NLMDBG_SVC #define LOCKD_BUFSIZE (1024 + NLMSSVC_XDRSIZE) @@ -318,18 +319,17 @@ up(&nlmsvc_sema); } -#ifdef MODULE /* New module support in 2.1.18 */ MODULE_AUTHOR("Olaf Kirch "); MODULE_DESCRIPTION("NFS file locking service version " LOCKD_VERSION "."); MODULE_LICENSE("GPL"); -MODULE_PARM(nlm_grace_period, "10-240l"); -MODULE_PARM(nlm_timeout, "3-20l"); -MODULE_PARM(nlm_udpport, "0-65535l"); -MODULE_PARM(nlm_tcpport, "0-65535l"); - -int +PARAM(nlm_grace_period, long, S_IRUGO); +PARAM(nlm_timeout, long, S_IRUGO); +PARAM(nlm_udpport, long, S_IRUGO); +PARAM(nlm_tcpport, long, S_IRUGO); + +static int init_module(void) { /* Init the static variables */ @@ -339,31 +339,14 @@ return 0; } -void +static void cleanup_module(void) { /* FIXME: delete all NLM clients */ nlm_shutdown_hosts(); } -#else -/* not a module, so process bootargs - * lockd.udpport and lockd.tcpport - */ - -static int __init udpport_set(char *str) -{ - nlm_udpport = simple_strtoul(str, NULL, 0); - return 1; -} -static int __init tcpport_set(char *str) -{ - nlm_tcpport = simple_strtoul(str, NULL, 0); - return 1; -} -__setup("lockd.udpport=", udpport_set); -__setup("lockd.tcpport=", tcpport_set); - -#endif +module_init(init_module); +module_exit(cleanup_module); /* * Define NLM program and procedures diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/fs/nfs/nfsroot.c working-2.4.14-param-all/fs/nfs/nfsroot.c --- working-2.4.14-param/fs/nfs/nfsroot.c Fri Jul 20 14:47:16 2001 +++ working-2.4.14-param-all/fs/nfs/nfsroot.c Thu Nov 22 08:21:31 2001 @@ -332,7 +332,7 @@ * Parse NFS server and directory information passed on the kernel * command line. */ -int __init nfs_root_setup(char *line) +int __init nfs_root_setup(char *line, struct kernel_param *kp) { ROOT_DEV = MKDEV(UNNAMED_MAJOR, 255); if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) { @@ -345,10 +345,10 @@ sprintf(nfs_root_name, NFS_ROOT, line); } root_nfs_parse_addr(nfs_root_name); - return 1; + return 0; } -__setup("nfsroot=", nfs_root_setup); +PARAM_CALL(nfsroot, nfs_root_setup, NULL); /*************************************************************************** diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/fs/ntfs/fs.c working-2.4.14-param-all/fs/ntfs/fs.c --- working-2.4.14-param/fs/ntfs/fs.c Wed Oct 24 01:17:31 2001 +++ working-2.4.14-param-all/fs/ntfs/fs.c Thu Nov 22 08:21:31 2001 @@ -1161,7 +1161,7 @@ MODULE_DESCRIPTION("Linux NTFS driver"); MODULE_LICENSE("GPL"); #ifdef DEBUG -MODULE_PARM(ntdebug, "i"); +PARAM(ntdebug, int, S_IWUSR|S_IRUGO); MODULE_PARM_DESC(ntdebug, "Debug level"); #endif diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/fs/super.c working-2.4.14-param-all/fs/super.c --- working-2.4.14-param/fs/super.c Tue Nov 6 11:41:39 2001 +++ working-2.4.14-param-all/fs/super.c Thu Nov 22 08:21:31 2001 @@ -867,21 +867,9 @@ } static char * __initdata root_mount_data; -static int __init root_data_setup(char *str) -{ - root_mount_data = str; - return 1; -} - static char * __initdata root_fs_names; -static int __init fs_names_setup(char *str) -{ - root_fs_names = str; - return 1; -} - -__setup("rootflags=", root_data_setup); -__setup("rootfstype=", fs_names_setup); +PARAM_NAMED(rootflags, root_mount_data, charp, 000); +PARAM_NAMED(rootfstype, root_fs_names, charp, 000); static void __init get_fs_names(char *page) { diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/include/asm-i386/bugs.h working-2.4.14-param-all/include/asm-i386/bugs.h --- working-2.4.14-param/include/asm-i386/bugs.h Wed Oct 24 14:59:03 2001 +++ working-2.4.14-param-all/include/asm-i386/bugs.h Thu Nov 22 08:21:31 2001 @@ -25,30 +25,24 @@ #include #include -static int __init no_halt(char *s) +static int __init no_halt(char *s, struct kernel_param *kp) { boot_cpu_data.hlt_works_ok = 0; return 1; } -__setup("no-hlt", no_halt); - -static int __init mca_pentium(char *s) -{ - mca_pentium_flag = 1; - return 1; -} +PARAM_CALL(no_hlt, no_halt, NULL); -__setup("mca-pentium", mca_pentium); +PARAM(mca_pentium_flag, uint, S_IRUGO); -static int __init no_387(char *s) +static int __init no_387(char *s, struct kernel_param *kp) { boot_cpu_data.hard_math = 0; write_cr0(0xE | read_cr0()); - return 1; + return 0; } -__setup("no387", no_387); +PARAM_CALL(no387, no_387, NULL); static double __initdata x = 4195835.0; static double __initdata y = 3145727.0; diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/include/linux/i2c-proc.h working-2.4.14-param-all/include/linux/i2c-proc.h --- working-2.4.14-param/include/linux/i2c-proc.h Fri Oct 12 01:05:47 2001 +++ working-2.4.14-param-all/include/linux/i2c-proc.h Thu Nov 22 08:31:03 2001 @@ -176,17 +176,11 @@ SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END, \ SENSORS_I2C_END, SENSORS_I2C_END, SENSORS_I2C_END} -/* This is ugly. We need to evaluate SENSORS_MAX_OPTS before it is - stringified */ -#define SENSORS_MODPARM_AUX1(x) "1-" #x "h" -#define SENSORS_MODPARM_AUX(x) SENSORS_MODPARM_AUX1(x) -#define SENSORS_MODPARM SENSORS_MODPARM_AUX(SENSORS_MAX_OPTS) - /* SENSORS_MODULE_PARM creates a module parameter, and puts it in the module header */ #define SENSORS_MODULE_PARM(var,desc) \ static unsigned short var[SENSORS_MAX_OPTS] = SENSORS_DEFAULTS; \ - MODULE_PARM(var,SENSORS_MODPARM); \ + PARAM_ARRAY(var, var, ushort, 1, SENSORS_MAX_OPTS, 000); \ MODULE_PARM_DESC(var,desc) /* SENSORS_MODULE_PARM creates a 'force_*' module parameter, and puts it in diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/include/linux/i2c.h working-2.4.14-param-all/include/linux/i2c.h --- working-2.4.14-param/include/linux/i2c.h Wed Nov 21 14:51:56 2001 +++ working-2.4.14-param-all/include/linux/i2c.h Thu Nov 22 08:30:33 2001 @@ -518,18 +518,12 @@ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} -/* This is ugly. We need to evaluate I2C_CLIENT_MAX_OPTS before it is - stringified */ -#define I2C_CLIENT_MODPARM_AUX1(x) "1-" #x "h" -#define I2C_CLIENT_MODPARM_AUX(x) I2C_CLIENT_MODPARM_AUX1(x) -#define I2C_CLIENT_MODPARM I2C_CLIENT_MODPARM_AUX(I2C_CLIENT_MAX_OPTS) - /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the module header */ #define I2C_CLIENT_MODULE_PARM(var,desc) \ static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ - MODULE_PARM(var,I2C_CLIENT_MODPARM); \ + PARAM_ARRAY(var, var, ushort, 1, I2C_CLIENT_MAX_OPTS, 000); \ MODULE_PARM_DESC(var,desc) /* This is the one you want to use in your own modules */ diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/kernel/panic.c working-2.4.14-param-all/kernel/panic.c --- working-2.4.14-param/kernel/panic.c Mon Oct 1 05:26:08 2001 +++ working-2.4.14-param-all/kernel/panic.c Thu Nov 22 08:21:31 2001 @@ -23,14 +23,6 @@ struct notifier_block *panic_notifier_list; -static int __init panic_setup(char *str) -{ - panic_timeout = simple_strtoul(str, NULL, 0); - return 1; -} - -__setup("panic=", panic_setup); - /** * panic - halt the system * @fmt: The text string to print @@ -99,6 +91,8 @@ CHECK_EMERGENCY_SYNC } } + +PARAM_NAMED(panic, panic_timeout, int, 000); /** * print_tainted - return a string to represent the kernel taint state. diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/kernel/printk.c working-2.4.14-param-all/kernel/printk.c --- working-2.4.14-param/kernel/printk.c Tue Nov 6 11:41:43 2001 +++ working-2.4.14-param-all/kernel/printk.c Thu Nov 22 08:21:31 2001 @@ -89,9 +89,9 @@ static int console_may_schedule; /* - * Setup a list of consoles. Called from init/main.c + * Setup a list of consoles. */ -static int __init console_setup(char *str) +static int __init console_setup(char *str, struct kernel_param *kp) { struct console_cmdline *c; char name[sizeof(c->name)]; @@ -129,19 +129,19 @@ if (strcmp(console_cmdline[i].name, name) == 0 && console_cmdline[i].index == idx) { preferred_console = i; - return 1; + return 0; } if (i == MAX_CMDLINECONSOLES) - return 1; + return 0; preferred_console = i; c = &console_cmdline[i]; memcpy(c->name, name, sizeof(c->name)); c->options = options; c->index = idx; - return 1; + return 0; } -__setup("console=", console_setup); +PARAM_CALL(console, console_setup, NULL); /* * Commands to do_syslog: diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/kernel/resource.c working-2.4.14-param-all/kernel/resource.c --- working-2.4.14-param/kernel/resource.c Tue May 22 11:10:36 2001 +++ working-2.4.14-param-all/kernel/resource.c Thu Nov 22 08:21:31 2001 @@ -295,7 +295,7 @@ * Called from init/main.c to reserve IO ports. */ #define MAXRESERVE 4 -static int __init reserve_setup(char *str) +static int __init reserve_setup(char *str, struct kernel_param *kp) { static int reserved = 0; static struct resource reserve[MAXRESERVE]; @@ -319,7 +319,7 @@ reserved = x+1; } } - return 1; + return 0; } -__setup("reserve=", reserve_setup); +PARAM_CALL(reserve, reserve_setup, NULL); diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/kernel/timer.c working-2.4.14-param-all/kernel/timer.c --- working-2.4.14-param/kernel/timer.c Tue Oct 9 03:41:41 2001 +++ working-2.4.14-param-all/kernel/timer.c Thu Nov 22 08:21:31 2001 @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -70,6 +71,8 @@ unsigned int * prof_buffer; unsigned long prof_len; unsigned long prof_shift; + +PARAM_NAMED(profile, prof_shift, ulong, 000); /* * Event timer code diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-param/mm/page_alloc.c working-2.4.14-param-all/mm/page_alloc.c --- working-2.4.14-param/mm/page_alloc.c Tue Nov 6 11:41:43 2001 +++ working-2.4.14-param-all/mm/page_alloc.c Thu Nov 22 08:21:31 2001 @@ -782,15 +782,4 @@ free_area_init_core(0, &contig_page_data, &mem_map, zones_size, 0, 0, 0); } -static int __init setup_mem_frac(char *str) -{ - int j = 0; - - while (get_option(&str, &zone_balance_ratio[j++]) == 2); - printk("setup_mem_frac: "); - for (j = 0; j < MAX_NR_ZONES; j++) printk("%d ", zone_balance_ratio[j]); - printk("\n"); - return 1; -} - -__setup("memfrac=", setup_mem_frac); +PARAM_ARRAY(memfrac, zone_balance_ratio, int, 1, MAX_NR_ZONES, S_IRUGO);