linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] constants.c
@ 2004-10-25 10:10 Douglas Gilbert
  0 siblings, 0 replies; only message in thread
From: Douglas Gilbert @ 2004-10-25 10:10 UTC (permalink / raw)
  To: linux-scsi

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

Continuing the expansion of linux SCSI sense handling
to decode descriptor format, attached is a major rework
of constants.c. It addresses various other issues.
This gzipped patch is against 2.6.10-rc1
which includes "struct scsi_sense_hdr" introduced in James's
"[BK PATCH] SCSI updates for 2.6.9" patch.

Output from this patch can be seen with a sequence like
the following. It assumes that the mounted file system
storing the log is _not_ using the SCSI subsystem (as the
high logging level will cause a logging loop). The logging
level can be reduced from 0xffff to 0x1200 .

$ sysctl -w dev.scsi.logging_level=0xffff
$ modprobe scsi_debug num_parts=2 opts=1 dsense=1
$ sg_readcap -16 /dev/sda

Lots of output goes to the console but not from constants.c
which uses KERN_INFO on its printk()s. The "dsense=1" option
to (recent) scsi_debug drivers instructs them to return
descriptor sense format. There should be at least one
Unit Attention/power on reset warning in the log after
the modprobe. The "sg_readcap -16" sends a READ CAPACITY(16)
to /dev/sda (assumed to be a scsi_debug pseudo disk). This
causes an error as that command is not supported.

Changelog:
   - bring opcode names, asc/ascq strings and sense format
     into line with SPC-3 rev 21 (22 September 2004)
   - drop SCSI-1 sense buffer decoding [still output it in hex]
   - opcode names include those that depend on service actions
     including variable length commands **
   - decodes both fixed and descriptor sense data formats
   - use KERN_INFO on printk()s that start on new lines
   - flag vendor specific asc and acsq codes
   - print all bytes of a cdb after the name (previously skipped
     the first byte)
   - cleanup file, tab to 8 spaces


On my i386 machine constants.c compiles to a size of around 33 KBytes
when CONFIG_SCSI_CONSTANTS is set and 3 KBytes when it is not.
That is considerable more than the +12 KBytes suggested
drivers/scsi/Kconfig .

** Strictly speaking opcode names also depend on the peripheral device
type of the target device. Currently the external interface to
constants.c does not provide the peripheral device type. This should
not be a major problem in practice.

Doug Gilbert

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-25 10:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-25 10:10 [PATCH] constants.c 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).