linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikael Pettersson <mikpe@csd.uu.se>
To: linux-kernel@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk, ionut@cs.columbia.edu
Subject: [PATCH,RFC] make ide-scsi more selective
Date: Wed, 22 Aug 2001 21:46:03 +0200 (MET DST)	[thread overview]
Message-ID: <200108221946.VAA01879@harpo.it.uu.se> (raw)

On Mon, 20 Aug 2001 12:28:27 -0400 (EDT), Ion Badulescu wrote:

>The current IDE code doesn't allow the user to reserve a drive to be used 
>only with ide-scsi emulation, if the ide-scsi layer is compiled as a 
>module.

I've been rather annoyed by a dual problem in the ide-scsi setup:
during initialisation, ide-scsi will claim ALL currently unassigned
IDE devices. This is a problem in modular setups, since there's
no guarantee that currently unassigned devices actually are intended
for ide-scsi.

In my case ide-scsi would often steal my ATAPI tape drive since
my ide-tape module usually isn't loaded. Since I don't want this
to happen (for both practical and aesthetic reasons) I've used a
hack in my /etc/modules.conf to forcibly load ide-tape before
scsi_mod, but this is extremely ugly.

Seeing Ion's comment I decided to do something about this, so I
implemented a "units=" module parameter for ide-scsi, which causes
ide-scsi to skip units not explicitly listed. For symmetry one can
also specify this with a "idescsi=" kernel boot parameter.

Caveat: When listing multiple units, don't use "," to separate their
names (e.g. units=hdc,hdd). modutils insists that "," separates array
elements but the actual MODULE_PARM is a single string. I'd use "+"
instead (e.g. units=hdc+hdd), except I actually want to restrict
ide-scsi to a single unit, so I pass "units=hdc" to it.

The patch below implements this option for 2.4.8-ac9. I've also put
it in http://www.csd.uu.se/~mikpe/linux/idescsi/ together with patches
for 2.2.20pre9 with and without Andre's big IDE patch.

Comments?

/Mikael

--- linux-2.4.8-ac9/drivers/ide/ide.c.~1~	Wed Aug 22 14:13:03 2001
+++ linux-2.4.8-ac9/drivers/ide/ide.c	Wed Aug 22 14:20:56 2001
@@ -3006,6 +3006,9 @@
 	if (strncmp(s,"hd",2) == 0 && s[2] == '=')	/* hd= is for hd.c   */
 		return 0;				/* driver and not us */
 
+	if (!strncmp(s, "idescsi=", 8))	/* for ide-scsi.c not us */
+		return 0;
+
 	if (strncmp(s,"ide",3) &&
 	    strncmp(s,"idebus",6) &&
 	    strncmp(s,"hd",2))		/* hdx= & hdxlun= */
--- linux-2.4.8-ac9/drivers/scsi/ide-scsi.c.~1~	Thu Feb 22 15:23:46 2001
+++ linux-2.4.8-ac9/drivers/scsi/ide-scsi.c	Wed Aug 22 14:20:56 2001
@@ -561,6 +561,19 @@
 	NULL
 };
 
+static char *units;
+#ifdef MODULE
+MODULE_PARM(units, "s");
+#else
+/* the name "idescsi_setup" has already been taken :-( */
+static int __init setup_idescsi(char *s)
+{
+	units = s;
+	return 1;
+}
+__setup("idescsi=", setup_idescsi);
+#endif
+
 /*
  *	idescsi_init will register the driver for each scsi.
  */
@@ -580,7 +593,8 @@
 	for (i = 0; media[i] != 255; i++) {
 		failed = 0;
 		while ((drive = ide_scan_devices (media[i], idescsi_driver.name, NULL, failed++)) != NULL) {
-
+			if (units && !strstr(units, drive->name))
+				continue;
 			if ((scsi = (idescsi_scsi_t *) kmalloc (sizeof (idescsi_scsi_t), GFP_KERNEL)) == NULL) {
 				printk (KERN_ERR "ide-scsi: %s: Can't allocate a scsi structure\n", drive->name);
 				continue;

             reply	other threads:[~2001-08-22 19:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-22 19:46 Mikael Pettersson [this message]
2001-08-23  2:49 ` [PATCH,RFC] make ide-scsi more selective Keith Owens
     [not found] <no.id>
2001-08-22 21:17 ` Alan Cox
2001-08-22 21:53   ` Nicholas Knight
2001-08-22 22:00     ` Ion Badulescu
2001-08-22 22:39       ` Nicholas Knight
2001-08-23  3:42         ` mhobgood
2001-08-23  3:54         ` Ion Badulescu
2001-08-23  4:29           ` Nicholas Knight
2001-08-23  0:12       ` Willem Riede
2001-08-25  6:56   ` Ion Badulescu
2001-08-22 22:37 Torrey Hoffman
2001-08-22 23:51 Chris Rankin
2001-08-25 12:10 Mikael Pettersson
2001-08-25 12:37 ` André Dahlqvist
2001-08-25 17:33 ` safemode
     [not found] <200108251734.NAA28426@cs.columbia.edu>
2001-08-27 14:37 ` Ion Badulescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200108221946.VAA01879@harpo.it.uu.se \
    --to=mikpe@csd.uu.se \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ionut@cs.columbia.edu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).