* [PATCH] sg descriptor sense cleanup lk 2.6.11-rc1-bk1
@ 2005-01-17 11:39 Douglas Gilbert
2005-01-20 11:15 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Douglas Gilbert @ 2005-01-17 11:39 UTC (permalink / raw)
To: SCSI Mailing List; +Cc: James.Bottomley
[-- Attachment #1: Type: text/plain, Size: 547 bytes --]
Continuation of descriptor sense data expansion to
sg driver.
Next will be the sd driver which awaits a
new utility function in constants.c to read the
sense data information field for medium/hardware
errors.
Changelog:
- expand sense data handling to descriptor format
- make module parameters visible in
/sys/modules/sg/parameters
- add "readable" SCSI commands: READ(16), REPORT LUNS,
SERVICE_ACTION_IN, RECEIVE_DIAGNOSTIC, READ_LONG
and MAINTENANCE_IN_CMD to list
Signed-off-by: Douglas Gilbert <dougg@torque.net>
[-- Attachment #2: sg2611rc1bk1.diff --]
[-- Type: text/x-patch, Size: 2979 bytes --]
--- linux/drivers/scsi/sg.c 2004-12-25 12:21:22.000000000 +1000
+++ linux/drivers/scsi/sg.c2611rc1bk1des 2005-01-17 18:11:42.000000000 +1000
@@ -7,7 +7,7 @@
* Original driver (sg.c):
* Copyright (C) 1992 Lawrence Foard
* Version 2 and 3 extensions to driver:
- * Copyright (C) 1998 - 2004 Douglas Gilbert
+ * Copyright (C) 1998 - 2005 Douglas Gilbert
*
* Modified 19-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
*
@@ -18,8 +18,8 @@
*
*/
-static int sg_version_num = 30531; /* 2 digits for each component */
-#define SG_VERSION_STR "3.5.31"
+static int sg_version_num = 30532; /* 2 digits for each component */
+#define SG_VERSION_STR "3.5.32"
/*
* D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
@@ -60,7 +60,7 @@
#ifdef CONFIG_SCSI_PROC_FS
#include <linux/proc_fs.h>
-static char *sg_version_date = "20040516";
+static char *sg_version_date = "20050117";
static int sg_proc_init(void);
static void sg_proc_cleanup(void);
@@ -1282,6 +1282,8 @@
srp->header.duration =
jiffies_to_msecs(jiffies - srp->header.duration);
if (0 != SRpnt->sr_result) {
+ struct scsi_sense_hdr sshdr;
+
memcpy(srp->sense_b, SRpnt->sr_sense_buffer,
sizeof (srp->sense_b));
srp->header.status = 0xff & SRpnt->sr_result;
@@ -1296,11 +1298,12 @@
/* Following if statement is a patch supplied by Eric Youngdale */
if (driver_byte(SRpnt->sr_result) != 0
- && (SRpnt->sr_sense_buffer[0] & 0x7f) == 0x70
- && (SRpnt->sr_sense_buffer[2] & 0xf) == UNIT_ATTENTION
+ && scsi_command_normalize_sense(SCpnt, &sshdr)
+ && !scsi_sense_is_deferred(&sshdr)
+ && sshdr.sense_key == UNIT_ATTENTION
&& sdp->device->removable) {
- /* Detected disc change. Set the bit - this may be used if */
- /* there are filesystems using this device. */
+ /* Detected possible disc change. Set the bit - this */
+ /* may be used if there are filesystems using this device */
sdp->device->changed = 1;
}
}
@@ -1573,8 +1576,8 @@
* of sysfs parameters (which module_param doesn't yet support).
* Sysfs parameters defined explicitly below.
*/
-module_param_named(def_reserved_size, def_reserved_size, int, 0);
-module_param_named(allow_dio, sg_allow_dio, int, 0);
+module_param_named(def_reserved_size, def_reserved_size, int, S_IRUGO);
+module_param_named(allow_dio, sg_allow_dio, int, S_IRUGO | S_IWUSR);
MODULE_AUTHOR("Douglas Gilbert");
MODULE_DESCRIPTION("SCSI generic (sg) driver");
@@ -2606,9 +2609,14 @@
free_pages((unsigned long) buff, order);
}
+#ifndef MAINTENANCE_IN_CMD
+#define MAINTENANCE_IN_CMD 0xa3
+#endif
+
static unsigned char allow_ops[] = { TEST_UNIT_READY, REQUEST_SENSE,
INQUIRY, READ_CAPACITY, READ_BUFFER, READ_6, READ_10, READ_12,
- MODE_SENSE, MODE_SENSE_10, LOG_SENSE
+ READ_16, MODE_SENSE, MODE_SENSE_10, LOG_SENSE, REPORT_LUNS,
+ SERVICE_ACTION_IN, RECEIVE_DIAGNOSTIC, READ_LONG, MAINTENANCE_IN_CMD
};
static int
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] sg descriptor sense cleanup lk 2.6.11-rc1-bk1
2005-01-17 11:39 [PATCH] sg descriptor sense cleanup lk 2.6.11-rc1-bk1 Douglas Gilbert
@ 2005-01-20 11:15 ` Christoph Hellwig
2005-01-20 23:35 ` Douglas Gilbert
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2005-01-20 11:15 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: SCSI Mailing List, James.Bottomley
On Mon, Jan 17, 2005 at 09:39:37PM +1000, Douglas Gilbert wrote:
> Continuation of descriptor sense data expansion to
> sg driver.
>
> Next will be the sd driver which awaits a
> new utility function in constants.c to read the
> sense data information field for medium/hardware
> errors.
>
> Changelog:
> - expand sense data handling to descriptor format
> - make module parameters visible in
> /sys/modules/sg/parameters
> - add "readable" SCSI commands: READ(16), REPORT LUNS,
> SERVICE_ACTION_IN, RECEIVE_DIAGNOSTIC, READ_LONG
> and MAINTENANCE_IN_CMD to list
>
> Signed-off-by: Douglas Gilbert <dougg@torque.net>
+#ifndef MAINTENANCE_IN_CMD
+#define MAINTENANCE_IN_CMD 0xa3
+#endif
Shouldn't we put it into <scsi/scsi.h> ?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sg descriptor sense cleanup lk 2.6.11-rc1-bk1
2005-01-20 11:15 ` Christoph Hellwig
@ 2005-01-20 23:35 ` Douglas Gilbert
0 siblings, 0 replies; 3+ messages in thread
From: Douglas Gilbert @ 2005-01-20 23:35 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: SCSI Mailing List, James.Bottomley
Christoph Hellwig wrote:
> On Mon, Jan 17, 2005 at 09:39:37PM +1000, Douglas Gilbert wrote:
>
>>Continuation of descriptor sense data expansion to
>>sg driver.
>>
>>Next will be the sd driver which awaits a
>>new utility function in constants.c to read the
>>sense data information field for medium/hardware
>>errors.
>>
>>Changelog:
>> - expand sense data handling to descriptor format
>> - make module parameters visible in
>> /sys/modules/sg/parameters
>> - add "readable" SCSI commands: READ(16), REPORT LUNS,
>> SERVICE_ACTION_IN, RECEIVE_DIAGNOSTIC, READ_LONG
>> and MAINTENANCE_IN_CMD to list
>>
>>Signed-off-by: Douglas Gilbert <dougg@torque.net>
>
>
> +#ifndef MAINTENANCE_IN_CMD
> +#define MAINTENANCE_IN_CMD 0xa3
> +#endif
>
> Shouldn't we put it into <scsi/scsi.h> ?
Yes it should. For a larger list of missing "byte 0"
opcodes see the top of constants.c
The opcodes with a "in" suffix retrieve data from the
device so are generally safe to use when the device
is opened O_RDONLY.
So the various SCSI command sets are not limited
in number to 256, more use is being made of
service actions. Maintanance In contains these
commands (or at least they are documented separately
in SPC-3):
Report device identifier [a3/5]
Report target port groups [a3/a]
Report aliases [a3/b]
Report supported operation codes [a3/c]
Report supported task management functions [a3/d]
Report priority [a3/e]
And sooner or later we will need to support variable
length commands.
Doug Gilbert
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-01-20 23:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-17 11:39 [PATCH] sg descriptor sense cleanup lk 2.6.11-rc1-bk1 Douglas Gilbert
2005-01-20 11:15 ` Christoph Hellwig
2005-01-20 23:35 ` Douglas Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox