* [PATCH] scsi sysfs update (base 1/3)
@ 2002-11-07 7:36 Mike Anderson
2002-11-07 7:39 ` [PATCH] scsi sysfs update (upper 2/3) Mike Anderson
2002-11-07 23:28 ` [PATCH] scsi sysfs update (base 1/3) Christoph Hellwig
0 siblings, 2 replies; 18+ messages in thread
From: Mike Anderson @ 2002-11-07 7:36 UTC (permalink / raw)
To: linux-scsi
This patch is against scsi-for-linus-2.5 ChangeSet@1.926.
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
andmike@us.ibm.com
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(-)
------
diff -Nru a/drivers/scsi/Makefile b/drivers/scsi/Makefile
--- a/drivers/scsi/Makefile Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/Makefile Wed Nov 6 23:06:51 2002
@@ -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
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/hosts.c Wed Nov 6 23:06:51 2002
@@ -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);
diff -Nru a/drivers/scsi/hosts.h b/drivers/scsi/hosts.h
--- a/drivers/scsi/hosts.h Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/hosts.h Wed Nov 6 23:06:51 2002
@@ -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 *);
diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/scsi.c Wed Nov 6 23:06:51 2002
@@ -2084,11 +2084,6 @@
scsi_devicelist = tpnt;
up_write(&scsi_devicelist_mutex);
- tpnt->scsi_driverfs_driver.name = (char *)tpnt->tag;
- tpnt->scsi_driverfs_driver.bus = &scsi_driverfs_bus_type;
-
- driver_register(&tpnt->scsi_driverfs_driver);
-
/*
* First scan the devices that we know about, and see if we notice them.
*/
@@ -2335,33 +2330,7 @@
mempool_free(sgl, sgp->pool);
}
-static int scsi_bus_match(struct device *scsi_driverfs_dev,
- struct device_driver *scsi_driverfs_drv)
-{
- char *p=0;
-
- if (!strcmp("sd", scsi_driverfs_drv->name)) {
- if ((p = strstr(scsi_driverfs_dev->bus_id, ":disc")) ||
- (p = strstr(scsi_driverfs_dev->bus_id, ":p"))) {
- return 1;
- }
- } else if (!strcmp("sg", scsi_driverfs_drv->name)) {
- if (strstr(scsi_driverfs_dev->bus_id, ":gen"))
- return 1;
- } else if (!strcmp("sr",scsi_driverfs_drv->name)) {
- if (strstr(scsi_driverfs_dev->bus_id,":cd"))
- return 1;
- } else if (!strcmp("st",scsi_driverfs_drv->name)) {
- if (strstr(scsi_driverfs_dev->bus_id,":mt"))
- return 1;
- }
- return 0;
-}
-
-struct bus_type scsi_driverfs_bus_type = {
- name: "scsi",
- match: scsi_bus_match,
-};
+extern int scsi_sysfs_register(void);
static int __init init_scsi(void)
{
@@ -2408,7 +2377,7 @@
scsi_host_hn_init(scsihosts);
- bus_register(&scsi_driverfs_bus_type);
+ scsi_sysfs_register();
/* Where we handle work queued by scsi_done */
open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL);
@@ -2416,12 +2385,16 @@
return 0;
}
+extern void scsi_sysfs_unregister(void);
+
static void __exit exit_scsi(void)
{
int i;
devfs_unregister (scsi_devfs_handle);
+ scsi_sysfs_unregister();
+
scsi_host_hn_release();
#ifdef CONFIG_PROC_FS
@@ -2439,7 +2412,7 @@
}
}
-module_init(init_scsi);
+subsys_initcall(init_scsi);
module_exit(exit_scsi);
/*
diff -Nru a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h
--- a/drivers/scsi/scsi.h Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/scsi.h Wed Nov 6 23:06:51 2002
@@ -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
diff -Nru a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
--- a/drivers/scsi/scsi_scan.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/scsi_scan.c Wed Nov 6 23:06:51 2002
@@ -33,6 +33,7 @@
#include "scsi.h"
#include "hosts.h"
+#include "scsi_sysfs.h"
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@@ -306,72 +307,6 @@
SCSI_TIMEOUT, 3);
}
-/**
- * scsi_device_type_read - copy out the SCSI type
- * @driverfs_dev: driverfs device to check
- * @page: copy data into this area
- * @count: number of bytes to copy
- * @off: start at this offset in page
- *
- * Description:
- * Called via driverfs when the "type" (in scsi_device_type_file)
- * field is read. Copy the appropriate SCSI type string into @page,
- * followed by a newline and a '\0'. Go through gyrations so we don't
- * write more than @count, and we don't write past @off.
- *
- * Notes:
- * This is for the top-most scsi entry in driverfs, the upper-level
- * drivers have their own type file. XXX This is not part of scanning,
- * other than we reference the attr struct in this file, move to
- * scsi.c or scsi_lib.c.
- *
- * Return:
- * number of bytes written into page.
- **/
-static ssize_t scsi_device_type_read(struct device *driverfs_dev, char *page,
- size_t count, loff_t off)
-{
- struct scsi_device *sdev = to_scsi_device(driverfs_dev);
- const char *type;
- size_t size, len;
-
- if ((sdev->type > MAX_SCSI_DEVICE_CODE) ||
- (scsi_device_types[(int)sdev->type] == NULL))
- type = "Unknown";
- else
- type = scsi_device_types[(int)sdev->type];
- size = strlen(type);
- /*
- * Check if off is past size + 1 for newline + 1 for a '\0'.
- */
- if (off >= (size + 2))
- return 0;
- if (size > off) {
- len = min((size_t) (size - off), count);
- memcpy(page + off, type + off, len);
- } else
- len = 0;
- if (((len + off) == size) && (len < count))
- /*
- * We are at the end of the string and have space, add a
- * new line.
- */
- *(page + off + len++) = '\n';
- if (((len + off) == (size + 1)) && (len < count))
- /*
- * We are past the newline and have space, add a
- * terminating '\0'.
- */
- *(page + off + len++) = '\0';
- return len;
-}
-
-/*
- * Create dev_attr_type. This is different from the dev_attr_type in scsi
- * upper level drivers.
- */
-static DEVICE_ATTR(type,S_IRUGO,scsi_device_type_read,NULL);
-
/**
* print_inquiry - printk the inquiry information
@@ -1431,19 +1366,7 @@
*/
scsi_load_identifier(sdev, sreq);
- /*
- * create driverfs files
- */
- sprintf(sdev->sdev_driverfs_dev.bus_id,"%d:%d:%d:%d",
- sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
- sdev->sdev_driverfs_dev.parent = &sdev->host->host_driverfs_dev;
- sdev->sdev_driverfs_dev.bus = &scsi_driverfs_bus_type;
- device_register(&sdev->sdev_driverfs_dev);
-
- /*
- * Create driverfs file entries
- */
- device_create_file(&sdev->sdev_driverfs_dev, &dev_attr_type);
+ scsi_bus_device_register(sdev);
sprintf(devname, "host%d/bus%d/target%d/lun%d",
sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
diff -Nru a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c
--- a/drivers/scsi/scsi_syms.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/scsi_syms.c Wed Nov 6 23:06:51 2002
@@ -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);
diff -Nru a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/scsi_sysfs.c Wed Nov 6 23:06:51 2002
@@ -0,0 +1,290 @@
+/*
+ * scsi_sysfs.c
+ *
+ * SCSI sysfs interface routines.
+ *
+ * Created to pull SCSI mid layer sysfs routines into one file.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include "scsi_sysfs.h"
+
+/**
+ * scsi_host_class_name_show - copy out the SCSI host name
+ * @dev: device to check
+ * @page: copy data into this area
+ * @count: number of bytes to copy
+ * @off: start at this offset in page
+ * Return:
+ * number of bytes written into page.
+ **/
+static ssize_t scsi_host_class_name_show(struct device *dev, char *page,
+ size_t count, loff_t off)
+{
+ struct Scsi_Host *shost;
+
+ if (off)
+ return 0;
+
+ shost = scsi_class_data_get(dev);
+
+ return snprintf(page, count, "scsi%d\n", shost->host_no);
+}
+
+DEVICE_ATTR(class_name, S_IRUGO, scsi_host_class_name_show, NULL);
+
+static int scsi_host_class_add_dev(struct device * dev)
+{
+ device_create_file(dev, &dev_attr_class_name);
+ return 0;
+}
+
+static void scsi_host_class_rm_dev(struct device * dev)
+{
+ device_remove_file(dev, &dev_attr_class_name);
+}
+
+struct device_class shost_devclass = {
+ .name = "scsi-host",
+ .add_device = scsi_host_class_add_dev,
+ .remove_device = scsi_host_class_rm_dev,
+};
+
+/**
+ * scsi_bus_match:
+ * @dev:
+ * @dev_driver:
+ *
+ * Return value:
+ **/
+static int scsi_bus_match(struct device *dev,
+ struct device_driver *dev_driver)
+{
+ if (!strcmp("sg", dev_driver->name)) {
+ if (strstr(dev->bus_id, ":gen"))
+ return 1;
+ } else if (!strcmp("st",dev_driver->name)) {
+ if (strstr(dev->bus_id,":mt"))
+ return 1;
+ } else if (!strcmp("sd", dev_driver->name)) {
+ if ((!strstr(dev->bus_id, ":gen")) &&
+ (!strstr(dev->bus_id, ":mt"))) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#ifdef CONFIG_HOTPLUG
+
+/**
+ * scsi_bus_hotplug:
+ * @dev:
+ * @envp:
+ * @num_envp:
+ * @buffer:
+ * @buffer_size:
+ *
+ * Return value:
+ **/
+static int scsi_bus_hotplug (struct device *dev, char **envp,
+ int num_envp, char *buffer, int buffer_size)
+{
+ struct scsi_device *sdev;
+ char *scratch;
+ int i = 0;
+ int length = 0;
+
+ if (!dev)
+ return -ENODEV;
+
+ if (strstr(dev->bus_id, ":gen")) /*Hack for sg devices*/
+ return -ENODEV;
+
+ sdev = to_scsi_device(dev);
+
+ scratch = buffer;
+
+ envp [i++] = scratch;
+ length += snprintf (scratch, buffer_size - length, "PRODUCT=%s/%s/%s",
+ sdev->vendor,
+ sdev->model,
+ sdev->rev);
+ if ((buffer_size - length <= 0) || (i >= num_envp))
+ return -ENOMEM;
+ ++length;
+ scratch += length;
+
+ envp [i++] = 0;
+
+ return 0;
+}
+
+#else
+
+static int scsi_bus_hotplug (struct device *dev, char **envp,
+ int num_envp, char *buffer, int buffer_size)
+{
+ return -ENODEV;
+}
+
+#endif /* CONFIG_HOTPLUG */
+
+static struct bus_type scsi_bus_type = {
+ .name = "scsi",
+ .match = scsi_bus_match,
+ .hotplug = scsi_bus_hotplug,
+};
+
+
+int scsi_sysfs_register(void)
+{
+ bus_register(&scsi_bus_type);
+ devclass_register(&shost_devclass);
+
+ return 0;
+}
+
+void scsi_sysfs_unregister(void)
+{
+ devclass_unregister(&shost_devclass);
+ bus_unregister(&scsi_bus_type);
+}
+
+/**
+ * scsi_bus_driver_register - register upper level driver.
+ * @sdev_tp: Upper level driver to register with the scsi bus.
+ *
+ * Return value:
+ * 0 on Success / non-zero on Failure
+ **/
+int scsi_bus_driver_register(struct Scsi_Device_Template *sdev_tp)
+{
+ int error = 0;
+
+ error = scsi_register_device(sdev_tp);
+ if (error)
+ return error;
+ sdev_tp->scsi_driverfs_driver.bus = &scsi_bus_type;
+ error = driver_register(&sdev_tp->scsi_driverfs_driver);
+
+ return error;
+}
+
+/**
+ * scsi_bus_driver_unregister - unregister upper level driver
+ * @sdev_tp: Upper level driver to unregister with the scsi bus.
+ *
+ **/
+void scsi_bus_driver_unregister(struct Scsi_Device_Template *sdev_tp)
+{
+ driver_unregister(&sdev_tp->scsi_driverfs_driver);
+ scsi_unregister_device(sdev_tp);
+}
+
+
+/**
+ * scsi_device_type_read - copy out the SCSI type
+ * @dev: device to check
+ * @page: copy data into this area
+ * @count: number of bytes to copy
+ * @off: start at this offset in page
+ *
+ * Return:
+ * number of bytes written into page.
+ **/
+static ssize_t scsi_device_type_read(struct device *dev, char *page,
+ size_t count, loff_t off)
+{
+ struct scsi_device *sdev = to_scsi_device(dev);
+ const char *type;
+
+ if (off)
+ return 0;
+
+ if ((sdev->type > MAX_SCSI_DEVICE_CODE) ||
+ (scsi_device_types[(int)sdev->type] == NULL))
+ type = "Unknown";
+ else
+ type = scsi_device_types[(int)sdev->type];
+
+ return snprintf(page, count, "%s\n", type);
+}
+
+/*
+ * Create dev_attr_type. This is different from the dev_attr_type in scsi
+ * upper level drivers.
+ */
+static DEVICE_ATTR(type,S_IRUGO,scsi_device_type_read,NULL);
+
+/**
+ * scsi_bus_device_register - register a scsi device with the scsi bus
+ * @sdev: scsi_device to register
+ *
+ * Return value:
+ * 0 on Success / non-zero on Failure
+ **/
+int scsi_bus_device_register(struct scsi_device *sdev)
+{
+ int error = 0;
+
+ sprintf(sdev->sdev_driverfs_dev.bus_id,"%d:%d:%d:%d",
+ sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
+ sdev->sdev_driverfs_dev.parent = sdev->host->host_driverfs_dev;
+ sdev->sdev_driverfs_dev.bus = &scsi_bus_type;
+
+ error = device_register(&sdev->sdev_driverfs_dev);
+ if (error)
+ return error;
+
+ error = device_create_file(&sdev->sdev_driverfs_dev, &dev_attr_type);
+ if (error)
+ device_unregister(&sdev->sdev_driverfs_dev);
+
+ return error;
+}
+
+/**
+ * scsi_bus_device_unregister - unregister a device from the scsi bus
+ * @sdev: scsi_device to unregister
+ **/
+void scsi_bus_device_unregister(struct scsi_device *sdev)
+{
+ device_remove_file(&sdev->sdev_driverfs_dev, &dev_attr_type);
+ device_unregister(&sdev->sdev_driverfs_dev);
+}
+
+/**
+ * scsi_host_class_register - register class scsi host
+ * @dev: class device to register
+ * @shost: scsi host associtated with class device
+ *
+ * Return value:
+ **/
+int scsi_host_class_register(struct device *dev, struct Scsi_Host *shost)
+{
+ scsi_class_data_set(dev, shost);
+ scsi_host_dev_set(shost, dev);
+
+ scsi_add_host(shost);
+
+ return 0;
+}
+
+/**
+ * scsi_host_class_unregister - unregister class scsi host.
+ * @dev: class device to unregister
+ **/
+void scsi_host_class_unregister(struct device *dev)
+{
+ struct Scsi_Host *shost;
+
+ shost = scsi_class_data_get(dev);
+
+ scsi_remove_host(shost);
+
+ scsi_class_data_set(dev, NULL);
+
+}
diff -Nru a/drivers/scsi/scsi_sysfs.h b/drivers/scsi/scsi_sysfs.h
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/scsi_sysfs.h Wed Nov 6 23:06:51 2002
@@ -0,0 +1,50 @@
+/*
+ * scsi_sysfs.h
+ *
+ * SCSI sysfs interface routines.
+ *
+ * Created to pull SCSI mid layer sysfs routines into one file.
+ * October 24, 2002 Mike Anderson (andmike@us.ibm.com)
+ */
+#ifndef _SCSI_SYSFS_H
+#define _SCSI_SYSFS_H
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/blk.h> /* for struct request */
+#include <linux/device.h> /* for struct device */
+
+#include "scsi.h"
+#include "hosts.h"
+
+extern int scsi_sysfs_register(void);
+extern void scsi_sysfs_unregister(void);
+extern int scsi_bus_driver_register(struct Scsi_Device_Template *);
+extern void scsi_bus_driver_unregister(struct Scsi_Device_Template *);
+extern int scsi_bus_device_register(struct scsi_device *);
+extern void scsi_bus_device_unregister(struct scsi_device *);
+extern int scsi_host_class_register(struct device *, struct Scsi_Host *);
+extern void scsi_host_class_unregister(struct device *);
+
+extern struct device_class shost_devclass;
+
+static inline void scsi_host_dev_set(struct Scsi_Host *shost,
+ struct device *dev)
+{
+ shost->host_driverfs_dev = dev;
+}
+
+static inline void scsi_class_data_set(struct device *dev,
+ struct Scsi_Host *host)
+{
+ dev->class_data = (void *)host;
+};
+
+static inline struct Scsi_Host *scsi_class_data_get(struct device *dev)
+{
+ return (struct Scsi_Host *) dev->class_data;
+};
+
+#endif /* __KERNEL__ */
+#endif
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH] scsi sysfs update (upper 2/3)
2002-11-07 7:36 [PATCH] scsi sysfs update (base 1/3) Mike Anderson
@ 2002-11-07 7:39 ` Mike Anderson
2002-11-07 7:42 ` [PATCH] scsi sysfs update (scsi_debug 3/3) Mike Anderson
2002-11-07 23:29 ` [PATCH] scsi sysfs update (upper 2/3) Christoph Hellwig
2002-11-07 23:28 ` [PATCH] scsi sysfs update (base 1/3) Christoph Hellwig
1 sibling, 2 replies; 18+ messages in thread
From: Mike Anderson @ 2002-11-07 7:39 UTC (permalink / raw)
To: linux-scsi
This patch is against scsi-for-linus-2.5 ChangeSet@1.926.
[upper level]
- Minor changes to Scsi_Device_Template init.
- Change template registration / deregistration functions.
-andmike
--
Michael Anderson
andmike@us.ibm.com
sd.c | 10 ++++++----
sg.c | 13 ++++++++-----
sr.c | 10 +++++++---
st.c | 15 +++++++++------
4 files changed, 30 insertions(+), 18 deletions(-)
------
diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/sd.c Wed Nov 6 23:06:51 2002
@@ -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);
}
/*
diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
--- a/drivers/scsi/sg.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/sg.c Wed Nov 6 23:06:51 2002
@@ -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);
diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c
--- a/drivers/scsi/sr.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/sr.c Wed Nov 6 23:06:51 2002
@@ -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");
}
diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/st.c Wed Nov 6 23:06:51 2002
@@ -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)
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH] scsi sysfs update (scsi_debug 3/3)
2002-11-07 7:39 ` [PATCH] scsi sysfs update (upper 2/3) Mike Anderson
@ 2002-11-07 7:42 ` Mike Anderson
2002-11-07 23:30 ` Christoph Hellwig
2002-11-07 23:29 ` [PATCH] scsi sysfs update (upper 2/3) Christoph Hellwig
1 sibling, 1 reply; 18+ messages in thread
From: Mike Anderson @ 2002-11-07 7:42 UTC (permalink / raw)
To: linux-scsi
This patch is against scsi-for-linus-2.5 ChangeSet@1.926.
[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
andmike@us.ibm.com
scsi_debug.c | 292 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 224 insertions(+), 68 deletions(-)
------
diff -Nru a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
--- a/drivers/scsi/scsi_debug.c Wed Nov 6 23:06:51 2002
+++ b/drivers/scsi/scsi_debug.c Wed Nov 6 23:06:51 2002
@@ -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
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH] scsi sysfs update (scsi_debug 3/3)
2002-11-07 7:42 ` [PATCH] scsi sysfs update (scsi_debug 3/3) Mike Anderson
@ 2002-11-07 23:30 ` Christoph Hellwig
2002-11-07 16:33 ` Mike Anderson
0 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2002-11-07 23:30 UTC (permalink / raw)
To: Mike Anderson; +Cc: linux-scsi
On Wed, Nov 06, 2002 at 11:42:22PM -0800, Mike Anderson wrote:
> -#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?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (scsi_debug 3/3)
2002-11-07 23:30 ` Christoph Hellwig
@ 2002-11-07 16:33 ` Mike Anderson
2002-11-07 23:35 ` Douglas Gilbert
0 siblings, 1 reply; 18+ messages in thread
From: Mike Anderson @ 2002-11-07 16:33 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-scsi
Christoph Hellwig [hch@sgi.com] wrote:
> On Wed, Nov 06, 2002 at 11:42:22PM -0800, Mike Anderson wrote:
> > -#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
andmike@us.ibm.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (scsi_debug 3/3)
2002-11-07 16:33 ` Mike Anderson
@ 2002-11-07 23:35 ` Douglas Gilbert
2002-11-08 2:30 ` Christoph Hellwig
0 siblings, 1 reply; 18+ messages in thread
From: Douglas Gilbert @ 2002-11-07 23:35 UTC (permalink / raw)
To: Mike Anderson; +Cc: Christoph Hellwig, linux-scsi
Mike Anderson wrote:
> Christoph Hellwig [hch@sgi.com] wrote:
>
>>On Wed, Nov 06, 2002 at 11:42:22PM -0800, Mike Anderson wrote:
>>
>>>-#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.
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
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH] scsi sysfs update (scsi_debug 3/3)
2002-11-07 23:35 ` Douglas Gilbert
@ 2002-11-08 2:30 ` Christoph Hellwig
0 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2002-11-08 2:30 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: Mike Anderson, linux-scsi
On Fri, Nov 08, 2002 at 10:35:06AM +1100, Douglas Gilbert wrote:
> BTW Is the 256 minors limit history yet in 2.5?
No. but for blockdevices minors are basically meaningless now.
> 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.
> 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).
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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-07 7:39 ` [PATCH] scsi sysfs update (upper 2/3) Mike Anderson
2002-11-07 7:42 ` [PATCH] scsi sysfs update (scsi_debug 3/3) Mike Anderson
@ 2002-11-07 23:29 ` Christoph Hellwig
2002-11-07 16:41 ` Mike Anderson
1 sibling, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2002-11-07 23:29 UTC (permalink / raw)
To: Mike Anderson; +Cc: linux-scsi
On Wed, Nov 06, 2002 at 11:39:43PM -0800, Mike Anderson wrote:
> + .scsi_driverfs_driver = {
> + .name = "sd",
> + },
can we changhe scsi_driverfs_driver to something saner? E.g. gen_driver?
> 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);
Umm, no. We don't register a bus. Just leave the name unchanged until
we there is some commonly agreed upon upper layer terminology.
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-07 23:29 ` [PATCH] scsi sysfs update (upper 2/3) Christoph Hellwig
@ 2002-11-07 16:41 ` Mike Anderson
2002-11-08 1:20 ` Christoph Hellwig
0 siblings, 1 reply; 18+ messages in thread
From: Mike Anderson @ 2002-11-07 16:41 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-scsi
Christoph Hellwig [hch@sgi.com] wrote:
> On Wed, Nov 06, 2002 at 11:39:43PM -0800, Mike Anderson wrote:
> > + .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 :-).
> > 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);
>
> 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
andmike@us.ibm.com
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-07 16:41 ` Mike Anderson
@ 2002-11-08 1:20 ` Christoph Hellwig
2002-11-08 2:21 ` Mike Anderson
0 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2002-11-08 1:20 UTC (permalink / raw)
To: Mike Anderson; +Cc: linux-scsi
On Thu, Nov 07, 2002 at 08:41:52AM -0800, Mike Anderson wrote:
> > > - 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.
> 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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-08 1:20 ` Christoph Hellwig
@ 2002-11-08 2:21 ` Mike Anderson
2002-11-08 3:34 ` Douglas Gilbert
2002-11-08 4:53 ` Christoph Hellwig
0 siblings, 2 replies; 18+ messages in thread
From: Mike Anderson @ 2002-11-08 2:21 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-scsi
Christoph Hellwig [hch@infradead.org] wrote:
> On Thu, Nov 07, 2002 at 08:41:52AM -0800, Mike Anderson wrote:
> > > > - 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.
>
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.
> > 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
andmike@us.ibm.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-08 2:21 ` Mike Anderson
@ 2002-11-08 3:34 ` Douglas Gilbert
2002-11-08 4:13 ` Mike Anderson
2002-11-08 4:53 ` Christoph Hellwig
1 sibling, 1 reply; 18+ messages in thread
From: Douglas Gilbert @ 2002-11-08 3:34 UTC (permalink / raw)
To: Mike Anderson; +Cc: linux-scsi
Mike Anderson wrote:
> Christoph Hellwig [hch@infradead.org] wrote:
>
>>On Thu, Nov 07, 2002 at 08:41:52AM -0800, Mike Anderson wrote:
>>
>>>>>- 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.
>>
>
>
> 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.
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-08 3:34 ` Douglas Gilbert
@ 2002-11-08 4:13 ` Mike Anderson
0 siblings, 0 replies; 18+ messages in thread
From: Mike Anderson @ 2002-11-08 4:13 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: linux-scsi
Douglas Gilbert [dougg@torque.net] 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.
> 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
andmike@us.ibm.com
.
|-- 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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-08 2:21 ` Mike Anderson
2002-11-08 3:34 ` Douglas Gilbert
@ 2002-11-08 4:53 ` Christoph Hellwig
2002-11-08 5:41 ` Mike Anderson
1 sibling, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2002-11-08 4:53 UTC (permalink / raw)
To: Mike Anderson; +Cc: linux-scsi
On Thu, Nov 07, 2002 at 06:21:58PM -0800, Mike Anderson wrote:
> 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.
> 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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (upper 2/3)
2002-11-08 4:53 ` Christoph Hellwig
@ 2002-11-08 5:41 ` Mike Anderson
0 siblings, 0 replies; 18+ messages in thread
From: Mike Anderson @ 2002-11-08 5:41 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-scsi
Christoph Hellwig [hch@infradead.org] wrote:
> On Thu, Nov 07, 2002 at 06:21:58PM -0800, Mike Anderson wrote:
> > 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/).
> > 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
andmike@us.ibm.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (base 1/3)
2002-11-07 7:36 [PATCH] scsi sysfs update (base 1/3) Mike Anderson
2002-11-07 7:39 ` [PATCH] scsi sysfs update (upper 2/3) Mike Anderson
@ 2002-11-07 23:28 ` Christoph Hellwig
2002-11-07 17:01 ` Mike Anderson
1 sibling, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2002-11-07 23:28 UTC (permalink / raw)
To: Mike Anderson; +Cc: linux-scsi
On Wed, Nov 06, 2002 at 11:36:19PM -0800, Mike Anderson wrote:
> diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> --- a/drivers/scsi/hosts.c Wed Nov 6 23:06:51 2002
> +++ b/drivers/scsi/hosts.c Wed Nov 6 23:06:51 2002
> @@ -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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (base 1/3)
2002-11-07 23:28 ` [PATCH] scsi sysfs update (base 1/3) Christoph Hellwig
@ 2002-11-07 17:01 ` Mike Anderson
2002-11-07 17:22 ` Patrick Mansfield
0 siblings, 1 reply; 18+ messages in thread
From: Mike Anderson @ 2002-11-07 17:01 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-scsi
Christoph Hellwig [hch@sgi.com] wrote:
> On Wed, Nov 06, 2002 at 11:36:19PM -0800, Mike Anderson wrote:
> > diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> > --- a/drivers/scsi/hosts.c Wed Nov 6 23:06:51 2002
> > +++ b/drivers/scsi/hosts.c Wed Nov 6 23:06:51 2002
> > @@ -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.
It probably does not need to be a extra header file. scsi_sysfs.h
could be rolled into scsi.h.
-andmike
--
Michael Anderson
andmike@us.ibm.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] scsi sysfs update (base 1/3)
2002-11-07 17:01 ` Mike Anderson
@ 2002-11-07 17:22 ` Patrick Mansfield
0 siblings, 0 replies; 18+ messages in thread
From: Patrick Mansfield @ 2002-11-07 17:22 UTC (permalink / raw)
To: Mike Anderson; +Cc: Christoph Hellwig, linux-scsi
On Thu, Nov 07, 2002 at 09:01:21AM -0800, Mike Anderson wrote:
> Christoph Hellwig [hch@sgi.com] wrote:
> > On Wed, Nov 06, 2002 at 11:36:19PM -0800, Mike Anderson wrote:
> > > #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.
You would have to put them in hosts.h though to get inlines that
use Scsi_Host.
-- Patrick Mansfield
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2002-11-08 5:41 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-07 7:36 [PATCH] scsi sysfs update (base 1/3) Mike Anderson
2002-11-07 7:39 ` [PATCH] scsi sysfs update (upper 2/3) Mike Anderson
2002-11-07 7:42 ` [PATCH] scsi sysfs update (scsi_debug 3/3) Mike Anderson
2002-11-07 23:30 ` Christoph Hellwig
2002-11-07 16:33 ` Mike Anderson
2002-11-07 23:35 ` Douglas Gilbert
2002-11-08 2:30 ` Christoph Hellwig
2002-11-07 23:29 ` [PATCH] scsi sysfs update (upper 2/3) Christoph Hellwig
2002-11-07 16:41 ` Mike Anderson
2002-11-08 1:20 ` Christoph Hellwig
2002-11-08 2:21 ` Mike Anderson
2002-11-08 3:34 ` Douglas Gilbert
2002-11-08 4:13 ` Mike Anderson
2002-11-08 4:53 ` Christoph Hellwig
2002-11-08 5:41 ` Mike Anderson
2002-11-07 23:28 ` [PATCH] scsi sysfs update (base 1/3) Christoph Hellwig
2002-11-07 17:01 ` Mike Anderson
2002-11-07 17:22 ` Patrick Mansfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox