* [PATCH] convert scsi core to use module_param interfaces
@ 2003-06-04 21:57 Patrick Mansfield
2003-06-06 6:37 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Patrick Mansfield @ 2003-06-04 21:57 UTC (permalink / raw)
To: linux-scsi, James Bottomley
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".
diff -purNX /home/patman/dontdiff bleed-2.5/drivers/scsi/scsi.c modp-log-bl-2.5/drivers/scsi/scsi.c
--- bleed-2.5/drivers/scsi/scsi.c Wed Jun 4 08:08:41 2003
+++ modp-log-bl-2.5/drivers/scsi/scsi.c Thu Jun 5 03:12:44 2003
@@ -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 scsi
MODULE_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;
diff -purNX /home/patman/dontdiff bleed-2.5/drivers/scsi/scsi_devinfo.c modp-log-bl-2.5/drivers/scsi/scsi_devinfo.c
--- bleed-2.5/drivers/scsi/scsi_devinfo.c Wed May 28 23:14:52 2003
+++ modp-log-bl-2.5/drivers/scsi/scsi_devinfo.c Thu Jun 5 03:18:39 2003
@@ -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);
diff -purNX /home/patman/dontdiff bleed-2.5/drivers/scsi/scsi_scan.c modp-log-bl-2.5/drivers/scsi/scsi_scan.c
--- bleed-2.5/drivers/scsi/scsi_scan.c Wed Jun 4 08:08:41 2003
+++ modp-log-bl-2.5/drivers/scsi/scsi_scan.c Thu Jun 5 03:12:44 2003
@@ -27,6 +27,7 @@
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/blk.h>
@@ -72,29 +73,9 @@ static unsigned int max_scsi_luns = MAX_
static unsigned int max_scsi_luns = 1;
#endif
-#ifdef MODULE
-MODULE_PARM(max_scsi_luns, "i");
+module_param(max_scsi_luns, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(max_scsi_luns,
"last scsi LUN (should be between 1 and 2^32-1)");
-#else
-
-static int __init scsi_luns_setup(char *str)
-{
- unsigned int tmp;
-
- if (get_option(&str, &tmp) == 1) {
- max_scsi_luns = tmp;
- return 1;
- } else {
- printk(KERN_WARNING "scsi_luns_setup: usage max_scsi_luns=n "
- "(n should be between 1 and 2^32-1)\n");
- return 0;
- }
-}
-
-__setup("max_scsi_luns=", scsi_luns_setup);
-
-#endif
#ifdef CONFIG_SCSI_REPORT_LUNS
/*
@@ -106,29 +87,10 @@ __setup("max_scsi_luns=", scsi_luns_setu
*/
static unsigned int max_scsi_report_luns = 128;
-#ifdef MODULE
-MODULE_PARM(max_scsi_report_luns, "i");
+module_param(max_scsi_report_luns, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(max_scsi_report_luns,
"REPORT LUNS maximum number of LUNS received (should be"
" between 1 and 16384)");
-#else
-static int __init scsi_report_luns_setup(char *str)
-{
- unsigned int tmp;
-
- if (get_option(&str, &tmp) == 1) {
- max_scsi_report_luns = tmp;
- return 1;
- } else {
- printk(KERN_WARNING "scsi_report_luns_setup: usage"
- " max_scsi_report_luns=n (n should be between 1"
- " and 16384)\n");
- return 0;
- }
-}
-
-__setup("max_scsi_report_luns=", scsi_report_luns_setup);
-#endif
#endif
/**
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] convert scsi core to use module_param interfaces
2003-06-04 21:57 [PATCH] convert scsi core to use module_param interfaces Patrick Mansfield
@ 2003-06-06 6:37 ` Christoph Hellwig
2003-06-06 15:17 ` Patrick Mansfield
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2003-06-06 6:37 UTC (permalink / raw)
To: linux-scsi, James Bottomley
On Wed, Jun 04, 2003 at 02:57:17PM -0700, Patrick Mansfield wrote:
> 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".
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] convert scsi core to use module_param interfaces
2003-06-06 6:37 ` Christoph Hellwig
@ 2003-06-06 15:17 ` Patrick Mansfield
0 siblings, 0 replies; 3+ messages in thread
From: Patrick Mansfield @ 2003-06-06 15:17 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-scsi, James Bottomley
On Fri, Jun 06, 2003 at 07:37:32AM +0100, Christoph Hellwig wrote:
> 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
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-06 15:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-04 21:57 [PATCH] convert scsi core to use module_param interfaces Patrick Mansfield
2003-06-06 6:37 ` Christoph Hellwig
2003-06-06 15:17 ` Patrick Mansfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox