Skip to contentSkip to conversation

scsi sysfs update (base 1/3)

PATCH In review Mike Anderson 5 participants 18 messages Nov 7, 2002 – Nov 8, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi sysfs update (base 1/3)

This patch is against scsi-for-linus-2.5 [email protected].

I have made some changes to scsi sysfs support.

There is still a ways to go on scsi sysfs. The biggest issue is mapping sg into the device model of one driver per device. I have got the upper level drivers to use the probe / remove interfaces, but this previous issue needs to be solved before these can be used.

Changes:

[base]
- Tried to concentrate scsi sysfs support functions into one file so that as things are still in flux with sysfs the other scsi files would not be hit as much.
- Added wrapper functions the reduce init / cleanup issues and mixed object issues (use of container_of with mixed types).
- Moved init_scsi initcall level to subsys_initcall.
- Added scsi-host class support. Future ../class/scsi_host/devices should equal scsi_host_list.
- Removed extra scsi(n) level in tree. Future ../class/scsi_host/devices/(n) children should equal host_queue.

[upper level]
- Minor changes to Scsi_Device_Template init.
- Change template registration / deregistration functions.

[scsi_debug]
These will need to be reviewed by Douglas Gilbert.
- Create a fake bus and adapter slot for scsi_debug to attach to.
- Added sysfs probe, remove and devclass interfaces. scsi_debug can now use new scsi_add_host / scsi_remove_host interfaces.

Note: To get successful insmod / rmmod combinations and clean shutdowns please use the previously posted sysfs core fixups.

-andmike
--
Michael Anderson
[email protected]

 Makefile     |    2 
 hosts.c      |    9 -
 hosts.h      |    9 +
 scsi.c       |   41 +-------
 scsi.h       |    2 
 scsi_scan.c  |   81 ----------------
 scsi_syms.c  |    9 +
 scsi_sysfs.c |  290 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 scsi_sysfs.h |   50 ++++++++++
 9 files changed, 365 insertions(+), 128 deletions(-)

------

drivers/scsi/Makefile +1 -1
diff -Nru a/drivers/scsi/Makefile b/drivers/scsi/Makefile
@@ -124,7 +124,7 @@
 
 scsi_mod-objs	:= scsi.o hosts.o scsi_ioctl.o constants.o scsicam.o \
 			scsi_proc.o scsi_error.o scsi_lib.o scsi_scan.o \
-			scsi_syms.o
+			scsi_syms.o scsi_sysfs.o
 			
 sd_mod-objs	:= sd.o
 sr_mod-objs	:= sr.o sr_ioctl.o sr_vendor.o
drivers/scsi/hosts.c +2 -7
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
@@ -44,6 +44,7 @@
 
 #include "scsi.h"
 #include "hosts.h"
+#include "scsi_sysfs.h"
 
 static LIST_HEAD(scsi_host_hn_list);
 static LIST_HEAD(scsi_host_list);
@@ -196,7 +197,7 @@
 			return 1;
 		}
 		devfs_unregister(sdev->de);
-		device_unregister(&sdev->sdev_driverfs_dev);
+		scsi_bus_device_unregister(sdev);
 	}
 
 	/* Next we free up the Scsi_Cmnd structures for this host */
@@ -223,7 +224,6 @@
 	printk(KERN_INFO "scsi%d : %s\n", shost->host_no,
 			sht->info ? sht->info(shost) : sht->name);
 
-	device_register(&shost->host_driverfs_dev);
 	scan_scsis(shost, 0, 0, 0, 0);
 			
 	for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
@@ -278,7 +278,6 @@
 	if (!shost->hostt->present)
 		remove_proc_entry(shost->hostt->proc_name, proc_scsi);
 #endif
-	device_unregister(&shost->host_driverfs_dev);
 
 	kfree(shost);
 }
@@ -456,10 +455,6 @@
 	scsi_proc_host_add(shost);
 #endif
 
-	strncpy(shost->host_driverfs_dev.name, shost_tp->proc_name,
-		DEVICE_NAME_SIZE-1);
-	sprintf(shost->host_driverfs_dev.bus_id, "scsi%d",
-		shost->host_no);
 
 	shost->eh_notify = &sem;
 	kernel_thread((int (*)(void *)) scsi_error_handler, (void *) shost, 0);
drivers/scsi/hosts.h +6 -3
diff -Nru a/drivers/scsi/hosts.h b/drivers/scsi/hosts.h
@@ -476,9 +476,9 @@
     struct pci_dev *pci_dev;
 
     /* 
-     * Support for driverfs filesystem
+     * Support for device model
      */
-    struct device host_driverfs_dev;
+    struct device *host_driverfs_dev;
 
     /*
      * We should ensure that this is aligned, both for better performance
@@ -534,7 +534,7 @@
                                        struct pci_dev *pdev)
 {
 	shost->pci_dev = pdev;
-	shost->host_driverfs_dev.parent=&pdev->dev;
+	shost->host_driverfs_dev = &pdev->dev;
 }
 
 
@@ -561,6 +561,9 @@
                                            Selects command for blkdevs */
     struct device_driver scsi_driverfs_driver;
 };
+
+#define to_scsi_dev_tp(d) \
+	container_of(d, struct Scsi_Device_Template, scsi_driverfs_driver)
 
 void  scsi_initialize_queue(Scsi_Device *, struct Scsi_Host *);
 
drivers/scsi/scsi.c +7 -34

77 lines not on this page · raw message

drivers/scsi/scsi.h +0 -2
diff -Nru a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h
@@ -414,8 +414,6 @@
 						   * buffers */
 extern volatile int in_scan_scsis;
 
-extern struct bus_type scsi_driverfs_bus_type;
-
 
 /*
  * These are the error handling functions defined in scsi_error.c
drivers/scsi/scsi_scan.c +2 -79

99 lines not on this page · raw message

drivers/scsi/scsi_syms.c +7 -2
diff -Nru a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c
@@ -21,6 +21,7 @@
 #include "scsi.h"
 #include <scsi/scsi_ioctl.h>
 #include "hosts.h"
+#include "scsi_sysfs.h"
 
 #include <scsi/scsicam.h>
 
@@ -107,6 +108,10 @@
 EXPORT_SYMBOL(scsi_delete_timer);
 
 /*
- * driverfs support for determining driver types
+ * Symbols for scsi sysfs support
  */
-EXPORT_SYMBOL(scsi_driverfs_bus_type);
+EXPORT_SYMBOL(scsi_bus_driver_register);
+EXPORT_SYMBOL(scsi_bus_driver_unregister);
+EXPORT_SYMBOL(scsi_host_class_register);
+EXPORT_SYMBOL(scsi_host_class_unregister);
+EXPORT_SYMBOL(shost_devclass);
drivers/scsi/scsi_sysfs.c new file +290 -0

290 lines not on this page · raw message

drivers/scsi/scsi_sysfs.h new file +50 -0

50 lines not on this page · raw message

#1 lore raw

PATCH 1/1 scsi sysfs update (upper 2/3)

This patch is against scsi-for-linus-2.5 [email protected].

[upper level]
- Minor changes to Scsi_Device_Template init.
- Change template registration / deregistration functions.

-andmike
--
Michael Anderson
[email protected]

 sd.c |   10 ++++++----
 sg.c |   13 ++++++++-----
 sr.c |   10 +++++++---
 st.c |   15 +++++++++------
 4 files changed, 30 insertions(+), 18 deletions(-)

------

drivers/scsi/sd.c +6 -4
diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
@@ -53,6 +53,7 @@
 #include "hosts.h"
 #include <scsi/scsi_ioctl.h>
 #include <scsi/scsicam.h>
+#include "scsi_sysfs.h"
 
 /*
  * Remaining dev_t-handling stuff
@@ -105,12 +106,14 @@
 static struct Scsi_Device_Template sd_template = {
 	.module		= THIS_MODULE,
 	.name		= "disk",
-	.tag		= "sd",
 	.scsi_type	= TYPE_DISK,
 	.detect		= sd_detect,
 	.attach		= sd_attach,
 	.detach		= sd_detach,
 	.init_command	= sd_init_command,
+	.scsi_driverfs_driver   = {
+		.name   = "sd",
+	},
 };
 
 static struct scsi_disk *sd_find_by_sdev(Scsi_Device *sd)
@@ -1346,7 +1349,7 @@
 	if (!majors)
 		return -ENODEV;
 
-	rc = scsi_register_device(&sd_template);
+	rc = scsi_bus_driver_register(&sd_template);
 	if (rc)
 		return rc;
 	register_reboot_notifier(&sd_notifier_block);
@@ -1365,10 +1368,9 @@
 	SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n"));
 
 	unregister_reboot_notifier(&sd_notifier_block);
-	scsi_unregister_device(&sd_template);
+	scsi_bus_driver_unregister(&sd_template);
 	for (i = 0; i < SD_MAJORS; i++)
 		unregister_blkdev(SD_MAJOR(i), "sd");
-	driver_unregister(&sd_template.scsi_driverfs_driver);
 }
 
 /*
drivers/scsi/sg.c +8 -5
diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
@@ -66,6 +66,7 @@
 #include "hosts.h"
 #include <scsi/scsi_ioctl.h>
 #include <scsi/sg.h>
+#include "scsi_sysfs.h"
 
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
@@ -122,11 +123,13 @@
 static struct Scsi_Device_Template sg_template = {
 	.module = THIS_MODULE,
 	.name = "generic",
-	.tag = "sg",
 	.scsi_type = 0xff,
 	.detect = sg_detect,
 	.attach = sg_attach,
-	.detach = sg_detach
+	.detach = sg_detach,
+	.scsi_driverfs_driver = {
+		.name   = "sg",
+	},
 };
 
 typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */
@@ -1479,7 +1482,7 @@
 	sprintf(sdp->sg_driverfs_dev.name, "%sgeneric",
 		scsidp->sdev_driverfs_dev.name);
 	sdp->sg_driverfs_dev.parent = &scsidp->sdev_driverfs_dev;
-	sdp->sg_driverfs_dev.bus = &scsi_driverfs_bus_type;
+	sdp->sg_driverfs_dev.bus = scsidp->sdev_driverfs_dev.bus;
 
 	sg_nr_dev++;
 	sg_dev_arr[k] = sdp;
@@ -1605,7 +1608,7 @@
 	rc = register_chrdev(SCSI_GENERIC_MAJOR, "sg", &sg_fops);
 	if (rc)
 		return rc;
-	rc = scsi_register_device(&sg_template);
+	rc =  scsi_bus_driver_register(&sg_template);
 	if (rc)
 		return rc;
 #ifdef CONFIG_PROC_FS
@@ -1620,7 +1623,7 @@
 #ifdef CONFIG_PROC_FS
 	sg_proc_cleanup();
 #endif				/* CONFIG_PROC_FS */
-	scsi_unregister_device(&sg_template);
+	scsi_bus_driver_unregister(&sg_template);
 	unregister_chrdev(SCSI_GENERIC_MAJOR, "sg");
 	if (sg_dev_arr != NULL) {
 		vfree((char *) sg_dev_arr);
drivers/scsi/sr.c +7 -3
diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c
@@ -51,6 +51,7 @@
 #include "scsi.h"
 #include "hosts.h"
 #include <scsi/scsi_ioctl.h>	/* For the door lock/unlock commands */
+#include "scsi_sysfs.h"
 
 #include "sr.h"
 
@@ -78,7 +79,10 @@
 	.detect		= sr_detect,
 	.attach		= sr_attach,
 	.detach		= sr_detach,
-	.init_command	= sr_init_command
+	.init_command	= sr_init_command,
+	.scsi_driverfs_driver   = {
+		.name	= "sr",
+	},
 };
 
 static int sr_nr_dev;	/* XXX(hch) bad hack, we want a bitmap instead */
@@ -823,12 +827,12 @@
 	rc = register_blkdev(MAJOR_NR, "sr", &sr_bdops);
 	if (rc)
 		return rc;
-	return scsi_register_device(&sr_template);
+	return scsi_bus_driver_register(&sr_template);
 }
 
 static void __exit exit_sr(void)
 {
-	scsi_unregister_device(&sr_template);
+	scsi_bus_driver_unregister(&sr_template);
 	unregister_blkdev(MAJOR_NR, "sr");
 }
 
drivers/scsi/st.c +9 -6
diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
@@ -61,6 +61,7 @@
 #include "scsi.h"
 #include "hosts.h"
 #include <scsi/scsi_ioctl.h>
+#include "scsi_sysfs.h"
 
 #define ST_KILOBYTE 1024
 
@@ -176,11 +177,13 @@
 static struct Scsi_Device_Template st_template = {
 	.module =	THIS_MODULE,
 	.name =		"tape", 
-	.tag =		"st", 
 	.scsi_type =	TYPE_TAPE,
 	.detect =	st_detect, 
 	.attach =	st_attach, 
-	.detach =	st_detach
+	.detach =	st_detach,
+	.scsi_driverfs_driver = {
+		.name	= "st",
+	},
 };
 
 static int st_compression(Scsi_Tape *, int);
@@ -3841,7 +3844,7 @@
 	    sprintf(tpnt->driverfs_dev_r[mode].name, "%s%s", 
 		    SDp->sdev_driverfs_dev.name, name);
 	    tpnt->driverfs_dev_r[mode].parent = &SDp->sdev_driverfs_dev;
-	    tpnt->driverfs_dev_r[mode].bus = &scsi_driverfs_bus_type;
+	    tpnt->driverfs_dev_r[mode].bus = SDp->sdev_driverfs_dev.bus;
 	    tpnt->driverfs_dev_r[mode].driver_data =
 			(void *)(long)__mkdev(MAJOR_NR, dev_num + (mode << 5));
 	    device_register(&tpnt->driverfs_dev_r[mode]);
@@ -3860,7 +3863,7 @@
 	    sprintf(tpnt->driverfs_dev_n[mode].name, "%s%s", 
 		    SDp->sdev_driverfs_dev.name, name);
 	    tpnt->driverfs_dev_n[mode].parent= &SDp->sdev_driverfs_dev;
-	    tpnt->driverfs_dev_n[mode].bus = &scsi_driverfs_bus_type;
+	    tpnt->driverfs_dev_n[mode].bus = SDp->sdev_driverfs_dev.bus;
 	    tpnt->driverfs_dev_n[mode].driver_data =
 			(void *)(long)__mkdev(MAJOR_NR, dev_num + (mode << 5) + 128);
 	    device_register(&tpnt->driverfs_dev_n[mode]);
@@ -3951,7 +3954,7 @@
 		st_max_sg_segs);
 
 	if (register_chrdev(SCSI_TAPE_MAJOR, "st", &st_fops) >= 0) {
-		if (scsi_register_device(&st_template) == 0)
+		if (scsi_bus_driver_register(&st_template) == 0) 
 			return 0;
 	}
 
@@ -3963,7 +3966,7 @@
 {
 	int i;
 
-	scsi_unregister_device(&st_template);
+	scsi_bus_driver_unregister(&st_template);
 	unregister_chrdev(SCSI_TAPE_MAJOR, "st");
 	if (scsi_tapes != NULL) {
 		for (i=0; i < st_dev_max; ++i)
#2 lore raw

PATCH 1/1 scsi sysfs update (scsi_debug 3/3)

This patch is against scsi-for-linus-2.5 [email protected].

[scsi_debug]
These will need to be reviewed by Douglas Gilbert.
- Create a fake bus and adapter slot for scsi_debug to attach to.
- Added sysfs probe, remove and devclass interfaces. scsi_debug can now use new scsi_add_host / scsi_remove_host interfaces.

-andmike
--
Michael Anderson
[email protected]

 scsi_debug.c |  292 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 224 insertions(+), 68 deletions(-)

------

drivers/scsi/scsi_debug.c +224 -68
diff -Nru a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
@@ -41,6 +41,7 @@
 #include <linux/blk.h>
 #include "scsi.h"
 #include "hosts.h"
+#include "scsi_sysfs.h"
 
 #include <linux/stat.h>
 
@@ -52,7 +53,8 @@
 
 static const char * scsi_debug_version_str = "Version: 1.63 (20021103)";
 
-#define DRIVERFS_SUPPORT 1	/* comment out whole line to disable */
+#define SYSFS_SUPPORT 1 /* comment out whole line to disable */
+#define SYSFS_PROBE 1  /* comment out whole line to disable */
 
 
 #ifndef SCSI_CMD_READ_16
@@ -146,9 +148,7 @@
 static spinlock_t queued_arr_lock = SPIN_LOCK_UNLOCKED;
 static rwlock_t atomic_rw = RW_LOCK_UNLOCKED;
 
-#ifdef DRIVERFS_SUPPORT
-static struct device_driver sdebug_driverfs_driver;
-#endif
+static char sdebug_name[] = "scsi_debug";
 
 /* function declarations */
 static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff,
@@ -176,11 +176,6 @@
 static int stop_queued_cmnd(struct scsi_cmnd * cmnd);
 static int inquiry_evpd_83(unsigned char * arr, int dev_id_num,
                            const char * dev_id_str, int dev_id_str_len);
-#ifdef DRIVERFS_SUPPORT
-static void do_create_driverfs_files(void);
-static void do_remove_driverfs_files(void);
-#endif
-
 
 static unsigned char * scatg2virt(const struct scatterlist * sclp)
 {
@@ -811,67 +806,73 @@
 
 static int initialized = 0;
 static int num_hosts_present = 0;
-static const char * sdebug_proc_name = "scsi_debug";
 
-static int scsi_debug_detect(struct SHT * tpnt)
+static int scsi_debug_alloc(void)
 {
-	int k, sz;
-	struct Scsi_Host * hpnt;
+	int sz;
 
 	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
-		printk(KERN_INFO "scsi_debug: detect\n");
+		printk(KERN_INFO "%s: Entered\n", __FUNCTION__);
 	if (0 == initialized) {
 		++initialized;
 		sz = sizeof(struct sdebug_dev_info) * scsi_debug_num_devs;
 		devInfop = vmalloc(sz);
 		if (NULL == devInfop) {
-			printk(KERN_ERR "scsi_debug_detect: out of "
-			       "memory\n");
+			printk(KERN_ERR "%s: out of "
+			       "memory, 0.5\n", __FUNCTION__);
 			return 0;
 		}
 		memset(devInfop, 0, sz);
 		sz = STORE_SIZE;
 		fake_storep = vmalloc(sz);
 		if (NULL == fake_storep) {
-			printk(KERN_ERR "scsi_debug_detect: out of memory"
-			       ", 1\n");
+			printk(KERN_ERR "%s: out of memory"
+			       ", 0\n", __FUNCTION__);
 			return 0;
 		}
 		memset(fake_storep, 0, sz);
 		init_all_queued();
-#ifdef DRIVERFS_SUPPORT
-		sdebug_driverfs_driver.name = (char *)sdebug_proc_name;
-		sdebug_driverfs_driver.bus = &scsi_driverfs_bus_type;
-		driver_register(&sdebug_driverfs_driver);
-		do_create_driverfs_files();
-#endif
-		tpnt->proc_name = (char *)sdebug_proc_name;
-		for (num_hosts_present = 0, k = 0; k < NR_HOSTS_PRESENT; k++) {
-			if ((hpnt = scsi_register(tpnt, 0)) == NULL)
-				printk(KERN_ERR "scsi_debug_detect: "
-					"scsi_register failed k=%d\n", k);
-			else {
-				hpnt->max_lun = scsi_debug_max_luns;
-				++num_hosts_present;
-			}
-		}
-		if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
-			printk(KERN_INFO "scsi_debug: ... built %d host(s)\n",
-			       num_hosts_present);
-		return num_hosts_present;
 	} else {
-		printk(KERN_WARNING "scsi_debug_detect: called again\n");
-		return 0;
+		printk(KERN_WARNING "%s: called again\n", __FUNCTION__);	
 	}
+
+	return 0;
 }
 
+static struct device scsi_dbg_fake_bus_dev;
+
+static int scsi_debug_detect(struct SHT * tpnt)
+{
+	int k;
+	struct Scsi_Host *hpnt;
+
+	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
+		printk(KERN_INFO "%s: Entered\n", __FUNCTION__);
+
+	scsi_debug_alloc();
+
+	for (num_hosts_present = 0, k = 0; k < NR_HOSTS_PRESENT; k++) {
+		if ((hpnt = scsi_register(tpnt, 0)) == NULL)
+				printk(KERN_ERR "%s: "
+					"scsi_register failed k=%d\n",
+					__FUNCTION__, k);
+		else {
+			hpnt->max_lun = scsi_debug_max_luns;
+			++num_hosts_present;
+			scsi_host_dev_set(hpnt, &scsi_dbg_fake_bus_dev);
+		}
+	}
+	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
+		printk(KERN_INFO "scsi_debug: ... built %d host(s)\n",
+			       num_hosts_present);
+
+	return num_hosts_present;
+}
 
 static int num_releases = 0;
 
-static int scsi_debug_release(struct Scsi_Host * hpnt)
+static int scsi_debug_free(int host_no)
 {
-	int host_no = hpnt->host_no;
-
 	if (++num_releases == num_hosts_present) {
 		if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
 			printk(KERN_INFO "scsi_debug: [last] release, "
@@ -879,10 +880,6 @@
 		num_releases = 0;
 		initialized = 0;
 		stop_all_queued();
-#ifdef DRIVERFS_SUPPORT
-		do_remove_driverfs_files();
-		driver_unregister(&sdebug_driverfs_driver);
-#endif
 		vfree(fake_storep);
 		vfree(devInfop);
 	}
@@ -891,7 +888,16 @@
 			printk(KERN_INFO "scsi_debug: release, host_no=%u\n",
 			       host_no);
 	}
+	return 0;
+}
+
+static int scsi_debug_release(struct Scsi_Host * hpnt)
+{
+	int host_no = hpnt->host_no;
+
 	scsi_unregister(hpnt);
+	scsi_debug_free(host_no);
+
 	return 0;
 }
 
@@ -1372,7 +1378,112 @@
 	return len;
 }
 
-#ifdef DRIVERFS_SUPPORT
+void scsi_debug_sysfs_register(void);
+void scsi_debug_sysfs_unregister(void);
+
+static int __init scsi_debug_init(void)
+{
+	driver_template.proc_name = (char *)sdebug_name;
+	scsi_debug_sysfs_register();
+	return 0;
+}
+
+static void __exit scsi_debug_exit(void)
+{
+	scsi_debug_sysfs_unregister();
+}
+
+device_initcall(scsi_debug_init);
+module_exit(scsi_debug_exit);
+
+#ifdef SYSFS_SUPPORT
+
+static struct device scsi_dbg_primary_bus = {
+	.name		= "scsi_dbg_fake_root",
+	.bus_id		= "scsi_dbg_fake",
+};
+
+static int scsi_debug_fake_bus_match(struct device *dev, 
+                          struct device_driver *dev_driver)
+{
+        return 1;
+}
+
+static struct bus_type scsi_dbg_fake_bus_type = {
+        name: "scsi_dbg_fake",
+        match: scsi_debug_fake_bus_match,
+};
+
+static struct device scsi_dbg_fake_bus_dev = {
+	.name		= "scsi debug adapater",
+	.bus_id		= "02:05.0",
+	.bus		= &scsi_dbg_fake_bus_type,
+	.parent		= &scsi_dbg_primary_bus,
+};
+
+int scsi_debug_fake_bus_register_driver(struct device_driver *dev_driver)
+{
+	dev_driver->bus = &scsi_dbg_fake_bus_type;
+	driver_register(dev_driver);
+
+	return 0;
+}
+
+int scsi_debug_fake_bus_unregister_driver(struct device_driver *dev_driver)
+{
+	driver_unregister(dev_driver);
+	return 0;
+}
+
+#ifdef SYSFS_PROBE
+static int scsi_debug_probe (struct device *dev)
+{
+	struct Scsi_Host *hpnt;
+
+	hpnt = scsi_register(&driver_template, 0);
+	if (!hpnt) {
+		printk(KERN_ERR "%s: "
+			"scsi_register failed\n", __FUNCTION__);
+		return 1;
+	}
+
+	++num_hosts_present;
+
+	scsi_debug_alloc();
+
+	scsi_host_class_register(dev, hpnt);
+	
+	return 0;
+}
+
+static int scsi_debug_remove (struct device *dev)
+{
+	int host_no;
+	struct Scsi_Host *hpnt;
+
+	hpnt = scsi_class_data_get(dev);
+	host_no = hpnt->host_no;
+
+	scsi_host_class_unregister(dev);
+
+	scsi_debug_free(host_no);
+
+	return 0;
+}
+#else 
+
+static int scsi_debug_probe (struct device *dev)
+{
+	return 0;
+}
+
+static int scsi_debug_remove (struct device *dev)
+{
+	return 0;
+}
+
+#endif
+
 static ssize_t sdebug_delay_read(struct device_driver * ddp, char * buf, 
 				 size_t count, loff_t off)
 {
@@ -1464,27 +1575,72 @@
 }
 DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_read, NULL) 
 
-static void do_create_driverfs_files()
+static struct device_driver sdebug_driver = {
+	.name           = sdebug_name,
+	.probe          = scsi_debug_probe,
+	.remove         = scsi_debug_remove,
+	.devclass       = &shost_devclass,
+};
+
+static void do_create_driverfs_files(void)
 {
-	driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay);
-	driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts);
-	driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_devs);
-	driver_create_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb);
-	driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth);
-	driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns);
-	driver_create_file(&sdebug_driverfs_driver, &driver_attr_scsi_level);
-}
-
-static void do_remove_driverfs_files()
-{
-	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_scsi_level);
-	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_luns);
-	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_every_nth);
-	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb);
-	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_devs);
-	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_opts);
-	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_delay);
+	driver_create_file(&sdebug_driver, &driver_attr_delay);
+	driver_create_file(&sdebug_driver, &driver_attr_opts);
+	driver_create_file(&sdebug_driver, &driver_attr_num_devs);
+	driver_create_file(&sdebug_driver, &driver_attr_dev_size_mb);
+	driver_create_file(&sdebug_driver, &driver_attr_every_nth);
+	driver_create_file(&sdebug_driver, &driver_attr_max_luns);
+	driver_create_file(&sdebug_driver, &driver_attr_scsi_level);
 }
