freebsd-dev/sbin
Kenneth D. Merry 1cc052e80f Add descriptor sense support to CAM, and honor sense residuals properly in
CAM.

Desriptor sense is a new sense data format that originated in SPC-3.  Among
other things, it allows for an 8-byte info field, which is necessary to
pass back block numbers larger than 4 bytes.

This change adds a number of new functions to scsi_all.c (and therefore
libcam) that abstract out most access to sense data.

This includes a bump of CAM_VERSION, because the CCB ABI has changed.
Userland programs that use the CAM pass(4) driver will need to be
recompiled.

camcontrol.c:	Change uses of scsi_extract_sense() to use
		scsi_extract_sense_len().

		Use scsi_get_sks() instead of accessing sense key specific
		data directly.

scsi_modes:	Update the control mode page to the latest version (SPC-4).

scsi_cmds.c,
scsi_target.c:	Change references to struct scsi_sense_data to struct
		scsi_sense_data_fixed.  This should be changed to allow the
		user to specify fixed or descriptor sense, and then use
		scsi_set_sense_data() to build the sense data.

ps3cdrom.c:	Use scsi_set_sense_data() instead of setting sense data
		manually.

cam_periph.c:	Use scsi_extract_sense_len() instead of using
		scsi_extract_sense() or accessing sense data directly.

cam_ccb.h:	Bump the CAM_VERSION from 0x15 to 0x16.  The change of
		struct scsi_sense_data from 32 to 252 bytes changes the
		size of struct ccb_scsiio, but not the size of union ccb.
		So the version must be bumped to prevent structure
		mis-matches.

scsi_all.h:	Lots of updated SCSI sense data and other structures.

		Add function prototypes for the new sense data functions.

		Take out the inline implementation of scsi_extract_sense().
		It is now too large to put in a header file.

		Add macros to calculate whether fields are present and
		filled in fixed and descriptor sense data

scsi_all.c:	In scsi_op_desc(), allow the user to pass in NULL inquiry
		data, and we'll assume a direct access device in that case.

		Changed the SCSI RESERVED sense key name and description
		to COMPLETED, as it is now defined in the spec.

		Change the error recovery action for a number of read errors
		to prevent lots of retries when the drive has said that the
		block isn't accessible.  This speeds up reconstruction of
		the block by any RAID software running on top of the drive
		(e.g. ZFS).

		In scsi_sense_desc(), allow for invalid sense key numbers.
		This allows calling this routine without checking the input
		values first.

		Change scsi_error_action() to use scsi_extract_sense_len(),
		and handle things when invalid asc/ascq values are
		encountered.

		Add a new routine, scsi_desc_iterate(), that will call the
		supplied function for every descriptor in descriptor format
		sense data.

		Add scsi_set_sense_data(), and scsi_set_sense_data_va(),
		which build descriptor and fixed format sense data.  They
		currently default to fixed format sense data.

		Add a number of scsi_get_*() functions, which get different
		types of sense data fields from either fixed or descriptor
		format sense data, if the data is present.

		Add a number of scsi_*_sbuf() functions, which print
		formatted versions of various sense data fields.  These
		functions work for either fixed or descriptor sense.

		Add a number of scsi_sense_*_sbuf() functions, which have a
		standard calling interface and print the indicated field.
		These functions take descriptors only.

		Add scsi_sense_desc_sbuf(), which will print a formatted
		version of the given sense descriptor.

		Pull out a majority of the scsi_sense_sbuf() function and
		put it into scsi_sense_only_sbuf().  This allows callers
		that don't use struct ccb_scsiio to easily utilize the
		printing routines.  Revamp that function to handle
		descriptor sense and use the new sense fetching and
		printing routines.

		Move scsi_extract_sense() into scsi_all.c, and implement it
		in terms of the new function, scsi_extract_sense_len().
		The _len() version takes a length (which should be the
		sense length - residual) and can indicate which fields are
		present and valid in the sense data.

		Add a couple of new scsi_get_*() routines to get the sense
		key, asc, and ascq only.

mly.c:		Rename struct scsi_sense_data to struct
		scsi_sense_data_fixed.

sbp_targ.c:	Use the new sense fetching routines to get sense data
		instead of accessing it directly.

sbp.c:		Change the firewire/SCSI sense data transformation code to
		use struct scsi_sense_data_fixed instead of struct
		scsi_sense_data.  This should be changed later to use
		scsi_set_sense_data().

ciss.c:		Calculate the sense residual properly.  Use
		scsi_get_sense_key() to fetch the sense key.

mps_sas.c,
mpt_cam.c:	Set the sense residual properly.

iir.c:		Use scsi_set_sense_data() instead of building sense data by
		hand.

iscsi_subr.c:	Use scsi_extract_sense_len() instead of grabbing sense data
		directly.

umass.c:	Use scsi_set_sense_data() to build sense data.

		Grab the sense key using scsi_get_sense_key().

		Calculate the sense residual properly.

isp_freebsd.h:	Use scsi_get_*() routines to grab asc, ascq, and sense key
		values.

		Calculate and set the sense residual.

MFC after:	3 days
Sponsored by:	Spectra Logic Corporation
2011-10-03 20:32:55 +00:00
..
adjkerntz Raise WARNS for various tools where possible. 2010-01-17 21:56:27 +00:00
atacontrol Re-encode files from ISO-8859-1 to UTF-8 2011-05-22 14:03:30 +00:00
atm MFtbemd: 2010-08-23 22:24:11 +00:00
badsect Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
bsdlabel Widen fields that display partition offset/length. 2011-03-10 08:24:33 +00:00
camcontrol Add descriptor sense support to CAM, and honor sense residuals properly in 2011-10-03 20:32:55 +00:00
ccdconfig mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
clri Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
comcontrol ANSIfy almost all applications that use WARNS=6. 2009-12-29 22:53:27 +00:00
conscontrol Changed "conscontrol unset" to accept an existing virtual 2011-04-18 20:28:07 +00:00
ddb Correct subcommand name 'unset' -> 'unscript'. 2011-06-18 22:32:55 +00:00
devd Typo. For USB devices, 'serial' should be 'sernum'. 2011-05-10 02:34:11 +00:00
devfs Document the interaction between /etc/devfs.conf and 2010-02-21 10:29:45 +00:00
dhclient Use resolvconf(8) to update /etc/resolv.conf. 2011-03-18 12:23:20 +00:00
dmesg Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
dump The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilities 2011-01-24 06:17:05 +00:00
dumpfs Use _PATH_DEV and make the format more consistent with GEOM_LABEL. 2011-07-14 17:43:23 +00:00
dumpon Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
fdisk The decimal() function was changed in r217808 to take the 2011-08-19 12:48:06 +00:00
fdisk_pc98 Use the common PC98_SID_ACTIVE define instead of a local define. 2009-03-19 12:31:59 +00:00
ffsinfo Bump WARNS where possible. 2010-02-15 14:07:40 +00:00
fsck Fix typos and spelling mistakes. 2010-08-06 14:33:42 +00:00
fsck_ffs Forgot this nit in r221107. 2011-09-03 03:12:33 +00:00
fsck_msdosfs Fix some style(9), although there's a lot more issues here. 2010-06-20 09:40:54 +00:00
fsdb Get rid of major/minor number distinction. 2011-09-28 18:53:36 +00:00
fsirand The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilities 2011-01-24 06:17:05 +00:00
gbde MFtbemd: 2010-08-23 22:24:11 +00:00
geom Don't use the whole free space when resizing partition to a larger size 2011-09-08 04:14:16 +00:00
ggate Because ggatel(8) operates on local GEOM providers, use unlimited queue size in 2011-04-02 06:59:05 +00:00
growfs Revert the mechanical change from 'file system' to 'filesystem', committed 2011-06-28 19:59:46 +00:00
gvinum * Add the readline(3) API to libedit. The libedit versions of 2011-04-05 18:41:01 +00:00
hastctl Prefer PJDLOG_ASSERT()/PJDLOG_ABORT() over assert(). 2011-09-27 08:21:00 +00:00
hastd Correct typo. 2011-09-28 13:25:27 +00:00
ifconfig - Document inet6 no_radr flag. 2011-09-19 16:01:53 +00:00
init init(8): Document that login(1) is now responsible for recording logouts. 2011-01-23 14:54:45 +00:00
ipf Always assign WARNS using ?= 2010-03-02 16:58:04 +00:00
ipfw Add support for IPv6 to ipfw fwd: 2011-08-20 17:05:11 +00:00
iscontrol Fix compilation with debug on. 2011-01-25 22:25:16 +00:00
kldconfig Raise WARNS for various tools where possible. 2010-01-17 21:56:27 +00:00
kldload Make flags in usage() and SYNOPSYS more style(9)-ish. 2010-08-30 07:29:27 +00:00
kldstat In printfile(), exit the process instead of only printing the warning. 2010-11-13 16:49:07 +00:00
kldunload Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
ldconfig ANSIfy ldconfig and the aout bits it still uses from rtld-aout. 2009-12-29 21:07:17 +00:00
mca sysctlbyname() returns -1 on error and sets errno. It does 2010-07-03 22:02:29 +00:00
md5 Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
mdconfig Somewhere around the 473rd time I mistyped "mdconfig file" instead of 2011-04-29 22:40:11 +00:00
mdmfs Do not try to change the mode or ownership of the root of the mountpoint 2011-09-13 20:16:11 +00:00
mknod Fix some more warnings found by clang. 2010-11-22 20:10:48 +00:00
mksnap_ffs Note that a UFS filesystem can have up to 20 active snapshots. 2011-02-15 07:25:54 +00:00
mount Clear the mountprog variable after each mountfs() call so that mountprog 2011-09-02 17:11:59 +00:00
mount_cd9660 Fix minor memory leak in a function. 2009-11-20 15:28:38 +00:00
mount_ext2fs Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
mount_hpfs mdoc: consistently spell our email addresses <foo@FreeBSD.org> 2010-05-19 08:57:53 +00:00
mount_msdosfs mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the 2010-05-13 12:07:55 +00:00
mount_nfs Implemented a mount option "nocto" that disables cache coherency 2011-05-04 13:27:45 +00:00
mount_ntfs mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the 2010-05-13 12:07:55 +00:00
mount_nullfs ANSIfy almost all applications that use WARNS=6. 2009-12-29 22:53:27 +00:00
mount_reiserfs Re-encode files from ISO-8859-1 to UTF-8 2011-05-22 14:03:30 +00:00
mount_std mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the 2010-05-13 12:07:55 +00:00
mount_udf style.Makefile(5): Remove -Wall from CFLAGS. 2006-07-17 20:53:25 +00:00
mount_unionfs Fix SYNOPSIS. 2011-03-23 13:44:09 +00:00
natd Fix a typo. 2011-07-01 19:22:27 +00:00
newfs Advertise growfs(8) a little better. 2011-06-22 18:02:28 +00:00
newfs_msdos Use NULL instead of 0 for third argument of sigaction(2). 2011-07-12 10:07:07 +00:00
nfsiod - Display current settings when run without options. 2009-12-26 08:36:02 +00:00
nos-tun nos-tun(8): make WARNS=3 clean 2010-03-10 18:51:13 +00:00
pfctl Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
pflogd Update packet filter (pf) code to OpenBSD 4.5. 2011-06-28 11:57:25 +00:00
ping Small style fixes: 2010-06-20 12:52:33 +00:00
ping6 Add __unused. Ansi prototypes. 2010-12-19 13:40:38 +00:00
quotacheck Update to current version of head. 2010-04-28 05:33:59 +00:00
rcorder Gavin documented these alternate options in good faith in r222751 2011-08-06 09:13:09 +00:00
reboot Remove vestiges of disklabel(5). 2011-04-14 08:53:04 +00:00
recoverdisk recoverdisk(8): treat output file consistently and abort on EINVAL 2011-05-01 20:14:10 +00:00
resolvconf Add resolvconf(8) which manages resolv.conf. 2011-03-18 12:18:52 +00:00
restore mdoc: make pages render with mandoc 2010-10-21 12:27:13 +00:00
route - Fix array bounds checking. [1] 2010-12-08 15:12:37 +00:00
routed Fix use of AND operator: should be bitwise instead of logical. 2010-11-22 19:40:27 +00:00
rtsol Add dump.c to the rtsol build. It is needed now that sec2str is non-static 2011-06-08 21:59:07 +00:00
savecore Remove duplicated header files 2011-06-24 07:29:04 +00:00
sconfig Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
setkey mdoc: fix markup 2011-06-02 09:56:42 +00:00
shutdown Remove trailing whitespace in the shutdown(8) manual. 2011-07-14 03:08:10 +00:00
spppcontrol mdoc: order prologue macros consistently by Dd/Dt/Os 2010-04-14 19:08:06 +00:00
sunlabel mdoc: drop even more redundant .Pp calls 2010-10-19 12:35:40 +00:00
swapon Raise WARNS for various tools where possible. 2010-01-17 21:56:27 +00:00
sysctl Introduce signed and unsigned version of CTLTYPE_QUAD, renaming 2011-01-19 23:00:25 +00:00
tunefs Advertise growfs(8) a little better. 2011-06-22 18:02:28 +00:00
umount When using -A option (unmount all mounted filesystems), do not attempt 2011-07-14 20:17:05 +00:00
Makefile Add resolvconf(8) which manages resolv.conf. 2011-03-18 12:18:52 +00:00
Makefile.amd64 MF tbemd: Move to using Makefile.arch to select what to build. 2010-09-13 02:25:21 +00:00
Makefile.arm MF tbemd: Move to using Makefile.arch to select what to build. 2010-09-13 02:25:21 +00:00
Makefile.i386 MF tbemd: Move to using Makefile.arch to select what to build. 2010-09-13 02:25:21 +00:00
Makefile.ia64 MF tbemd: Move to using Makefile.arch to select what to build. 2010-09-13 02:25:21 +00:00
Makefile.inc Switch the default WARNS level for sbin/ to 6. 2009-10-19 16:00:24 +00:00
Makefile.mips MF tbemd: Move to using Makefile.arch to select what to build. 2010-09-13 02:25:21 +00:00
Makefile.pc98 MF tbemd: Move to using Makefile.arch to select what to build. 2010-09-13 02:25:21 +00:00
Makefile.sparc64 MF tbemd: Move to using Makefile.arch to select what to build. 2010-09-13 02:25:21 +00:00