All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] scsi_debug cleanup
@ 2008-03-02  9:30 FUJITA Tomonori
  2008-03-02  9:30 ` [PATCH 1/4] scsi_debug: stop including drivers/scsi/scsi.h FUJITA Tomonori
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2008-03-02  9:30 UTC (permalink / raw)
  To: linux-scsi; +Cc: tomof, Douglas Gilbert, James Bottomley

Here's minor cleanup of scsi_debug driver. This is against scsi-misc.



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

* [PATCH 1/4] scsi_debug: stop including drivers/scsi/scsi.h
  2008-03-02  9:30 [PATCH 0/4] scsi_debug cleanup FUJITA Tomonori
@ 2008-03-02  9:30 ` FUJITA Tomonori
  2008-03-02  9:30   ` [PATCH 2/4] scsi_debug: remove scsi_debug.h FUJITA Tomonori
  2008-03-02 16:04 ` [PATCH 0/4] scsi_debug cleanup Douglas Gilbert
  2008-03-04 18:21 ` [PATCH] scsi_debug: publish support for sg-chaining Boaz Harrosh
  2 siblings, 1 reply; 8+ messages in thread
From: FUJITA Tomonori @ 2008-03-02  9:30 UTC (permalink / raw)
  To: linux-scsi; +Cc: tomof, FUJITA Tomonori, Douglas Gilbert, James Bottomley

This converts scsi_debug to include header files in include/scsi/
instead of drivers/scsi/scsi.h.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Douglas Gilbert <dougg@torque.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 drivers/scsi/scsi_debug.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index d1777a9..c19a2d6 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -39,9 +39,11 @@
 #include <linux/vmalloc.h>
 #include <linux/moduleparam.h>
 #include <linux/scatterlist.h>
-
 #include <linux/blkdev.h>
-#include "scsi.h"
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsicam.h>
 
-- 
1.5.3.7


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

* [PATCH 2/4] scsi_debug: remove scsi_debug.h
  2008-03-02  9:30 ` [PATCH 1/4] scsi_debug: stop including drivers/scsi/scsi.h FUJITA Tomonori
@ 2008-03-02  9:30   ` FUJITA Tomonori
  2008-03-02  9:30     ` [PATCH 3/4] scsi_debug: remove unnecessary checking FUJITA Tomonori
  0 siblings, 1 reply; 8+ messages in thread
From: FUJITA Tomonori @ 2008-03-02  9:30 UTC (permalink / raw)
  To: linux-scsi; +Cc: tomof, FUJITA Tomonori, Douglas Gilbert, James Bottomley

scsi_debug.h just incldues some function declarations. This patch removes it
with moving the scsi_host_template.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Douglas Gilbert <dougg@torque.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 drivers/scsi/scsi_debug.c |   58 +++++++++++++++++++++++---------------------
 drivers/scsi/scsi_debug.h |   24 ------------------
 2 files changed, 30 insertions(+), 52 deletions(-)
 delete mode 100644 drivers/scsi/scsi_debug.h

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index c19a2d6..c10234f 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -50,7 +50,6 @@
 #include <linux/stat.h>
 
 #include "scsi_logging.h"
-#include "scsi_debug.h"
 
 #define SCSI_DEBUG_VERSION "1.81"
 static const char * scsi_debug_version_date = "20070104";
@@ -167,6 +166,9 @@ static int sdebug_sectors_per;		/* sectors per cylinder */
 
 #define SDEBUG_SENSE_LEN 32
 
+#define SCSI_DEBUG_CANQUEUE  255
+#define SCSI_DEBUG_MAX_CMD_LEN 16
+
 struct sdebug_dev_info {
 	struct list_head dev_list;
 	unsigned char sense_buff[SDEBUG_SENSE_LEN];	/* weak nexus */
@@ -204,30 +206,6 @@ struct sdebug_queued_cmd {
 };
 static struct sdebug_queued_cmd queued_arr[SCSI_DEBUG_CANQUEUE];
 
-static struct scsi_host_template sdebug_driver_template = {
-	.proc_info =		scsi_debug_proc_info,
-	.name =			"SCSI DEBUG",
-	.info =			scsi_debug_info,
-	.slave_alloc =		scsi_debug_slave_alloc,
-	.slave_configure =	scsi_debug_slave_configure,
-	.slave_destroy =	scsi_debug_slave_destroy,
-	.ioctl =		scsi_debug_ioctl,
-	.queuecommand =		scsi_debug_queuecommand,
-	.eh_abort_handler =	scsi_debug_abort,
-	.eh_bus_reset_handler = scsi_debug_bus_reset,
-	.eh_device_reset_handler = scsi_debug_device_reset,
-	.eh_host_reset_handler = scsi_debug_host_reset,
-	.bios_param =		scsi_debug_biosparam,
-	.can_queue =		SCSI_DEBUG_CANQUEUE,
-	.this_id =		7,
-	.sg_tablesize =		256,
-	.cmd_per_lun =		16,
-	.max_sectors =		0xffff,
-	.unchecked_isa_dma = 	0,
-	.use_clustering = 	DISABLE_CLUSTERING,
-	.module =		THIS_MODULE,
-};
-
 static unsigned char * fake_storep;	/* ramdisk storage */
 
 static int num_aborts = 0;
@@ -376,7 +354,8 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)
 			printk("%02x ", (int)cmd[k]);
 		printk("\n");
 	}
-        if(target == sdebug_driver_template.this_id) {
+
+	if (target == SCpnt->device->host->hostt->this_id) {
 		printk(KERN_INFO "scsi_debug: initiator's id used as "
 		       "target!\n");
 		return schedule_resp(SCpnt, NULL, done,
@@ -2924,8 +2903,6 @@ static int __init scsi_debug_init(void)
 
 	init_all_queued();
 
-	sdebug_driver_template.proc_name = sdebug_proc_name;
-
 	host_to_add = scsi_debug_add_host;
         scsi_debug_add_host = 0;
 
@@ -3085,6 +3062,31 @@ static void sdebug_remove_adapter(void)
         --scsi_debug_add_host;
 }
 
+static struct scsi_host_template sdebug_driver_template = {
+	.proc_info =		scsi_debug_proc_info,
+	.proc_name =		sdebug_proc_name,
+	.name =			"SCSI DEBUG",
+	.info =			scsi_debug_info,
+	.slave_alloc =		scsi_debug_slave_alloc,
+	.slave_configure =	scsi_debug_slave_configure,
+	.slave_destroy =	scsi_debug_slave_destroy,
+	.ioctl =		scsi_debug_ioctl,
+	.queuecommand =		scsi_debug_queuecommand,
+	.eh_abort_handler =	scsi_debug_abort,
+	.eh_bus_reset_handler = scsi_debug_bus_reset,
+	.eh_device_reset_handler = scsi_debug_device_reset,
+	.eh_host_reset_handler = scsi_debug_host_reset,
+	.bios_param =		scsi_debug_biosparam,
+	.can_queue =		SCSI_DEBUG_CANQUEUE,
+	.this_id =		7,
+	.sg_tablesize =		256,
+	.cmd_per_lun =		16,
+	.max_sectors =		0xffff,
+	.unchecked_isa_dma = 	0,
+	.use_clustering = 	DISABLE_CLUSTERING,
+	.module =		THIS_MODULE,
+};
+
 static int sdebug_driver_probe(struct device * dev)
 {
         int error = 0;
diff --git a/drivers/scsi/scsi_debug.h b/drivers/scsi/scsi_debug.h
deleted file mode 100644
index 965dd5e..0000000
--- a/drivers/scsi/scsi_debug.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _SCSI_DEBUG_H
-
-#include <linux/types.h>
-
-static int scsi_debug_slave_alloc(struct scsi_device *);
-static int scsi_debug_slave_configure(struct scsi_device *);
-static void scsi_debug_slave_destroy(struct scsi_device *);
-static int scsi_debug_queuecommand(struct scsi_cmnd *,
-				   void (*done) (struct scsi_cmnd *));
-static int scsi_debug_ioctl(struct scsi_device *, int, void __user *);
-static int scsi_debug_biosparam(struct scsi_device *, struct block_device *,
-		sector_t, int[]);
-static int scsi_debug_abort(struct scsi_cmnd *);
-static int scsi_debug_bus_reset(struct scsi_cmnd *);
-static int scsi_debug_device_reset(struct scsi_cmnd *);
-static int scsi_debug_host_reset(struct scsi_cmnd *);
-static int scsi_debug_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
-static const char * scsi_debug_info(struct Scsi_Host *);
-
-#define SCSI_DEBUG_CANQUEUE  255 	/* needs to be >= 1 */
-
-#define SCSI_DEBUG_MAX_CMD_LEN 16
-
-#endif
-- 
1.5.3.7


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

* [PATCH 3/4] scsi_debug: remove unnecessary checking
  2008-03-02  9:30   ` [PATCH 2/4] scsi_debug: remove scsi_debug.h FUJITA Tomonori
@ 2008-03-02  9:30     ` FUJITA Tomonori
  2008-03-02  9:30       ` [PATCH 4/4] scsi_debug: use shost_priv macro FUJITA Tomonori
  0 siblings, 1 reply; 8+ messages in thread
From: FUJITA Tomonori @ 2008-03-02  9:30 UTC (permalink / raw)
  To: linux-scsi; +Cc: tomof, FUJITA Tomonori, Douglas Gilbert, James Bottomley

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Douglas Gilbert <dougg@torque.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 drivers/scsi/scsi_debug.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index c10234f..f70df03 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -344,9 +344,6 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)
 	int inj_transport = 0;
 	int delay_override = 0;
 
-	if (done == NULL)
-		return 0;	/* assume mid level reprocessing command */
-
 	scsi_set_resid(SCpnt, 0);
 	if ((SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) && cmd) {
 		printk(KERN_INFO "scsi_debug: cmd ");
-- 
1.5.3.7


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

* [PATCH 4/4] scsi_debug: use shost_priv macro
  2008-03-02  9:30     ` [PATCH 3/4] scsi_debug: remove unnecessary checking FUJITA Tomonori
@ 2008-03-02  9:30       ` FUJITA Tomonori
  0 siblings, 0 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2008-03-02  9:30 UTC (permalink / raw)
  To: linux-scsi; +Cc: tomof, FUJITA Tomonori, Douglas Gilbert, James Bottomley

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Douglas Gilbert <dougg@torque.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 drivers/scsi/scsi_debug.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index f70df03..f3f3a20 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2076,8 +2076,8 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev)
 
 	if (devip)
 		return devip;
-	sdbg_host = *(struct sdebug_host_info **) sdev->host->hostdata;
-        if(! sdbg_host) {
+	sdbg_host = *(struct sdebug_host_info **)shost_priv(sdev->host);
+	if (!sdbg_host) {
                 printk(KERN_ERR "Host info NULL\n");
 		return NULL;
         }
@@ -2204,7 +2204,7 @@ static int scsi_debug_bus_reset(struct scsi_cmnd * SCpnt)
 		printk(KERN_INFO "scsi_debug: bus_reset\n");
 	++num_bus_resets;
 	if (SCpnt && ((sdp = SCpnt->device)) && ((hp = sdp->host))) {
-		sdbg_host = *(struct sdebug_host_info **) hp->hostdata;
+		sdbg_host = *(struct sdebug_host_info **)shost_priv(hp);
 		if (sdbg_host) {
 			list_for_each_entry(dev_info,
                                             &sdbg_host->dev_info_list,
-- 
1.5.3.7


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

* Re: [PATCH 0/4] scsi_debug cleanup
  2008-03-02  9:30 [PATCH 0/4] scsi_debug cleanup FUJITA Tomonori
  2008-03-02  9:30 ` [PATCH 1/4] scsi_debug: stop including drivers/scsi/scsi.h FUJITA Tomonori
@ 2008-03-02 16:04 ` Douglas Gilbert
  2008-03-04 18:21 ` [PATCH] scsi_debug: publish support for sg-chaining Boaz Harrosh
  2 siblings, 0 replies; 8+ messages in thread
From: Douglas Gilbert @ 2008-03-02 16:04 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi, tomof, James Bottomley

FUJITA Tomonori wrote:
> Here's minor cleanup of scsi_debug driver. This is against scsi-misc.

Thanks, Tomo.

For patches 1/4, 2/4, 3/4 and 4/4:

Signed-off-by: Douglas Gilbert <dougg@torque.net>

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

* [PATCH] scsi_debug: publish support for sg-chaining
  2008-03-02  9:30 [PATCH 0/4] scsi_debug cleanup FUJITA Tomonori
  2008-03-02  9:30 ` [PATCH 1/4] scsi_debug: stop including drivers/scsi/scsi.h FUJITA Tomonori
  2008-03-02 16:04 ` [PATCH 0/4] scsi_debug cleanup Douglas Gilbert
@ 2008-03-04 18:21 ` Boaz Harrosh
  2 siblings, 0 replies; 8+ messages in thread
From: Boaz Harrosh @ 2008-03-04 18:21 UTC (permalink / raw)
  To: FUJITA Tomonori, Douglas Gilbert; +Cc: linux-scsi, tomof, James Bottomley

On Sun, Mar 02 2008 at 11:30 +0200, FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> Here's minor cleanup of scsi_debug driver. This is against scsi-misc.
> 
> 
> --
If at it, might add this one also. I was sure it was done before, but apparently
it disappeared.

---
From: Boaz Harrosh <bharrosh@panasas.com>
Date: Tue, 4 Mar 2008 20:09:20 +0200
Subject: [PATCH] scsi_debug: publish support for sg-chaining

scsi_debug already supports sg-chaining. Let scsi-ml
know that, to let it send any sg-list size

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 drivers/scsi/scsi_debug.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 3abd286..fd9fef5 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3076,7 +3076,7 @@ static struct scsi_host_template sdebug_driver_template = {
 	.bios_param =		scsi_debug_biosparam,
 	.can_queue =		SCSI_DEBUG_CANQUEUE,
 	.this_id =		7,
-	.sg_tablesize =		256,
+	.sg_tablesize =		~0,
 	.cmd_per_lun =		16,
 	.max_sectors =		0xffff,
 	.use_clustering = 	DISABLE_CLUSTERING,
-- 
1.5.3.3




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

* [PATCH 0/4] scsi_debug cleanup
@ 2015-02-18 22:31 Tomas Winkler
  0 siblings, 0 replies; 8+ messages in thread
From: Tomas Winkler @ 2015-02-18 22:31 UTC (permalink / raw)
  To: James E.J. Bottomley"; +Cc: linux-scsi, Tomas Winkler

I did some minor code cleanups while playing with 
scsi_debug module

Tomas Winkler (4):
  scsi_debug: define pr_fmt() for consistent logging
  scsi_debug: use SCSI_W_LUN_REPORT_LUNS instead of
    SAM2_WLUN_REPORT_LUNS;
  scsi_debug: vfree is null safe so drop the check
  scsi_debug: make dump_sector static

 drivers/scsi/scsi_debug.c | 143 ++++++++++++++++++++--------------------------
 1 file changed, 63 insertions(+), 80 deletions(-)

-- 
1.9.3


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

end of thread, other threads:[~2015-02-18 22:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-02  9:30 [PATCH 0/4] scsi_debug cleanup FUJITA Tomonori
2008-03-02  9:30 ` [PATCH 1/4] scsi_debug: stop including drivers/scsi/scsi.h FUJITA Tomonori
2008-03-02  9:30   ` [PATCH 2/4] scsi_debug: remove scsi_debug.h FUJITA Tomonori
2008-03-02  9:30     ` [PATCH 3/4] scsi_debug: remove unnecessary checking FUJITA Tomonori
2008-03-02  9:30       ` [PATCH 4/4] scsi_debug: use shost_priv macro FUJITA Tomonori
2008-03-02 16:04 ` [PATCH 0/4] scsi_debug cleanup Douglas Gilbert
2008-03-04 18:21 ` [PATCH] scsi_debug: publish support for sg-chaining Boaz Harrosh
  -- strict thread matches above, loose matches on Subject: below --
2015-02-18 22:31 [PATCH 0/4] scsi_debug cleanup Tomas Winkler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.