+
+static void do_remove_driverfs_files(void)
+{
+	driver_remove_file(&sdebug_driver, &driver_attr_scsi_level);
+	driver_remove_file(&sdebug_driver, &driver_attr_max_luns);
+	driver_remove_file(&sdebug_driver, &driver_attr_every_nth);
+	driver_remove_file(&sdebug_driver, &driver_attr_dev_size_mb);
+	driver_remove_file(&sdebug_driver, &driver_attr_num_devs);
+	driver_remove_file(&sdebug_driver, &driver_attr_opts);
+	driver_remove_file(&sdebug_driver, &driver_attr_delay);
+}
+
+
+void scsi_debug_sysfs_register(void)
+{
+	device_register(&scsi_dbg_primary_bus);
+	bus_register(&scsi_dbg_fake_bus_type);
+	device_register(&scsi_dbg_fake_bus_dev);
+
+	scsi_debug_fake_bus_register_driver(&sdebug_driver);
+	do_create_driverfs_files();
+#ifndef SYSFS_PROBE
+	scsi_register_host(&driver_template);
 #endif
+}
+
+void scsi_debug_sysfs_unregister(void)
+{
+#ifndef SYSFS_PROBE
+	scsi_unregister_host(&driver_template);
+#endif
+	do_remove_driverfs_files();
+	scsi_debug_fake_bus_unregister_driver(&sdebug_driver);
+
+	device_unregister(&scsi_dbg_fake_bus_dev);
+	bus_unregister(&scsi_dbg_fake_bus_type);
+	device_unregister(&scsi_dbg_primary_bus);
+}
+
+#else
 
-#include "scsi_module.c"
+void scsi_debug_sysfs_register(void)
+{
+	scsi_register_host(&driver_template);
+}
+
+void scsi_debug_sysfs_unregister(void)
+{
+	scsi_unregister_host(&driver_template);
+}
+
+#endif
#3 lore raw

Re: [PATCH] scsi sysfs update (scsi_debug 3/3)

drivers/scsi/scsi_debug.c line 57

Quoted 3 lines · Mike Anderson
drivers/scsi/scsi_debug.c +2 -1
-#define DRIVERFS_SUPPORT 1	/* comment out whole line to disable */
+#define SYSFS_SUPPORT 1 /* comment out whole line to disable */
+#define SYSFS_PROBE 1  /* comment out whole line to disable */

Do we really want ifdefs for this? And if yes why aren't they config options?

#4 lore raw

Re: [PATCH] scsi sysfs update (scsi_debug 3/3)

Quoted 7 lines · Christoph Hellwig [[email protected]] wrote:

drivers/scsi/scsi_debug.c line 57

Quoted 3 lines · Mike Anderson
drivers/scsi/scsi_debug.c +2 -1
-#define DRIVERFS_SUPPORT 1	/* comment out whole line to disable */
+#define SYSFS_SUPPORT 1 /* comment out whole line to disable */
+#define SYSFS_PROBE 1  /* comment out whole line to disable */

Do we really want ifdefs for this? And if yes why aren't they config options?

I was trying to follow Douglas's previous form in his driver. It could be changed to a config option if Douglas is ok with that.

-andmike
--
Michael Anderson
[email protected]

#5 lore raw

Re: [PATCH] scsi sysfs update (scsi_debug 3/3)

Quoted 12 lines · Mike Anderson
Quoted 8 lines · Christoph Hellwig [[email protected]] wrote:

drivers/scsi/scsi_debug.c line 57

Quoted 3 lines · Mike Anderson
drivers/scsi/scsi_debug.c +2 -1
-#define DRIVERFS_SUPPORT 1	/* comment out whole line to disable */
+#define SYSFS_SUPPORT 1 /* comment out whole line to disable */
+#define SYSFS_PROBE 1  /* comment out whole line to disable */

Do we really want ifdefs for this? And if yes why aren't they config options?

Quoted 2 lines

I was trying to follow Douglas's previous form in his driver. It could be changed to a config option if Douglas is ok with that.

Mike,
I think it is fine to drop those conditional compiles now. The 2.4 and 2.5 scsi_debug drivers are now significantly different beasts.

Further to Christoph's "registering individual hosts" patch for LLDDs, I would like to change scsi_debug thus:

if scsi_debug_num_devs == 0
then don't make any hosts // await later "add_host"
else
make one host and build devices until
either num_devs is exhausted or mid level stops

Add a writeable (via sysfs) "add_host" parameter. Examples:
cd /sysfs/bus/scsi/drivers/scsi_debug/
echo 1 > add_host // add 1 host
echo 2 > add_host // add 2 hosts
echo -1 > add_host // remove 1 host (last one)
then build (or remove) devices until either num_devs is exhausted or mid level stops. This should allow folks to simulate scsi (pseudo) host hotplugging. Simulating large banks of scsi devices could then be done like this:

  modprobe scsi_debug scsi_debug_num_devs=300 \
                      scsi_debug_max_luns=4 \
                      scsi_debug_add_hosts=10

With the current scsi_scan this would result in 10 hosts each with 7 target ids (0..6) each with 4 luns (0..3) for a total of 280 devices. [The scsi_debug drivers would be left with 20 unused slots for further devices.]

BTW Is the 256 minors limit history yet in 2.5?

Whither sg?? Well it has been my intention to put a functionally stripped down version of the sg_io_hdr interface in a mid level ioctl. It could overlay the current SCSI_IOCTL_SEND_COMMAND or be a new ioctl number. For anyone who has used the existing SCSI_IOCTL_SEND_COMMAND interface they will be aware that it is dreadful (making sg_header look good :-) ). However from an application point of view you are still going to have sd, sr or st in the way of what you are really trying to do. Then there are the odd ball devices: this week I came across a SCSI printer type device for the first time. It's a modern device build to hide its true purpose from OSes!

Rather than a free standing upper level device, sg could be seen as an adjunct to the mid level. There is no need to probe sg to find out whether it is interested in a newly attach scsi device - by definition it is (unless it has run out of resources).

Doug Gilbert

#6 lore raw

Re: [PATCH] scsi sysfs update (scsi_debug 3/3)

Quoted 1 line · Douglas Gilbert

BTW Is the 256 minors limit history yet in 2.5?

No. but for blockdevices minors are basically meaningless now.

Quoted 5 lines

Whither sg?? Well it has been my intention to put a functionally stripped down version of the sg_io_hdr interface in a mid level ioctl. It could overlay the current SCSI_IOCTL_SEND_COMMAND or be a new ioctl number.

Please use a new one one, overloading only creates confusion.

Quoted 8 lines

that it is dreadful (making sg_header look good :-) ). However from an application point of view you are still going to have sd, sr or st in the way of what you are really trying to do. Then there are the odd ball devices: this week I came across a SCSI printer type device for the first time. It's a modern device build to hide its true purpose from OSes!

Quoted 5 lines

Rather than a free standing upper level device, sg could be seen as an adjunct to the mid level. There is no need to probe sg to find out whether it is interested in a newly attach scsi device - by definition it is (unless it has run out of resources).

Yupp. What I was thinking about was not to remove the sg device nodes and leaving only the ioctl functionality as part of other device nodes but rather creating a sg node for every scsi device, without it beeing a "real" upper layer driver.

#7 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

In reply to Mike Anderson

drivers/scsi/sd.c line 116

Quoted 3 lines · Mike Anderson
drivers/scsi/sd.c +3 -0
+	.scsi_driverfs_driver   = {
+		.name   = "sd",
+	},

can we changhe scsi_driverfs_driver to something saner? E.g. gen_driver?

drivers/scsi/sd.c line 1352

Quoted 7 lines

static struct scsi_disk *sd_find_by_sdev(Scsi_Device *sd)

drivers/scsi/sd.c +1 -1
@@ -1346,7 +1349,7 @@
 	if (!majors)
 		return -ENODEV;
 
-	rc = scsi_register_device(&sd_template);
+	rc = scsi_bus_driver_register(&sd_template);

Umm, no. We don't register a bus. Just leave the name unchanged until we there is some commonly agreed upon upper layer terminology.

#8 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

Quoted 7 lines · Christoph Hellwig [[email protected]] wrote:

drivers/scsi/sd.c line 116

Quoted 3 lines · Mike Anderson
drivers/scsi/sd.c +3 -0
+	.scsi_driverfs_driver   = {
+		.name   = "sd",
+	},

can we changhe scsi_driverfs_driver to something saner? E.g. gen_driver?

ok.

I did have some name changes previous, but pulled them out to reduce collisions with the patches going on in this area.

Though my below renaming is not consitant with this thought :-).

Quoted 10 lines

drivers/scsi/sd.c line 1352

Quoted 7 lines

static struct scsi_disk *sd_find_by_sdev(Scsi_Device *sd)

drivers/scsi/sd.c +1 -1
@@ -1346,7 +1349,7 @@
 	if (!majors)
 		return -ENODEV;
 
-	rc = scsi_register_device(&sd_template);
+	rc = scsi_bus_driver_register(&sd_template);

Umm, no. We don't register a bus. Just leave the name unchanged until we there is some commonly agreed upon upper layer terminology.

Well we are registering a driver with the device model scsi_bus (i.e a driver_register on scsi_bus_type).

Could we agree on terminology now as I believe scsi_register_device is mis-leading for others reading the scsi code as it is a driver not a device?

-andmike
--
Michael Anderson
[email protected]

#9 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

Quoted 8 lines · Mike Anderson
Quoted 5 lines

drivers/scsi/sd.c line 1352

Quoted 2 lines
drivers/scsi/sd.c +1 -1
-	rc = scsi_register_device(&sd_template);
+	rc = scsi_bus_driver_register(&sd_template);

Umm, no. We don't register a bus. Just leave the name unchanged until we there is some commonly agreed upon upper layer terminology.

Well we are registering a driver with the device model scsi_bus (i.e a driver_register on scsi_bus_type).

We register a scsi upperlayer driver with the midlayer, we don't care about the implementation, and it's certainly not a bus. I do btw disagree strongly with using the device model bus type for upper level drivers. We have a bus in scsi, and that's the connection between the HBA and the devices. To make any sense out of the device model these devices must be childs of the HBA.

Quoted 3 lines

Could we agree on terminology now as I believe scsi_register_device is mis-leading for others reading the scsi code as it is a driver not a device?

The device terminology in scsi is misleading but it's used at least consistantly. Feel free to submit a patch that changes it to upper or something like that once scsi settles down a bit before 2.6.

#10 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

Quoted 10 lines · Christoph Hellwig [[email protected]] wrote:
Quoted 8 lines · Mike Anderson
Quoted 5 lines

drivers/scsi/sd.c line 1352

Quoted 2 lines
drivers/scsi/sd.c +1 -1
-	rc = scsi_register_device(&sd_template);
+	rc = scsi_bus_driver_register(&sd_template);

Umm, no. We don't register a bus. Just leave the name unchanged until we there is some commonly agreed upon upper layer terminology.

Well we are registering a driver with the device model scsi_bus (i.e a driver_register on scsi_bus_type).

Quoted 7 lines

We register a scsi upperlayer driver with the midlayer, we don't care about the implementation, and it's certainly not a bus. I do btw disagree strongly with using the device model bus type for upper level drivers. We have a bus in scsi, and that's the connection between the HBA and the devices. To make any sense out of the device model these devices must be childs of the HBA.

Is the disagreement the function name, bus name, or the concept of registering these drivers with sysfs?

I know the model is not an exact fit, but if we want to use the sysfs infrastructure all drivers must be associated with a bus. HBAs belong to there parent bus. They can have associations which I added in this patch to create a scsi-host class. We cannot create a bus under the HBA. All buses are default set to a parent of bus_subsys.

The /bus/scsi is a logical bus (an aggregation of all scsi buses). The upperlayer drivers are the only drivers that should show up under /bus/scsi/drivers and the only drivers that can bind with scsi_devices.

In this patch I did remove the extra node that the devices where setting under and now the scsi devices are children of the HBA. The /bus/scsi/devices are only links to child devices of the HBA.

Quoted 8 lines
Quoted 3 lines

Could we agree on terminology now as I believe scsi_register_device is mis-leading for others reading the scsi code as it is a driver not a device?

The device terminology in scsi is misleading but it's used at least consistantly. Feel free to submit a patch that changes it to upper or something like that once scsi settles down a bit before 2.6.

Well I wanted to name scsi_bus_driver_register something other than scsi_register_device as I am calling scsi_register_device from this function so that if we get probe / remove working only the internals of this function need to change (while that is not exactly true there will need to be small changes in the upper also).

Do you see a problem with "scsi_upper_driver_register" being added now?

-andmike
--
Michael Anderson
[email protected]

#11 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

Quoted 31 lines · Mike Anderson
Quoted 11 lines · Christoph Hellwig [[email protected]] wrote:
Quoted 8 lines · Mike Anderson
Quoted 5 lines

drivers/scsi/sd.c line 1352

Quoted 2 lines
drivers/scsi/sd.c +1 -1
-	rc = scsi_register_device(&sd_template);
+	rc = scsi_bus_driver_register(&sd_template);

Umm, no. We don't register a bus. Just leave the name unchanged until we there is some commonly agreed upon upper layer terminology.

Well we are registering a driver with the device model scsi_bus (i.e a driver_register on scsi_bus_type).

Quoted 7 lines

We register a scsi upperlayer driver with the midlayer, we don't care about the implementation, and it's certainly not a bus. I do btw disagree strongly with using the device model bus type for upper level drivers. We have a bus in scsi, and that's the connection between the HBA and the devices. To make any sense out of the device model these devices must be childs of the HBA.

Is the disagreement the function name, bus name, or the concept of registering these drivers with sysfs?

I know the model is not an exact fit, but if we want to use the sysfs infrastructure all drivers must be associated with a bus. HBAs belong to there parent bus. They can have associations which I added in this patch to create a scsi-host class. We cannot create a bus under the HBA. All buses are default set to a parent of bus_subsys.

Quoted 3 lines

The /bus/scsi is a logical bus (an aggregation of all scsi buses). The upperlayer drivers are the only drivers that should show up under /bus/scsi/drivers and the only drivers that can bind with scsi_devices.

Mike,
I have put scsi_debug's parameters under /bus/scsi/drivers and scsi_debug obviously isn't an upper layer driver. Also I would be tempted to put mid level parameters there (if there were any). Where else should driver parameters be placed for drivers that have no association with any other bus?

There is also the conundrum of driver parameters for something like advansys that has one host on ISA, another on PCMCIA and a third on PCI (unlikely but possible).

<snip/>

Doug Gilbert

#12 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

Quoted 8 lines · Douglas Gilbert [[email protected]] wrote:

Mike,
I have put scsi_debug's parameters under /bus/scsi/drivers and scsi_debug obviously isn't an upper layer driver. Also I would be tempted to put mid level parameters there (if there were any). Where else should driver parameters be placed for drivers that have no association with any other bus?

Putting driver related attributes under your driver is not wrong. In the patch I sent out I created an artifical bus for scsi_debug. The bus looks similar to a PCI bus. It needs some extensions to allow for adding multiple adapters. This allows scsi_debug to more accurately simulate a pci or other bus adapter. It is also registering as a scsi-host class of drivers.

I have attached an out of an example tree below. I cut a lot of devices to make it fit, but you should still be able to see the layout.

Quoted 3 lines

There is also the conundrum of driver parameters for something like advansys that has one host on ISA, another on PCMCIA and a third on PCI (unlikely but possible).

This might be a better question for Patrick Mochel, but I believe there is nothing that would prevent the driver from registering multiple driver objects on each of the associated buses.

-andmike
--
Michael Anderson
[email protected]

.

