convert scsi core to use module_param interfaces
PATCH 1/1 convert scsi core to use module_param interfaces
This patch converts scsi core to use the module_param interfaces (except for the hosts.c scsihosts usage).
With this applied, boot time (non-module) command line setting of scsi parameters must be prefixed by what the scsi module name would be (scsi_mod), for example:
scsi_mod.scsi_logging_level=0x180 scsi_mod.scsi_default_dev_flags=0x1 scsi_mod.max_scsi_luns=5
Usage of scsi_mod as above is a bit ugly and long - if this patch is applied, we should consider renaming scsi.c to scsi_main.c or similiar, and scsi_mod.o to scsi.o. Or, somehow get our prefix set to "scsi".
drivers/scsi/scsi.c +4 -20
@@ -38,6 +38,7 @@#include <linux/config.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/timer.h>
@@ -108,26 +109,6 @@ const char *const scsi_device_types[MAX_ "Enclosure ", }; -MODULE_PARM (scsi_logging_level,"i" ); -MODULE_PARM_DESC (scsi_logging_level,"SCSI logging level; should be zero or nonzero" ); - -#ifndef MODULE -static int __init scsi_logging_setup (char *str) -{ -int tmp; - -if (get_option (&str, &tmp) ==1 ) { - scsi_logging_level = (tmp ? ~0 :0 ); -return 1 ; - }else { -printk (KERN_INFO "scsi_logging_setup : usage scsi_logging_level=n " -"(n should be 0 or non-zero)\n" ); -return 0 ; - } -} -__setup ("scsi_logging=" , scsi_logging_setup); -#endif -/* * Function: scsi_allocate_request *
@@ -983,6 +964,9 @@ void scsi_set_device_offline(struct scsiMODULE_DESCRIPTION ("SCSI core" );MODULE_LICENSE ("GPL" ); +module_param (scsi_logging_level, int,S_IRUGO |S_IWUSR ); +MODULE_PARM_DESC (scsi_logging_level,"a bit mask of logging levels" ); +static int __init init_scsi (void ) {int error, i;
drivers/scsi/scsi_devinfo.c +7 -29
@@ -3,6 +3,7 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/proc_fs.h> #include <linux/seq_file.h>
@@ -23,9 +24,9 @@ struct scsi_dev_info_list {static const char spaces[] =" " ;/* 16 of them */ -static char *scsi_dev_flags;static unsigned scsi_default_dev_flags;static LIST_HEAD (scsi_dev_info_list); +static __init char scsi_dev_flags[256 ];/* * scsi_static_device_list: deprecated list of devices that require
@@ -450,36 +451,16 @@ out:return err; } -MODULE_PARM (scsi_dev_flags,"s" ); +module_param_string (scsi_dev_flags, scsi_dev_flags,sizeof (scsi_dev_flags),0 );MODULE_PARM_DESC (scsi_dev_flags, -"Given scsi_dev_flags=vendor:model:flags, add a black/white list" -" entry for vendor and model with an integer value of flags" +"Given scsi_dev_flags=vendor:model:flags[,v:m:f] add black/white" +" list entries for vendor and model with an integer value of flags" " to the scsi device info list" ); -MODULE_PARM (scsi_default_dev_flags,"i" ); + +module_param (scsi_default_dev_flags, int,S_IRUGO |S_IWUSR );MODULE_PARM_DESC (scsi_default_dev_flags,"scsi default device flag integer value" ); -static int __init setup_scsi_dev_flags (char *str) -{ - scsi_dev_flags = str; -return 1 ; -} - -static int __init setup_scsi_default_dev_flags (char *str) -{ -unsigned int tmp; -if (get_option (&str, &tmp) ==1 ) { - scsi_default_dev_flags = tmp; -printk (KERN_WARNING "%s %d\n" , __FUNCTION__, - scsi_default_dev_flags); -return 1 ; - }else { -printk (KERN_WARNING "%s: usage scsi_default_dev_flags=intr\n" , - __FUNCTION__); -return 0 ; - } -} -/** * scsi_dev_info_list_delete: called from scsi.c:exit_scsi to remove * the scsi_dev_info_list.
@@ -540,6 +521,3 @@ int scsi_init_devinfo(void)scsi_exit_devinfo ();return error; } - -__setup ("scsi_dev_flags=" , setup_scsi_dev_flags); -__setup ("scsi_default_dev_flags=" , setup_scsi_default_dev_flags);
drivers/scsi/scsi_scan.c +3 -41
67 lines not on this page · raw message
Quoted 7 lines · Patrick Mansfield
This patch converts scsi core to use the
module_paraminterfaces (except for thehosts.cscsihosts usage).With this applied, boot time (non-module) command line setting of scsi parameters must be prefixed by what the scsi module name would be (
scsi_mod), for example:
Quoted 6 lines
scsi_mod.scsi_logging_level=0x180 scsi_mod.scsi_default_dev_flags=0x1 scsi_mod.max_scsi_luns=5Usage of
scsi_modas above is a bit ugly and long - if this patch is applied, we should consider renamingscsi.ctoscsi_main.cor similiar, and scsi_mod.o to scsi.o. Or, somehow get our prefix set to "scsi".
I don't think we can just change the name of the scsi core module - to much userspace stuff is relying on that. Changing the prefix would be nice but I have no idea how we can do that.
We should also kill the scsi substrings in the individual options now that we have a regular prefix, I'll submit a patch.
Quoted 3 lines · Christoph Hellwig
I don't think we can just change the name of the scsi core module - to much userspace stuff is relying on that. Changing the prefix would be nice but I have no idea how we can do that.
Is it that bad?
Do all distros that build with scsi build it into the kernel by default?
The only option (ignoring logging) we have in 2.4 is max_scsi_luns, changing its name from max_scsi_luns to max_luns means users already have to modify their modules.conf. For boot command line, users have to change to scsi[_mod].whatever no matter what.
If not changing the module name:
Rusty had suggested undef/define KBUILD_MODNAME, that might not be very nice for use across files, and/or we could get a patch into moduleparam.h that gives a cleaner define name.
But it is cleaner to have the modprobe name option look like the boot command line, i.e.:
modprobe scsi max_luns=1 scsi.max_luns=1
Quoted 2 lines
We should also kill the scsi substrings in the individual options now that we have a regular prefix, I'll submit a patch.
The patch looks good.
-- Patrick Mansfield