public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Hidden scsi devices
@ 2004-01-22 15:21 Brian King
  2004-01-22 15:50 ` Christoph Hellwig
  0 siblings, 1 reply; 11+ messages in thread
From: Brian King @ 2004-01-22 15:21 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

Here is a patch that adds a flag to struct scsi_device which prevents
upper layer drivers from binding to it. This flag can be set by LLDs
in their slave_configure routine. I plan to use this in the ipr driver
so I can have scsi disks that are in RAID arrays show up in sysfs and
have sg devices created for them, but prevent sd devices from being
created since these devices will fail reads and writes with data protect
errors. I tested this out with the ipr driver it worked as expected.



-- 
Brian King
eServer Storage I/O
IBM Linux Technology Center

[-- Attachment #2: patch-2.6.1-hidden_devs --]
[-- Type: text/plain, Size: 1147 bytes --]

diff -Naur linux-2.6.1/drivers/scsi/scsi_sysfs.c linux-2.6.1-hidden/drivers/scsi/scsi_sysfs.c
--- linux-2.6.1/drivers/scsi/scsi_sysfs.c	Fri Jan  9 00:59:10 2004
+++ linux-2.6.1-hidden/drivers/scsi/scsi_sysfs.c	Thu Jan 22 08:54:39 2004
@@ -149,7 +149,13 @@
 /* all probing is done in the individual ->probe routines */
 static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
 {
-	return 1;
+	struct scsi_device *sdev;
+	sdev = to_scsi_device(dev);
+
+	if (sdev->hidden)
+		return 0;
+	else
+		return 1;
 }
 
 struct bus_type scsi_bus_type = {
diff -Naur linux-2.6.1/include/scsi/scsi_device.h linux-2.6.1-hidden/include/scsi/scsi_device.h
--- linux-2.6.1/include/scsi/scsi_device.h	Fri Jan  9 00:59:06 2004
+++ linux-2.6.1-hidden/include/scsi/scsi_device.h	Thu Jan 22 08:50:33 2004
@@ -94,6 +94,7 @@
 	unsigned skip_ms_page_8:1;	/* do not use MODE SENSE page 0x08 */
 	unsigned skip_ms_page_3f:1;	/* do not use MODE SENSE page 0x3f */
 	unsigned no_start_on_add:1;	/* do not issue start on add */
+	unsigned hidden:1;	/* do not bind to upper level driver */
 
 	unsigned int device_blocked;	/* Device returned QUEUE_FULL. */
 

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH] Hidden scsi devices
@ 2004-01-22 15:57 Martin Peschke3
  2004-01-22 17:07 ` Brian King
  0 siblings, 1 reply; 11+ messages in thread
From: Martin Peschke3 @ 2004-01-22 15:57 UTC (permalink / raw)
  To: Brian King; +Cc: linux-scsi


Brian,

why should a LLDD need to bother about device characteristics?
I tend to say that it is completely up to upper layer drivers to
handle such device specialties.
How does a LLDD know about that r/w protection feature anyway?

Mit freundlichen Grüßen / with kind regards

Martin Peschke

IBM Deutschland Entwicklung GmbH
Linux for eServer Development
Phone: +49-(0)7031-16-2349


Brian King <brking@us.ibm.com>@vger.kernel.org on 22/01/2004 16:21:23

Sent by:    linux-scsi-owner@vger.kernel.org


To:    linux-scsi@vger.kernel.org
cc:
Subject:    [PATCH] Hidden scsi devices


Here is a patch that adds a flag to struct scsi_device which prevents
upper layer drivers from binding to it. This flag can be set by LLDs
in their slave_configure routine. I plan to use this in the ipr driver
so I can have scsi disks that are in RAID arrays show up in sysfs and
have sg devices created for them, but prevent sd devices from being
created since these devices will fail reads and writes with data protect
errors. I tested this out with the ipr driver it worked as expected.



--
Brian King
eServer Storage I/O
IBM Linux Technology Center
diff -Naur linux-2.6.1/drivers/scsi/scsi_sysfs.c
linux-2.6.1-hidden/drivers/scsi/scsi_sysfs.c
--- linux-2.6.1/drivers/scsi/scsi_sysfs.c        Fri Jan  9 00:59:10 2004
+++ linux-2.6.1-hidden/drivers/scsi/scsi_sysfs.c             Thu Jan 22
08:54:39 2004
@@ -149,7 +149,13 @@
 /* all probing is done in the individual ->probe routines */
 static int scsi_bus_match(struct device *dev, struct device_driver
*gendrv)
 {
-            return 1;
+            struct scsi_device *sdev;
+            sdev = to_scsi_device(dev);
+
+            if (sdev->hidden)
+                        return 0;
+            else
+                        return 1;
 }

 struct bus_type scsi_bus_type = {
diff -Naur linux-2.6.1/include/scsi/scsi_device.h
linux-2.6.1-hidden/include/scsi/scsi_device.h
--- linux-2.6.1/include/scsi/scsi_device.h             Fri Jan  9 00:59:06
2004
+++ linux-2.6.1-hidden/include/scsi/scsi_device.h            Thu Jan 22
08:50:33 2004
@@ -94,6 +94,7 @@
             unsigned skip_ms_page_8:1;          /* do not use MODE SENSE
page 0x08 */
             unsigned skip_ms_page_3f:1;         /* do not use MODE SENSE
page 0x3f */
             unsigned no_start_on_add:1;         /* do not issue start on
add */
+            unsigned hidden:1;            /* do not bind to upper level
driver */

             unsigned int device_blocked;        /* Device returned
QUEUE_FULL. */





-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-01-22 20:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-22 15:21 [PATCH] Hidden scsi devices Brian King
2004-01-22 15:50 ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2004-01-22 15:57 Martin Peschke3
2004-01-22 17:07 ` Brian King
2004-01-22 17:22   ` James Bottomley
2004-01-22 17:33     ` Brian King
2004-01-22 17:50       ` James Bottomley
2004-01-22 18:42         ` Mike Anderson
2004-01-22 19:43         ` Mike Anderson
2004-01-22 19:46           ` James Bottomley
2004-01-22 20:13             ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox