linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi_debug on 2.5.44+scsi-misc
@ 2002-10-30  2:55 Douglas Gilbert
  2002-10-31  1:33 ` Douglas Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Douglas Gilbert @ 2002-10-30  2:55 UTC (permalink / raw)
  To: linux-scsi

Here is a patch for scsi_debug against 2.5.44 plus James's
scsi-misc BK tree. Changes:
   - add SYNCHRONIZE_CACHE command support
   - clean up module removal noise
   - add some more parameters for driverfs

Doug Gilbert

--- linux/drivers/scsi/scsi_debug.c	2002-10-30 11:18:09.000000000 +1100
+++ linux/drivers/scsi/scsi_debug.c163	2002-10-30 11:59:07.000000000 +1100
@@ -49,7 +49,7 @@
 
 #include "scsi_debug.h"
 
-static const char * scsi_debug_version_str = "Version: 1.62 (20020812)";
+static const char * scsi_debug_version_str = "Version: 1.63 (20021030)";
 
 #define DRIVERFS_SUPPORT 1	/* comment out whole line to disable */
 
@@ -131,7 +131,7 @@
 
 static unsigned char * fake_storep;	/* ramdisk storage */
 
-static unsigned char broken_buff[SDEBUG_SENSE_LEN];
+static unsigned char spare_buff[SDEBUG_SENSE_LEN];
 
 static int num_aborts = 0;
 static int num_dev_resets = 0;
@@ -215,8 +215,7 @@
 	else 
 		buff = (unsigned char *) SCpnt->request_buffer;
 	if (NULL == buff) {
-		printk(KERN_WARNING "scsi_debug:qc: buff was NULL??\n");
-		buff = broken_buff;	/* just point at dummy */
+		buff = spare_buff;	/* assume cmd moves no data */
 		bufflen = SDEBUG_SENSE_LEN;
 	}
 
@@ -380,6 +379,9 @@
 	case MODE_SENSE_10:
 		errsts = resp_mode_sense(cmd, target, buff, bufflen, devip);
 		break;
+	case SYNCHRONIZE_CACHE:
+		memset(buff, 0, bufflen);
+		break;
 	default:
 #if 0
 		printk(KERN_INFO "scsi_debug: Unsupported command, "
@@ -643,6 +645,7 @@
 	case 0x3f:	/* Read all Mode pages */
 		len = resp_err_recov_pg(ap, pcontrol, target);
 		len += resp_disconnect_pg(ap + len, pcontrol, target);
+		len += resp_format_pg(ap + len, pcontrol, target);
 		len += resp_caching_pg(ap + len, pcontrol, target);
 		len += resp_ctrl_m_pg(ap + len, pcontrol, target);
 		offset += len;
@@ -1324,15 +1327,35 @@
 
 DRIVER_ATTR(num_devs, S_IRUGO, sdebug_num_devs_read, NULL) 
 
+static ssize_t sdebug_dev_size_mb_read(struct device_driver * ddp, char * buf, 
+				       size_t count, loff_t off)
+{
+        return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_dev_size_mb);
+}
+
+DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_read, NULL) 
+
+static ssize_t sdebug_every_nth_read(struct device_driver * ddp, char * buf, 
+				     size_t count, loff_t off)
+{
+        return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_every_nth);
+}
+
+DRIVER_ATTR(every_nth, S_IRUGO, sdebug_every_nth_read, NULL) 
+
 static void do_create_driverfs_files()
 {
 	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);
 }
 
 static void do_remove_driverfs_files()
 {
+	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);


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

* Re: [PATCH] scsi_debug on 2.5.44+scsi-misc
  2002-10-30  2:55 [PATCH] scsi_debug on 2.5.44+scsi-misc Douglas Gilbert
@ 2002-10-31  1:33 ` Douglas Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Douglas Gilbert @ 2002-10-31  1:33 UTC (permalink / raw)
  Cc: linux-scsi

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

Douglas Gilbert wrote:
> Here is a patch for scsi_debug against 2.5.44 plus James's
> scsi-misc BK tree. Changes:
>   - add SYNCHRONIZE_CACHE command support
>   - clean up module removal noise
>   - add some more parameters for driverfs


The attached gzipped diff file is against 2.5.44-bk3
(which is the same for scsi_debug.c as yesterday's
2.5.44+scsi-misc) and merges work from Patrick
Mansfield. There are now options to set:
   - max_luns (default 2)
   - scsi_level (default 3)

Now if multiple scsi_debug pseudo devices are selected
they will get these tuples (assuming "2" is the next
available host number):
   2 0 0 0
   2 0 0 1
   2 0 1 0
   2 0 1 1
   2 0 2 0
   ...
   2 0 7 1
   3 0 0 0
   3 0 0 1
etc

Doug Gilbert



[-- Attachment #2: scsi_debug_163_2544bk3.diff.gz --]
[-- Type: application/x-gzip, Size: 3119 bytes --]

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

end of thread, other threads:[~2002-10-31  1:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-30  2:55 [PATCH] scsi_debug on 2.5.44+scsi-misc Douglas Gilbert
2002-10-31  1:33 ` Douglas Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).