|-- bus
|   |-- pci
|   |   |-- devices
|   |   |   |-- 01:03.0 -> ../../../devices/pci1/01:03.0
|   |   |   |-- 01:03.1 -> ../../../devices/pci1/01:03.1
|   |   `-- drivers
|   |       |-- aic7xxx
|   |       |   |-- 01:03.0 -> ../../../../devices/pci1/01:03.0
|   |       |   `-- 01:03.1 -> ../../../../devices/pci1/01:03.1
|   |-- scsi
|   |   |-- devices
|   |   |   |-- 3:0:0:0 -> ../../../devices/pci1/01:03.1/3:0:0:0
|   |   |   |-- 3:0:0:0:gen -> ../../../devices/pci1/01:03.1/3:0:0:0/3:0:0:0:gen
|   |   |   |-- 3:0:4:0 -> ../../../devices/pci1/01:03.1/3:0:4:0
|   |   |   |-- 3:0:4:0:gen -> ../../../devices/pci1/01:03.1/3:0:4:0/3:0:4:0:gen
|   |   |   |-- 4:0:0:0 -> ../../../devices/scsi_dbg_fake/02:05.0/4:0:0:0
|   |   |   |-- 4:0:0:0:gen -> ../../../devices/scsi_dbg_fake/02:05.0/4:0:0:0/4:0:0:0:gen
|   |   `-- drivers
|   |       |-- sd
|   |       |   |-- 3:0:0:0 -> ../../../../devices/pci1/01:03.1/3:0:0:0
|   |       |   |-- 3:0:4:0 -> ../../../../devices/pci1/01:03.1/3:0:4:0
|   |       |   |-- 3:0:5:0 -> ../../../../devices/pci1/01:03.1/3:0:5:0
|   |       |   |-- 4:0:0:0 -> ../../../../devices/scsi_dbg_fake/02:05.0/4:0:0:0
|   |       |-- sg
|   |       |   |-- 3:0:0:0:gen -> ../../../../devices/pci1/01:03.1/3:0:0:0/3:0:0:0:gen
|   |       |   |-- 3:0:4:0:gen -> ../../../../devices/pci1/01:03.1/3:0:4:0/3:0:4:0:gen
|   |       |   |-- 4:0:0:0:gen -> ../../../../devices/scsi_dbg_fake/02:05.0/4:0:0:0/4:0:0:0:gen
|   |-- scsi_dbg_fake
|   |   |-- devices
|   |   |   `-- 02:05.0 -> ../../../devices/scsi_dbg_fake/02:05.0
|   |   `-- drivers
|   |       `-- scsi_debug
|   |           `-- 02:05.0 -> ../../../../devices/scsi_dbg_fake/02:05.0
|-- class
|   `-- scsi-host
|       |-- devices
|       |   `-- 0 -> ../../../devices/scsi_dbg_fake/02:05.0
|       `-- drivers
|-- devices
|   |-- scsi_dbg_fake
|   |   `-- 02:05.0
|   |       `-- 4:0:0:0
|   |           |-- 4:0:0:0:gen
|   |           `-- block -> ../../../../block/sdd
#13 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

In reply to Mike Anderson
Quoted 2 lines · Mike Anderson

Is the disagreement the function name, bus name, or the concept of registering these drivers with sysfs?

Well, they're not really busses, and I hate misleading analogies :)

No, my real issues is that the scsi_devices should be attached to a bus hanging of the HBA, as that's what they physically do, not of some pseudo-bus for the higherlevel devices.

Quoted 1 line

Do you see a problem with "scsi_upper_driver_register" being added now?

I'd prefer if we'd let it stay as-is for now.

#14 lore raw

Re: [PATCH] scsi sysfs update (upper 2/3)

Quoted 10 lines · Christoph Hellwig [[email protected]] wrote:
Quoted 2 lines · Mike Anderson

Is the disagreement the function name, bus name, or the concept of registering these drivers with sysfs?

Well, they're not really busses, and I hate misleading analogies :)

No, my real issues is that the scsi_devices should be attached to a bus hanging of the HBA, as that's what they physically do, not of some pseudo-bus for the higherlevel devices.

The "bus" object and associated functions are key pieces to sysfs integration. The kobjects that I believe the block layer and fs are going to use are less structured, but I believe they are not intended for device to driver relationships.

As I said previously the parent / child relationship of HBA to scsi_device matches your requested connectivity. Though even in the current scsi sub-system we represent targets and luns as siblings which does not exactly match physical connectivity. This same sibling relationship is still present in the sysfs tree. The /bus/scsi/devices is only a logical view with links to the physical. There are other logical view links in the tree that point to these devices also (i.e. under /drivers/xxx/).

Quoted 4 lines
Quoted 1 line

Do you see a problem with "scsi_upper_driver_register" being added now?

I'd prefer if we'd let it stay as-is for now.

ok, I can remove _bus_ from all my wrapper function names, but the intent of these new wrapper functions was to make scsi_bus_type static and control add / removes to the device list. This was to reduce future accidents of adding mixed types and then having someone do a container_of on a non scsi_device object. I could leave the upper level drivers the same and just call a function from scsi_register_device.

-andmike
--
Michael Anderson
[email protected]

#15 lore raw
In reply to Mike Anderson

drivers/scsi/hosts.c line 47

Quoted 8 lines · Mike Anderson

diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c

drivers/scsi/hosts.c +1 -0
@@ -44,6 +44,7 @@
 
 #include "scsi.h"
 #include "hosts.h"
+#include "scsi_sysfs.h"

Do you really need that header? All sysfs functionality is needed by the midlayer and upper layer drivers anyway.

#16 lore raw
Quoted 6 lines · Christoph Hellwig [[email protected]] wrote:
Quoted 5 lines · Mike Anderson

diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c

drivers/scsi/hosts.c +0 -0
@@ -44,6 +44,7 @@
 
Quoted 6 lines

drivers/scsi/hosts.c line 47

Quoted 3 lines
drivers/scsi/hosts.c +1 -0
 #include "scsi.h"
 #include "hosts.h"
+#include "scsi_sysfs.h"

Do you really need that header? All sysfs functionality is needed by the midlayer and upper layer drivers anyway.

It probably does not need to be a extra header file. scsi_sysfs.h could be rolled into scsi.h.

-andmike
--
Michael Anderson
[email protected]

#17 lore raw
Quoted 7 lines · Mike Anderson
Quoted 6 lines · Christoph Hellwig [[email protected]] wrote:
Quoted 3 lines · Mike Anderson

#include "scsi.h"
#include "hosts.h"
+#include "scsi_sysfs.h"

Quoted 5 lines
Quoted 2 lines

Do you really need that header? All sysfs functionality is needed by the midlayer and upper layer drivers anyway.

It probably does not need to be a extra header file. scsi_sysfs.h could be rolled into scsi.h.

You would have to put them in hosts.h though to get inlines that use Scsi_Host.

-- Patrick Mansfield