aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COVERAGE6
-rw-r--r--CREDITS3
-rw-r--r--ChangeLog12
-rw-r--r--README17
-rw-r--r--debian/changelog2
-rw-r--r--doc/Makefile.am40
-rw-r--r--doc/Makefile.in40
-rw-r--r--doc/sg_sat_identify.816
-rw-r--r--doc/sg_sat_phy_event.88
-rw-r--r--doc/sg_sat_read_gplog.8114
-rw-r--r--doc/sg_sat_set_features.814
-rw-r--r--lib/sg_lib_data.c6
-rw-r--r--scripts/58-scsi-sg3_symlink.rules1
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/Makefile.am44
-rw-r--r--src/Makefile.in24
-rw-r--r--src/sg_inq.c16
-rw-r--r--src/sg_sat_identify.c6
-rw-r--r--src/sg_sat_read_gplog.c454
-rw-r--r--src/sg_sat_set_features.c66
-rw-r--r--src/sg_vpd.c23
-rw-r--r--src/sg_write_buffer.c7
-rw-r--r--src/sg_write_verify.c108
23 files changed, 835 insertions, 194 deletions
diff --git a/COVERAGE b/COVERAGE
index ead906ae..5b12c8c4 100644
--- a/COVERAGE
+++ b/COVERAGE
@@ -7,7 +7,7 @@ of them on the right. The second table lists supported ATA commands.
SCSI command sg3_utils utilities that use this SCSI command
------------ -------------------------------------------------
ATA COMMAND PASS-THROUGH(16) sg_sat_identify, sg_sat_set_features,
- sg_sat_phy_event, ++
+ sg_sat_phy_event, sg_sat_read_gplog ++
[sg_sat_chk_power, sg__sat_identify,
sg__sat_set_features, sg_sat_smart_rd_data
(previous four in the examples directory)]
@@ -102,6 +102,8 @@ IDENTIFY DEVICE sg_inq, sg_scan, sg_sat_identify,
IDENTIFY PACKET DEVICE sg_inq, sg_sat_identify,
examples/sg__sat_identify
READ LOG EXT sg_sat_phy_event, examples/sg__sat_phy_event
+ sg_sat_read_gplog
+READ LOG DMA EXT sg_sat_read_gplog
SET FEATURES sg_sat_set_features
examples/sg__sat_set_features
SMART READ DATA examples/sg_sat_smart_rd_data
@@ -123,4 +125,4 @@ THIRD PARTY COPY IN (0x83).
Douglas Gilbert
-25th October 2014
+7th November 2014
diff --git a/CREDITS b/CREDITS
index 7bebe03e..9b585cc5 100644
--- a/CREDITS
+++ b/CREDITS
@@ -51,6 +51,7 @@ Hannes Reinecke <hare at suse dot de>
sg_xcopy+sg_copy_results [20120322]
rescan-scsi-bus.sh patches to Kurt Garloff's v1.57 [20130715]
55-scsi-sg3_id.rules + 58-scsi-sg3_symlink.rules [20140527]
+ sg_sat_read_gplog [20141107]
Hayashi Naoyuki <titan at culzean dot org>
port to Tru64 [20060127]
@@ -131,4 +132,4 @@ Trent Piepho <xyzzy at speakeasy dot org> print out some "sense key specific"
Douglas Gilbert
-27th May 2014
+10th November 2014
diff --git a/ChangeLog b/ChangeLog
index 8b13e7dc..da81b057 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,9 +2,10 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for sg3_utils-1.40 [20141029] [svn: r619]
+Changelog for sg3_utils-1.40 [20141110] [svn: r620]
- sg_write_verify: new utility for WRITE AND VERIFY
- sg_ses_microcode: new utility
+ - sg_sat_read_gplog: new utility
- sg_senddiag: add --maxlen= option
- sg_copy_results: correct response length calculations
- sg_format: make '-FFF' bypass mode sense/select
@@ -13,9 +14,11 @@ Changelog for sg3_utils-1.40 [20141029] [svn: r619]
- output unit serial number and LU name prior to
- sg_inq: expand Block limits VPD page output
- fix --cmddt output if not supported by device
+ - more sanity checks on vendor supplied fields
- sg_vpd: add --all option
- more TPC VPD page decoding
- add zoned block device characteristics page
+ - more sanity checks on vendor supplied fields
- sg_ses: fix problem with --index=sse (and ssc)
- mask status element before using as control
- defeat previous item with --mask (ignore) option
@@ -24,20 +27,21 @@ Changelog for sg3_utils-1.40 [20141029] [svn: r619]
trailing NULL
- add --warn option mainly for broken joins
- add optional descriptions to -ee output
- - sync with ses3r07: add OC on SAS connector
+ - sync with ses3r07
- sg_sanitize: add --desc and --zero options
- output unit serial number and LU name prior to
- sg_rep_zones: corrections, sync with zbc-r01c
- sg_persist: split help into two pages, '-hh' for 2nd
- sg_logs: refine tape drive output
- sg_raw: with -vvv decode T10 CDB name
+ - do not output/print data-in if error
- sg_opcodes: add --compact field
- sg_senddiag: add --page=PG option
+ - sg_reset: add words for EAGAIN from reset ioctl
- sg_sat_*: mention t_type and multiple_count fields
- - sg_raw: do not output/print data-in if error
- win32: sg_scan: handle larger configurations
- sg_lib: trim trailing spaces in dStrHex() and friends
- - sg_reset: add words for EAGAIN from reset ioctl
+ - sg_lib_data: sync asc/ascq codes with T10 20140924
- clean up service action string functions
- sg_ll_unmap_v2(): fix group number
- sg_ll_inquiry(), sg_ll_mode_sense*(),
diff --git a/README b/README
index 7dfd540d..adc2bcdc 100644
--- a/README
+++ b/README
@@ -236,10 +236,10 @@ subdirectory of the sg3_utils package:
sg_read, sg_readcap, sg_read_block_limits, sg_read_buffer, sg_read_long,
sg_reassign, sg_referrals, sg_request, sg_reset, sg_rmsn, sg_rtpg,
sg_safte, sg_sanitize, sg_sat_identify, sg_sat_phy_event,
- sg_sat_set_features, sg_scan, sg_senddiag, sg_ses, sg_ses_microcode,
- sg_start, sg_stpg, sg_sync, sg_test_rwbuff, sg_turs, sg_unmap, sg_verify,
- sg_vpd, sg_write_buffer, sg_write_long, sg_write_same, sg_write_verify
- sg_wr_mode, sg_xcopy
+ sg_sat_read_gplog, sg_sat_set_features, sg_scan, sg_senddiag, sg_ses,
+ sg_ses_microcode, sg_start, sg_stpg, sg_sync, sg_test_rwbuff, sg_turs,
+ sg_unmap, sg_verify, sg_vpd, sg_write_buffer, sg_write_long,
+ sg_write_same, sg_write_verify sg_wr_mode, sg_xcopy
Each of the above utilities depends on header files found in the 'include'
subdirectory and library code found in the 'lib' subdirectory. Associated
@@ -385,9 +385,10 @@ The more recent utilities that use "getopt_long" only are:
sg_get_lba_status, sg_ident, sg_luns, sg_map26, sg_persist, sg_prevent,
sg_raw, sg_read_block_limits, sg_read_buffer, sg_read_long, sg_reassign,
sg_referrals, sg_requests, sg_rmsn, sg_rtpg, sg_safte, sg_sanitize,
- sg_sat_identify, sg_sat_phy_event, sg_sat_set_features, sg_scan(w),
- sg_ses, sg_stpg, sg_sync, sg_test_rwbuf, sg_unmap, sg_verify, sg_vpd,
- sg_write_buffer, sg_write_long, sg_write_same, sg_write_verify sg_wr_mode
+ sg_sat_identify, sg_sat_phy_event, sg_sat_read_gplog, sg_sat_set_features,
+ sg_scan(w), sg_ses, sg_ses_microcode, sg_stpg, sg_sync, sg_test_rwbuf,
+ sg_unmap, sg_verify, sg_vpd, sg_write_buffer, sg_write_long,
+ sg_write_same, sg_write_verify, sg_wr_mode
Dangerous code
@@ -411,4 +412,4 @@ See http://sg.danny.cz/sg/tools.html
Douglas Gilbert
-24th October 2014
+10th November 2014
diff --git a/debian/changelog b/debian/changelog
index 9fe446d1..2dfcc5ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.40-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Fri, 24 Oct 2014 22:00:00 +0200
+ -- Douglas Gilbert <dgilbert@interlog.com> Mon, 10 Nov 2014 23:00:00 -0500
sg3-utils (1.39-0.1) unstable; urgency=low
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8b9d824c..1b6fe462 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -20,10 +20,10 @@ man_MANS = \
sg_read_buffer.8 sg_read_long.8 sg_reassign.8 sg_referrals.8 \
sg_rep_zones.8 sg_requests.8 sg_reset.8 sg_reset_wp.8 sg_rmsn.8 \
sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
- sg_sat_phy_event.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
- sg_ses.8 sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 \
- sg_test_rwbuf.8 sg_turs.8 sg_unmap.8 sg_verify.8 sg_vpd.8 \
- sg_write_buffer.8 sg_write_long.8 sg_write_same.8 \
+ sg_sat_phy_event.8 sg_sat_read_gplog.8 sg_sat_set_features.8 \
+ sg_scan.8 sg_senddiag.8 sg_ses.8 sg_ses_microcode.8 sg_start.8 \
+ sg_stpg.8 sg_sync.8 sg_test_rwbuf.8 sg_turs.8 sg_unmap.8 sg_verify.8 \
+ sg_vpd.8 sg_write_buffer.8 sg_write_long.8 sg_write_same.8 \
sg_write_verify.8 sg_wr_mode.8 sg_xcopy.8
distclean-local:
@@ -46,9 +46,9 @@ man_MANS = \
sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
- sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
- sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
- sg_sat_phy_event.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
+ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
sg_ses.8 sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 \
sg_turs.8 sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 \
sg_write_long.8 sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
@@ -73,9 +73,9 @@ man_MANS = \
sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
- sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
- sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
- sg_sat_phy_event.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
+ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
sg_ses.8 sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 \
sg_turs.8 sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 \
sg_write_long.8 sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
@@ -102,10 +102,10 @@ man_MANS = \
sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
- sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 sg_ses_microcode.8 \
- sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 sg_unmap.8 sg_verify.8 \
- sg_vpd.8 sg_write_buffer.8 sg_write_long.8 sg_write_same.8 \
- sg_write_verify.8 sg_wr_mode.8
+ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
+ sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 \
+ sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 sg_write_long.8 \
+ sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
endif
@@ -121,9 +121,9 @@ man_MANS = \
sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
- sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
- sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
- sg_sat_phy_event.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
+ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 \
sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 sg_write_long.8 \
sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
@@ -142,9 +142,9 @@ man_MANS = \
sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
- sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
- sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
- sg_sat_phy_event.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
+ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 \
sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 sg_write_long.8 \
sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 2e079ecf..b5fcae70 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -268,10 +268,10 @@ top_srcdir = @top_srcdir@
@OS_FREEBSD_TRUE@ sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
@OS_FREEBSD_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
@OS_FREEBSD_TRUE@ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
-@OS_FREEBSD_TRUE@ sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 sg_ses_microcode.8 \
-@OS_FREEBSD_TRUE@ sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 sg_unmap.8 sg_verify.8 \
-@OS_FREEBSD_TRUE@ sg_vpd.8 sg_write_buffer.8 sg_write_long.8 sg_write_same.8 \
-@OS_FREEBSD_TRUE@ sg_write_verify.8 sg_wr_mode.8
+@OS_FREEBSD_TRUE@ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
+@OS_FREEBSD_TRUE@ sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 \
+@OS_FREEBSD_TRUE@ sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 sg_write_long.8 \
+@OS_FREEBSD_TRUE@ sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
# sg_dd, sg_emc_trespass(?), sginfo, sg_map26, sg_map, sgm_dd, sgp_dd,
@@ -292,10 +292,10 @@ top_srcdir = @top_srcdir@
@OS_LINUX_TRUE@ sg_read_buffer.8 sg_read_long.8 sg_reassign.8 sg_referrals.8 \
@OS_LINUX_TRUE@ sg_rep_zones.8 sg_requests.8 sg_reset.8 sg_reset_wp.8 sg_rmsn.8 \
@OS_LINUX_TRUE@ sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
-@OS_LINUX_TRUE@ sg_sat_phy_event.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
-@OS_LINUX_TRUE@ sg_ses.8 sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 \
-@OS_LINUX_TRUE@ sg_test_rwbuf.8 sg_turs.8 sg_unmap.8 sg_verify.8 sg_vpd.8 \
-@OS_LINUX_TRUE@ sg_write_buffer.8 sg_write_long.8 sg_write_same.8 \
+@OS_LINUX_TRUE@ sg_sat_phy_event.8 sg_sat_read_gplog.8 sg_sat_set_features.8 \
+@OS_LINUX_TRUE@ sg_scan.8 sg_senddiag.8 sg_ses.8 sg_ses_microcode.8 sg_start.8 \
+@OS_LINUX_TRUE@ sg_stpg.8 sg_sync.8 sg_test_rwbuf.8 sg_turs.8 sg_unmap.8 sg_verify.8 \
+@OS_LINUX_TRUE@ sg_vpd.8 sg_write_buffer.8 sg_write_long.8 sg_write_same.8 \
@OS_LINUX_TRUE@ sg_write_verify.8 sg_wr_mode.8 sg_xcopy.8
@OS_OSF_TRUE@man_MANS = \
@@ -307,9 +307,9 @@ top_srcdir = @top_srcdir@
@OS_OSF_TRUE@ sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
@OS_OSF_TRUE@ sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
@OS_OSF_TRUE@ sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
-@OS_OSF_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
-@OS_OSF_TRUE@ sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
-@OS_OSF_TRUE@ sg_sat_phy_event.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
+@OS_OSF_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+@OS_OSF_TRUE@ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+@OS_OSF_TRUE@ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
@OS_OSF_TRUE@ sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 \
@OS_OSF_TRUE@ sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 sg_write_long.8 \
@OS_OSF_TRUE@ sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
@@ -323,9 +323,9 @@ top_srcdir = @top_srcdir@
@OS_SOLARIS_TRUE@ sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
@OS_SOLARIS_TRUE@ sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
@OS_SOLARIS_TRUE@ sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
-@OS_SOLARIS_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
-@OS_SOLARIS_TRUE@ sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
-@OS_SOLARIS_TRUE@ sg_sat_phy_event.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
+@OS_SOLARIS_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+@OS_SOLARIS_TRUE@ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+@OS_SOLARIS_TRUE@ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_senddiag.8 sg_ses.8 \
@OS_SOLARIS_TRUE@ sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 sg_turs.8 \
@OS_SOLARIS_TRUE@ sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 sg_write_long.8 \
@OS_SOLARIS_TRUE@ sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
@@ -339,9 +339,9 @@ top_srcdir = @top_srcdir@
@OS_WIN32_CYGWIN_TRUE@ sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
@OS_WIN32_CYGWIN_TRUE@ sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
@OS_WIN32_CYGWIN_TRUE@ sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
-@OS_WIN32_CYGWIN_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
-@OS_WIN32_CYGWIN_TRUE@ sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
-@OS_WIN32_CYGWIN_TRUE@ sg_sat_phy_event.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
+@OS_WIN32_CYGWIN_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+@OS_WIN32_CYGWIN_TRUE@ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+@OS_WIN32_CYGWIN_TRUE@ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
@OS_WIN32_CYGWIN_TRUE@ sg_ses.8 sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 \
@OS_WIN32_CYGWIN_TRUE@ sg_turs.8 sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 \
@OS_WIN32_CYGWIN_TRUE@ sg_write_long.8 sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
@@ -355,9 +355,9 @@ top_srcdir = @top_srcdir@
@OS_WIN32_MINGW_TRUE@ sg_modes.8 sg_opcodes.8 sg_persist.8 sg_prevent.8 sg_raw.8 \
@OS_WIN32_MINGW_TRUE@ sg_rdac.8 sg_readcap.8 sg_read_block_limits.8 sg_read_buffer.8 \
@OS_WIN32_MINGW_TRUE@ sg_read_long.8 sg_reassign.8 sg_referrals.8 sg_rep_zones.8 \
-@OS_WIN32_MINGW_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 \
-@OS_WIN32_MINGW_TRUE@ sg_rtpg.8 sg_safte.8 sg_sanitize.8 sg_sat_identify.8 \
-@OS_WIN32_MINGW_TRUE@ sg_sat_phy_event.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
+@OS_WIN32_MINGW_TRUE@ sg_requests.8 sg_reset_wp.8 sg_rmsn.8 sg_rtpg.8 sg_safte.8 \
+@OS_WIN32_MINGW_TRUE@ sg_sanitize.8 sg_sat_identify.8 sg_sat_phy_event.8 \
+@OS_WIN32_MINGW_TRUE@ sg_sat_read_gplog.8 sg_sat_set_features.8 sg_scan.8 sg_senddiag.8 \
@OS_WIN32_MINGW_TRUE@ sg_ses.8 sg_ses_microcode.8 sg_start.8 sg_stpg.8 sg_sync.8 \
@OS_WIN32_MINGW_TRUE@ sg_turs.8 sg_unmap.8 sg_verify.8 sg_vpd.8 sg_write_buffer.8 \
@OS_WIN32_MINGW_TRUE@ sg_write_long.8 sg_write_same.8 sg_write_verify.8 sg_wr_mode.8
diff --git a/doc/sg_sat_identify.8 b/doc/sg_sat_identify.8
index c74200be..380e2379 100644
--- a/doc/sg_sat_identify.8
+++ b/doc/sg_sat_identify.8
@@ -1,4 +1,4 @@
-.TH SG_SAT_IDENTIFY "8" "May 2014" "sg3_utils\-1.38" SG3_UTILS
+.TH SG_SAT_IDENTIFY "8" "November 2014" "sg3_utils\-1.40" SG3_UTILS
.SH NAME
sg_sat_identify \- send ATA IDENTIFY DEVICE command via SCSI to ATA
Translation (SAT) layer
@@ -52,7 +52,8 @@ SCSI standard's preference). When given twice (i.e. '\-HH') the output
is in hex, grouped in 16 bit words, the same as the default but without
a header. When given thrice (i.e. '\-HHH') the output is in hex, grouped in
16 bit words, in a format that is acceptable for 'hdparm \-\-Istdin' to
-process.
+process. '\-HHHH' simply outputs hex data bytes, space separated, 16 per
+line.
.TP
\fB\-i\fR, \fB\-\-indent\fR
outputs the World Wide Name (WWN) of the device. This should be a NAA\-5
@@ -97,13 +98,8 @@ probably should treat opcode 0xa1 as a BLANK command and send it through
to the cd/dvd drive. The ATA PASS\-THROUGH (16) command's opcode (0x85)
does not clash with anything so it is a better choice.
.PP
-In the 2.4 series of Linux kernels the \fIDEVICE\fR must be
-a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks
-and ATAPI DVDs) can also be specified. For example "sg_inq /dev/sda"
-will work in the 2.6 series kernels. From lk 2.6.6 other SCSI "char"
-device names may be used as well (e.g. "/dev/st0m"). Prior to lk 2.6.29
-USB mass storage limited sense data to 18 bytes which made the
-\fB\-\-ck_cond\fR option yield strange (truncated) results.
+Prior to Linux kernel 2.6.29 USB mass storage limited sense data to 18 bytes
+which made the \fB\-\-ck_cond\fR option yield strange (truncated) results.
.SH EXIT STATUS
The exit status of sg_sat_identify is 0 when it is successful. Otherwise
see the sg3_utils(8) man page.
@@ -112,7 +108,7 @@ Written by Douglas Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2006\-2013 Douglas Gilbert
+Copyright \(co 2006\-2014 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/doc/sg_sat_phy_event.8 b/doc/sg_sat_phy_event.8
index e120dd6b..415f781c 100644
--- a/doc/sg_sat_phy_event.8
+++ b/doc/sg_sat_phy_event.8
@@ -1,4 +1,4 @@
-.TH SG_SAT_PHY_EVENT "8" "June 2013" "sg3_utils\-1.37" SG3_UTILS
+.TH SG_SAT_PHY_EVENT "8" "November 2014" "sg3_utils\-1.40" SG3_UTILS
.SH NAME
sg_sat_phy_event \- use ATA READ LOG EXT via a SAT pass\-through to fetch
SATA phy event counters
@@ -100,10 +100,10 @@ Written by Douglas Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2006\-2013 Douglas Gilbert
+Copyright \(co 2006\-2014 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
-.B sg_sat_identify(sg3_utils), smp_rep_phy_err_log(smp_utils),
-.B sdparm(sdparm), hdparm(hdparm)
+.B sg_sat_identify,sg_sat_read_gplog(sg3_utils),
+.B smp_rep_phy_err_log(smp_utils), sdparm(sdparm), hdparm(hdparm)
diff --git a/doc/sg_sat_read_gplog.8 b/doc/sg_sat_read_gplog.8
new file mode 100644
index 00000000..c1ee1b81
--- /dev/null
+++ b/doc/sg_sat_read_gplog.8
@@ -0,0 +1,114 @@
+.TH SG_SAT_READ_GPLOG "8" "November 2014" "sg3_utils\-1.40" SG3_UTILS
+.SH NAME
+sg_sat_read_gplog \- use ATA READ LOG EXT command via a SCSI to ATA
+Translation (SAT) layer
+.SH SYNOPSIS
+.B sg_sat_read_gplog
+[\fI\-\-ck_cond\fR] [\fI\-\-count=CO\fR] [\fI\-\-dma\fR] [\fI\-\-help\fR]
+[\fI\-\-hex\fR] [\fI\-\-len=\fR{16|12}] [\fI\-\-log=\fRLA]
+[\fI\-\-page=\fRPN] [\fI\-\-readonly\fR] [\fI\-\-verbose\fR]
+[\fI\-\-version\fR] \fIDEVICE\fR
+.SH DESCRIPTION
+.\" Add any additional description here
+.PP
+This utility sends an ATA READ LOG EXT or an ATA READ LOG DMA EXT command to
+the \fIDEVICE\fR. This command is used to read the general purpose log
+of (S)ATA disks (not ATAPI devices such as DVD driver). Rather than send the
+READ LOG (DMA) EXT command directly to the device it is sent via a SCSI
+transport which is assumed to contain a SCSI to ATA Translation (SAT)
+Layer (SATL). The SATL may be in an operating system driver, in host bus
+adapter (HBA) firmware or in some external enclosure.
+.PP
+This utility does not currently attempt to decode the response from the
+ATA disk, rather it outputs the response in ASCII hexadecimal grouped in
+16 bit words. Following ATA conventions those words are decoded little
+endian (note that SCSI commands use a big endian representation). In the
+future this utility may attempt to decode some log pages, perhaps using
+the \fI\-\-decode\fR option.
+.PP
+The SAT\-2 standard (SAT ANSI INCITS 465-2010, prior draft: sat2r09.pdf at
+www.t10.org) defines two SCSI "ATA PASS\-THROUGH" commands: one using a 16
+byte "cdb" and the other with a 12 byte cdb. This utility defaults to using
+the 16 byte cdb variant.
+.SH OPTIONS
+Arguments to long options are mandatory for short options as well.
+.TP
+\fB\-C\fR, \fB\-\-ck_cond\fR
+sets the CK_COND bit in the ATA PASS\-THROUGH SCSI cdb. The
+default setting is clear (i.e. 0). When set the SATL should yield a
+sense buffer containing a ATA Result descriptor irrespective of whether
+the ATA command succeeded or failed. When clear the SATL should only yield
+a sense buffer containing a ATA Result descriptor if the ATA command failed.
+.TP
+\fB\-c\fR, \fB\-\-count\fR=\fICO\fR
+the number \fICO\fR is placed in the "count" field in the ATA READ
+LOG EXT command. This specified the number of 512-byte blocks of
+data to be read from the specified log.
+.TP
+\fB\-d\fR, \fB\-\-dma\fR
+use the ATA READ LOG DMA EXT command instead of ATA READ LOG EXT command.
+Some devices require this to return valid log data.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+outputs the usage message summarizing command line options then exits.
+Ignores \fIDEVICE\fR if given.
+.TP
+\fB\-H\fR, \fB\-\-hex\fR
+when given once, the response is output in ASCII hexadecimal bytes. When
+given twice, then the response is grouped into 16 bit words using ATA
+conventions (i.e. little endian); this is the default output (i.e. when
+this option is not given). When given thrice (i.e. '\-HHH') the output
+is in hex, grouped in 16 bit words (without a leading offset and trailing
+ASCII on each line), in a format that is acceptable for 'hdparm \-\-Istdin'
+to process.
+.TP
+\fB\-L\fR, \fB\-\-log\fR=\fILA\fR
+the number \fILA\fR is known as the "log address" in the ATA standards and
+is placed in bits 7:0 of the "lba" field of the ATA READ LOG (DMA) EXT
+command. This specifies the log to be returned (See ATA-ACS for a detailed
+list of available log addresses). The default value placed in the "lba
+field is 0, returning the directory of available logs. The maximum value
+allowed for \fILOG\fR is 0xff.
+.TP
+\fB\-p\fR, \fB\-\-page\fR=\fIPN\fR
+the number \fIPN\fR is the page number (within the log address) and is
+placed in bits 32:16 of the "lba" field of the ATA READ LOG (DMA) EXT
+command. The default value placed in the "lba" field is 0. The maximum value
+allowed for \fILOG\fR is 0xffff.
+.TP
+\fB\-l\fR, \fB\-\-len\fR={16|12}
+this is the length of the SCSI cdb used for the ATA PASS\-THROUGH commands.
+The argument can either be 16 or 12. The default is 16. Some SCSI
+transports cannot convey SCSI commands longer than 12 bytes.
+.TP
+\fB\-r\fR, \fB\-\-readonly\fR
+causes the \fIDEVICE\fR to be opened with the read\-only flag (O_RDONLY in
+Unix). The default action is to open \fIDEVICE\fR with the read\-write
+flag (O_RDWR in Unix). In some cases sending power management commands to
+ATA disks are defeated by OS actions on the close() if the \fIDEVICE\fR was
+opened with the read\-write flag (e.g. the OS might think it needs to
+flush something to disk).
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+increases the level or verbosity.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+print out version string
+.SH NOTES
+Prior to Linux kernel 2.6.29 USB mass storage limited sense data to 18 bytes
+which made the \fB\-\-ck_cond\fR option yield strange (truncated) results.
+.SH EXIT STATUS
+The exit status of sg_sat_read_gplog is 0 when it is successful. Otherwise
+see the sg3_utils(8) man page.
+.SH AUTHOR
+Written by Hannes Reinecke and Douglas Gilbert
+.SH "REPORTING BUGS"
+Report bugs to <dgilbert at interlog dot com>.
+.SH COPYRIGHT
+Copyright \(co 2014 Hannes Reinecke, SUSE Linux GmbH
+.br
+This software is distributed under a FreeBSD license. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+.SH "SEE ALSO"
+.B sg_sat_identify(sg3_utils), sg_inq(sg3_utils), sdparm(sdparm),
+.B hdparm(hdparm)
diff --git a/doc/sg_sat_set_features.8 b/doc/sg_sat_set_features.8
index 02079fcd..d732c3de 100644
--- a/doc/sg_sat_set_features.8
+++ b/doc/sg_sat_set_features.8
@@ -1,12 +1,13 @@
-.TH SG_SAT_SET_FEATURES "8" "April 2014" "sg3_utils\-1.39" SG3_UTILS
+.TH SG_SAT_SET_FEATURES "8" "November 2014" "sg3_utils\-1.40" SG3_UTILS
.SH NAME
sg_sat_set_features \- use ATA SET FEATURES command via a SCSI to ATA
Translation (SAT) layer
.SH SYNOPSIS
.B sg_sat_set_features
-[\fI\-\-count=CO\fR] [\fI\-\-ck_cond\fR] [\fI\-\-feature=FEA\fR]
-[\fI\-\-help\fR] [\fI\-\-lba=LBA\fR] [\fI\-\-len=\fR{16|12}]
-[\fI\-\-readonly\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR] \fIDEVICE\fR
+[\fI\-\-count=CO\fR] [\fI\-\-ck_cond\fR] [\fI--extended\fR]
+[\fI\-\-feature=FEA\fR] [\fI\-\-help\fR] [\fI\-\-lba=LBA\fR]
+[\fI\-\-len=\fR{16|12}] [\fI\-\-readonly\fR] [\fI\-\-verbose\fR]
+[\fI\-\-version\fR] \fIDEVICE\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -44,6 +45,11 @@ sense buffer containing a ATA Result descriptor irrespective of whether
the ATA command succeeded or failed. When clear the SATL should only yield
a sense buffer containing a ATA Result descriptor if the ATA command failed.
.TP
+\fB\-e\fR, \fB\-\-extended\fR
+allow for extended LBA numbers (i.e. larger than 32 bits).
+This value is enabled automatically for large LBA numbers, but can be
+enabled explicitly even for low LBA numbers with this option.
+.TP
\fB\-f\fR, \fB\-\-feature\fR=\fIFEA\fR
the value \fIFEA\fR is placed in the "feature" field in the ATA SET
FEATURES command. The term "subcommand" is sometimes used for this
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index 452b05c1..bce3ec89 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -17,7 +17,7 @@
#endif
-const char * sg_lib_version_str = "2.07 20141019"; /* spc4r37a, sbc4r02 */
+const char * sg_lib_version_str = "2.08 20141110"; /* spc4r37a, sbc4r02 */
#ifdef SG_SCSI_STRINGS
struct sg_lib_value_name_t sg_lib_normal_opcodes[] = {
@@ -511,7 +511,7 @@ struct sg_lib_value_name_t sg_lib_variable_length_arr[] = {
/* A conveniently formatted list of SCSI ASC/ASCQ codes and their
* corresponding text can be found at: www.t10.org/lists/asc-num.txt
- * The following should match asc-num.txt dated 20140516 */
+ * The following should match asc-num.txt dated 20140924 */
#ifdef SG_SCSI_STRINGS
struct sg_lib_asc_ascq_range_t sg_lib_asc_ascq_range[] =
@@ -612,6 +612,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
{0x09,0x02,"Focus servo failure"},
{0x09,0x03,"Spindle servo failure"},
{0x09,0x04,"Head select fault"},
+ {0x09,0x05,"Vibration induced tracking error"},
{0x0A,0x00,"Error log overflow"},
{0x0B,0x00,"Warning"},
{0x0B,0x01,"Warning - specified temperature exceeded"},
@@ -639,6 +640,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
{0x0C,0x0D,"Write error - not enough unsolicited data"},
{0x0C,0x0E,"Multiple write errors"},
{0x0C,0x0F,"Defects in error window"},
+ {0x0C,0x10,"Incomplete multiple atomic write operations"},
{0x0D,0x00,"Error detected by third party temporary initiator"},
{0x0D,0x01,"Third party device failure"},
{0x0D,0x02,"Copy target device not reachable"},
diff --git a/scripts/58-scsi-sg3_symlink.rules b/scripts/58-scsi-sg3_symlink.rules
index a95cbcb1..697f92b9 100644
--- a/scripts/58-scsi-sg3_symlink.rules
+++ b/scripts/58-scsi-sg3_symlink.rules
@@ -10,6 +10,7 @@ ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="sg3_utils_symlink_end"
# Select which identifier to use per default
# 0: vpd page 0x80 identifier
ENV{SCSI_IDENT_SERIAL}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-S$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_SERIAL}"
+ENV{SCSI_IDENT_SERIAL}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-S$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_SERIAL}-part%n"
# 1: NAA identifier (prefix 3)
ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-3$env{SCSI_IDENT_LUN_NAA}"
ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-3$env{SCSI_IDENT_LUN_NAA}-part%n"
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 0fe8dbd4..a6eb8b3d 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@ fi
%{_libdir}/*.la
%changelog
-* Fri Oct 24 2014 - dgilbert at interlog dot com
+* Mon Nov 10 2014 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.40
diff --git a/src/Makefile.am b/src/Makefile.am
index db147e43..ca671171 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,10 +15,11 @@ bin_PROGRAMS = \
sg_rdac sg_read sg_readcap sg_read_block_limits sg_read_buffer \
sg_read_long sg_reassign sg_referrals sg_rep_zones sg_requests \
sg_reset sg_reset_wp sg_rmsn sg_rtpg sg_safte sg_sanitize \
- sg_sat_identify sg_sat_phy_event sg_sat_set_features sg_scan \
- sg_senddiag sg_ses sg_ses_microcode sg_start sg_stpg sg_sync \
- sg_test_rwbuf sg_turs sg_unmap sg_verify sg_vpd sg_write_buffer \
- sg_write_long sg_write_same sg_write_verify sg_wr_mode sg_xcopy
+ sg_sat_identify sg_sat_phy_event sg_sat_read_gplog \
+ sg_sat_set_features sg_scan sg_senddiag sg_ses sg_ses_microcode \
+ sg_start sg_stpg sg_sync sg_test_rwbuf sg_turs sg_unmap sg_verify \
+ sg_vpd sg_write_buffer sg_write_long sg_write_same sg_write_verify \
+ sg_wr_mode sg_xcopy
distclean-local:
rm -f sg_scan.c
@@ -38,9 +39,9 @@ bin_PROGRAMS = \
sg_read_block_limits sg_read_buffer sg_read_long sg_reassign \
sg_referrals sg_rep_zones sg_requests sg_reset_wp sg_rmsn \
sg_rtpg sg_safte sg_sanitize sg_sat_identify sg_sat_phy_event \
- sg_sat_set_features sg_scan sg_senddiag sg_ses sg_ses_microcode \
- sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify sg_vpd \
- sg_write_buffer sg_write_long sg_write_same sg_write_verify \
+ sg_sat_read_gplog sg_sat_set_features sg_scan sg_senddiag sg_ses \
+ sg_ses_microcode sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify \
+ sg_vpd sg_write_buffer sg_write_long sg_write_same sg_write_verify \
sg_wr_mode
distclean-local:
@@ -61,9 +62,9 @@ bin_PROGRAMS = \
sg_read_block_limits sg_read_buffer sg_read_long sg_reassign \
sg_referrals sg_rep_zones sg_requests sg_reset_wp sg_rmsn \
sg_rtpg sg_safte sg_sanitize sg_sat_identify sg_sat_phy_event \
- sg_sat_set_features sg_scan sg_senddiag sg_ses sg_ses_microcode \
- sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify sg_vpd \
- sg_write_buffer sg_write_long sg_write_same sg_write_verify \
+ sg_sat_read_gplog sg_sat_set_features sg_scan sg_senddiag sg_ses \
+ sg_ses_microcode sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify \
+ sg_vpd sg_write_buffer sg_write_long sg_write_same sg_write_verify \
sg_wr_mode
distclean-local:
@@ -84,9 +85,9 @@ bin_PROGRAMS = \
sg_read_block_limits sg_read_buffer sg_read_long sg_reassign \
sg_referrals sg_rep_zones sg_requests sg_reset_wp sg_rmsn \
sg_rtpg sg_safte sg_sanitize sg_sat_identify sg_sat_phy_event \
- sg_sat_set_features sg_senddiag sg_ses sg_ses_microcode \
- sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify sg_vpd \
- sg_write_buffer sg_write_long sg_write_same sg_write_verify \
+ sg_sat_read_gplog sg_sat_set_features sg_senddiag sg_ses \
+ sg_ses_microcode sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify \
+ sg_vpd sg_write_buffer sg_write_long sg_write_same sg_write_verify \
sg_wr_mode
endif
@@ -101,9 +102,10 @@ bin_PROGRAMS = \
sg_read_block_limits sg_read_buffer sg_read_long sg_reassign \
sg_referrals sg_rep_zones sg_requests sg_reset_wp sg_rmsn \
sg_rtpg sg_safte sg_sanitize sg_sat_identify sg_sat_phy_event \
- sg_sat_set_features sg_senddiag sg_ses sg_ses_microcode sg_start \
- sg_stpg sg_sync sg_turs sg_unmap sg_verify sg_vpd sg_write_buffer \
- sg_write_long sg_write_same sg_write_verify sg_wr_mode
+ sg_sat_read_gplog sg_sat_set_features sg_senddiag sg_ses \
+ sg_ses_microcode sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify \
+ sg_vpd sg_write_buffer sg_write_long sg_write_same sg_write_verify \
+ sg_wr_mode
endif
@@ -117,9 +119,10 @@ bin_PROGRAMS = \
sg_read_block_limits sg_read_buffer sg_read_long sg_reassign \
sg_referrals sg_rep_zones sg_requests sg_reset_wp sg_rmsn sg_rtpg \
sg_safte sg_sanitize sg_sat_identify sg_sat_phy_event \
- sg_sat_set_features sg_senddiag sg_ses sg_ses_microcode sg_start \
- sg_stpg sg_sync sg_turs sg_unmap sg_verify sg_vpd sg_write_buffer \
- sg_write_long sg_write_same sg_write_verify sg_wr_mode
+ sg_sat_read_gplog sg_sat_set_features sg_senddiag sg_ses \
+ sg_ses_microcode sg_start sg_stpg sg_sync sg_turs sg_unmap sg_verify \
+ sg_vpd sg_write_buffer sg_write_long sg_write_same sg_write_verify \
+ sg_wr_mode
endif
@@ -314,3 +317,6 @@ sg_reset_wp_LDADD = ../lib/libsgutils2.la @os_libs@
sg_write_verify_SOURCES = sg_write_verify.c
sg_write_verify_LDADD = ../lib/libsgutils2.la @os_libs@
+
+sg_sat_read_gplog_SOURCES = sg_sat_read_gplog.c
+sg_sat_read_gplog_LDADD = ../lib/libsgutils2.la @os_libs@
diff --git a/src/Makefile.in b/src/Makefile.in
index f926941b..8baf8f4f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -108,6 +108,7 @@ host_triplet = @host@
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_FALSE@@OS_WIN32_MINGW_TRUE@ sg_sanitize$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_FALSE@@OS_WIN32_MINGW_TRUE@ sg_sat_identify$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_FALSE@@OS_WIN32_MINGW_TRUE@ sg_sat_phy_event$(EXEEXT) \
+@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_FALSE@@OS_WIN32_MINGW_TRUE@ sg_sat_read_gplog$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_FALSE@@OS_WIN32_MINGW_TRUE@ sg_sat_set_features$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_FALSE@@OS_WIN32_MINGW_TRUE@ sg_scan$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_FALSE@@OS_WIN32_MINGW_TRUE@ sg_senddiag$(EXEEXT) \
@@ -155,6 +156,7 @@ host_triplet = @host@
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_TRUE@ sg_sanitize$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_TRUE@ sg_sat_identify$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_TRUE@ sg_sat_phy_event$(EXEEXT) \
+@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_TRUE@ sg_sat_read_gplog$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_TRUE@ sg_sat_set_features$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_TRUE@ sg_scan$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_FALSE@@OS_WIN32_CYGWIN_TRUE@ sg_senddiag$(EXEEXT) \
@@ -202,6 +204,7 @@ host_triplet = @host@
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_TRUE@ sg_sanitize$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_TRUE@ sg_sat_identify$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_TRUE@ sg_sat_phy_event$(EXEEXT) \
+@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_TRUE@ sg_sat_read_gplog$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_TRUE@ sg_sat_set_features$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_TRUE@ sg_senddiag$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_FALSE@@OS_SOLARIS_TRUE@ sg_ses$(EXEEXT) \
@@ -248,6 +251,7 @@ host_triplet = @host@
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_TRUE@ sg_sanitize$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_TRUE@ sg_sat_identify$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_TRUE@ sg_sat_phy_event$(EXEEXT) \
+@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_TRUE@ sg_sat_read_gplog$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_TRUE@ sg_sat_set_features$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_TRUE@ sg_senddiag$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_OSF_TRUE@ sg_ses$(EXEEXT) \
@@ -305,6 +309,7 @@ host_triplet = @host@
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ sg_sanitize$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ sg_sat_identify$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ sg_sat_phy_event$(EXEEXT) \
+@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ sg_sat_read_gplog$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ sg_sat_set_features$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ sg_scan$(EXEEXT) \
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ sg_senddiag$(EXEEXT) \
@@ -341,6 +346,7 @@ host_triplet = @host@
@OS_FREEBSD_TRUE@ sg_rtpg$(EXEEXT) sg_safte$(EXEEXT) \
@OS_FREEBSD_TRUE@ sg_sanitize$(EXEEXT) sg_sat_identify$(EXEEXT) \
@OS_FREEBSD_TRUE@ sg_sat_phy_event$(EXEEXT) \
+@OS_FREEBSD_TRUE@ sg_sat_read_gplog$(EXEEXT) \
@OS_FREEBSD_TRUE@ sg_sat_set_features$(EXEEXT) \
@OS_FREEBSD_TRUE@ sg_senddiag$(EXEEXT) sg_ses$(EXEEXT) \
@OS_FREEBSD_TRUE@ sg_ses_microcode$(EXEEXT) sg_start$(EXEEXT) \
@@ -481,6 +487,9 @@ sg_sat_identify_DEPENDENCIES = ../lib/libsgutils2.la
am_sg_sat_phy_event_OBJECTS = sg_sat_phy_event.$(OBJEXT)
sg_sat_phy_event_OBJECTS = $(am_sg_sat_phy_event_OBJECTS)
sg_sat_phy_event_DEPENDENCIES = ../lib/libsgutils2.la
+am_sg_sat_read_gplog_OBJECTS = sg_sat_read_gplog.$(OBJEXT)
+sg_sat_read_gplog_OBJECTS = $(am_sg_sat_read_gplog_OBJECTS)
+sg_sat_read_gplog_DEPENDENCIES = ../lib/libsgutils2.la
am_sg_sat_set_features_OBJECTS = sg_sat_set_features.$(OBJEXT)
sg_sat_set_features_OBJECTS = $(am_sg_sat_set_features_OBJECTS)
sg_sat_set_features_DEPENDENCIES = ../lib/libsgutils2.la
@@ -597,8 +606,8 @@ SOURCES = $(sg_compare_and_write_SOURCES) $(sg_copy_results_SOURCES) \
$(sg_reset_SOURCES) $(sg_reset_wp_SOURCES) $(sg_rmsn_SOURCES) \
$(sg_rtpg_SOURCES) $(sg_safte_SOURCES) $(sg_sanitize_SOURCES) \
$(sg_sat_identify_SOURCES) $(sg_sat_phy_event_SOURCES) \
- $(sg_sat_set_features_SOURCES) $(sg_scan_SOURCES) \
- $(sg_senddiag_SOURCES) $(sg_ses_SOURCES) \
+ $(sg_sat_read_gplog_SOURCES) $(sg_sat_set_features_SOURCES) \
+ $(sg_scan_SOURCES) $(sg_senddiag_SOURCES) $(sg_ses_SOURCES) \
$(sg_ses_microcode_SOURCES) $(sg_start_SOURCES) \
$(sg_stpg_SOURCES) $(sg_sync_SOURCES) $(sg_test_rwbuf_SOURCES) \
$(sg_turs_SOURCES) $(sg_unmap_SOURCES) $(sg_verify_SOURCES) \
@@ -624,8 +633,8 @@ DIST_SOURCES = $(sg_compare_and_write_SOURCES) \
$(sg_reset_SOURCES) $(sg_reset_wp_SOURCES) $(sg_rmsn_SOURCES) \
$(sg_rtpg_SOURCES) $(sg_safte_SOURCES) $(sg_sanitize_SOURCES) \
$(sg_sat_identify_SOURCES) $(sg_sat_phy_event_SOURCES) \
- $(sg_sat_set_features_SOURCES) $(sg_scan_SOURCES) \
- $(sg_senddiag_SOURCES) $(sg_ses_SOURCES) \
+ $(sg_sat_read_gplog_SOURCES) $(sg_sat_set_features_SOURCES) \
+ $(sg_scan_SOURCES) $(sg_senddiag_SOURCES) $(sg_ses_SOURCES) \
$(sg_ses_microcode_SOURCES) $(sg_start_SOURCES) \
$(sg_stpg_SOURCES) $(sg_sync_SOURCES) $(sg_test_rwbuf_SOURCES) \
$(sg_turs_SOURCES) $(sg_unmap_SOURCES) $(sg_verify_SOURCES) \
@@ -905,6 +914,8 @@ sg_reset_wp_SOURCES = sg_reset_wp.c
sg_reset_wp_LDADD = ../lib/libsgutils2.la @os_libs@
sg_write_verify_SOURCES = sg_write_verify.c
sg_write_verify_LDADD = ../lib/libsgutils2.la @os_libs@
+sg_sat_read_gplog_SOURCES = sg_sat_read_gplog.c
+sg_sat_read_gplog_LDADD = ../lib/libsgutils2.la @os_libs@
all: all-am
.SUFFIXES:
@@ -1141,6 +1152,10 @@ sg_sat_phy_event$(EXEEXT): $(sg_sat_phy_event_OBJECTS) $(sg_sat_phy_event_DEPEND
@rm -f sg_sat_phy_event$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sg_sat_phy_event_OBJECTS) $(sg_sat_phy_event_LDADD) $(LIBS)
+sg_sat_read_gplog$(EXEEXT): $(sg_sat_read_gplog_OBJECTS) $(sg_sat_read_gplog_DEPENDENCIES) $(EXTRA_sg_sat_read_gplog_DEPENDENCIES)
+ @rm -f sg_sat_read_gplog$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(sg_sat_read_gplog_OBJECTS) $(sg_sat_read_gplog_LDADD) $(LIBS)
+
sg_sat_set_features$(EXEEXT): $(sg_sat_set_features_OBJECTS) $(sg_sat_set_features_DEPENDENCIES) $(EXTRA_sg_sat_set_features_DEPENDENCIES)
@rm -f sg_sat_set_features$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sg_sat_set_features_OBJECTS) $(sg_sat_set_features_LDADD) $(LIBS)
@@ -1274,6 +1289,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_sanitize.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_sat_identify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_sat_phy_event.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_sat_read_gplog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_sat_set_features.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_scan.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_senddiag.Po@am__quote@
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 65fa1ad1..ca3d5395 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -41,7 +41,7 @@
#include "sg_cmds_basic.h"
#include "sg_pt.h"
-static const char * version_str = "1.42 20141016"; /* SPC-4 rev 37 */
+static const char * version_str = "1.43 20141107"; /* SPC-4 rev 37 */
/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
@@ -1520,7 +1520,7 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
switch (desig_type) {
case 0: /* vendor specific */
k = 0;
- if ((1 == c_set) || (2 == c_set)) { /* ASCII or UTF-8 */
+ if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
for (k = 0; (k < i_len) && isprint(ip[k]); ++k)
;
if (k >= i_len)
@@ -1834,6 +1834,8 @@ export_dev_ids(unsigned char * buff, int len, int verbose)
}
switch (desig_type) {
case 0: /* vendor specific */
+ if (i_len > 128)
+ break;
printf("SCSI_IDENT_%s_VENDOR=", assoc_str);
if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
k = encode_whitespaces(ip, i_len);
@@ -1972,6 +1974,16 @@ export_dev_ids(unsigned char * buff, int len, int verbose)
}
break;
}
+ if (strncmp((const char *)ip, "eui.", 4) ||
+ strncmp((const char *)ip, "naa.", 4) ||
+ strncmp((const char *)ip, "iqn.", 4)) {
+ if (verbose) {
+ pr2serr(" << expected name string prefix>>\n");
+ dStrHexErr((const char *)ip, i_len, -1);
+ }
+ break;
+ }
+
printf("SCSI_IDENT_%s_NAME=%.*s\n", assoc_str, i_len,
(const char *)ip);
break;
diff --git a/src/sg_sat_identify.c b/src/sg_sat_identify.c
index bedd5359..9fa2a7fa 100644
--- a/src/sg_sat_identify.c
+++ b/src/sg_sat_identify.c
@@ -45,7 +45,7 @@
#define EBUFF_SZ 256
-static const char * version_str = "1.11 20141030";
+static const char * version_str = "1.11 20141110";
static struct option long_options[] = {
{"ck_cond", no_argument, 0, 'c'},
@@ -317,9 +317,11 @@ static int do_identify_dev(int sg_fd, int do_packet, int cdb_len,
else if (2 == do_hex)
dWordHex((const unsigned short *)inBuff, 256, 0,
sg_is_big_endian());
- else /* '-HHH' output suitable for "hdparm --Istdin" */
+ else if (3 == do_hex) /* '-HHH' suitable for "hdparm --Istdin" */
dWordHex((const unsigned short *)inBuff, 256, -2,
sg_is_big_endian());
+ else /* '-HHHH' hex bytes only */
+ dStrHex((const char *)inBuff, 512, -1);
}
return 0;
}
diff --git a/src/sg_sat_read_gplog.c b/src/sg_sat_read_gplog.c
new file mode 100644
index 00000000..07576358
--- /dev/null
+++ b/src/sg_sat_read_gplog.c
@@ -0,0 +1,454 @@
+/*
+ * Copyright (c) 2014 Hannes Reinecke, SUSE Linux GmbH.
+ * All rights reserved.
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the BSD_LICENSE file.
+ */
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "sg_lib.h"
+#include "sg_cmds_basic.h"
+#include "sg_cmds_extra.h"
+
+/* This program uses a ATA PASS-THROUGH SCSI command. This usage is
+ * defined in the SCSI to ATA Translation (SAT) drafts and standards.
+ * See http://www.t10.org for drafts. SAT is a standard: SAT ANSI INCITS
+ * 431-2007 (draft prior to that is sat-r09.pdf). SAT-2 is also a
+ * standard: SAT-2 ANSI INCITS 465-2010 and the draft prior to that is
+ * sat2r09.pdf . The SAT-3 project has started and the most recent draft
+ * is sat3r01.pdf .
+ */
+
+/* This program performs a ATA PASS-THROUGH (16) SCSI command in order
+ * to perform an ATA READ LOG EXT or ATA READ LOG DMA EXT command.
+ *
+ * See man page (sg_sat_read_gplog.8) for details.
+ */
+
+#define SAT_ATA_PASS_THROUGH16 0x85
+#define SAT_ATA_PASS_THROUGH16_LEN 16
+#define SAT_ATA_PASS_THROUGH12 0xa1 /* clashes with MMC BLANK comand */
+#define SAT_ATA_PASS_THROUGH12_LEN 12
+#define SAT_ATA_RETURN_DESC 9 /* ATA Return (sense) Descriptor */
+#define ASCQ_ATA_PT_INFO_AVAILABLE 0x1d
+
+#define ATA_READ_LOG_EXT 0x2f
+#define ATA_READ_LOG_DMA_EXT 0x47
+
+#define DEF_TIMEOUT 20
+
+static const char * version_str = "1.09 20141110";
+
+struct opts_t {
+ int cdb_len;
+ int ck_cond;
+ int count;
+ int hex;
+ int la; /* log address */
+ int pn; /* page number within log address */
+ int rdonly;
+ int verbose;
+ const char * device_name;
+};
+
+static struct option long_options[] = {
+ {"count", required_argument, 0, 'c'},
+ {"ck_cond", no_argument, 0, 'C'},
+ {"dma", no_argument, 0, 'd'},
+ {"help", no_argument, 0, 'h'},
+ {"hex", no_argument, 0, 'H'},
+ {"len", required_argument, 0, 'l'},
+ {"log", required_argument, 0, 'L'},
+ {"page", required_argument, 0, 'p'},
+ {"readonly", no_argument, 0, 'r'},
+ {"verbose", no_argument, 0, 'v'},
+ {"version", no_argument, 0, 'V'},
+ {0, 0, 0, 0},
+};
+
+
+#ifdef __GNUC__
+static int pr2serr(const char * fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
+#else
+static int pr2serr(const char * fmt, ...);
+#endif
+
+
+static int
+pr2serr(const char * fmt, ...)
+{
+ va_list args;
+ int n;
+
+ va_start(args, fmt);
+ n = vfprintf(stderr, fmt, args);
+ va_end(args);
+ return n;
+}
+
+static void
+usage()
+{
+ pr2serr("Usage: "
+ "sg_sat_read_gplog [--ck_cond] [--count=CO] [--dma] [--help]\n"
+ " [--hex] [--len=16|12] [--log=LA] "
+ "[--page=PN]\n"
+ " [--readonly] [--verbose] [--version] "
+ "DEVICE\n"
+ " where:\n"
+ " --ck_cond | -C set ck_cond field in pass-through "
+ "(def: 0)\n"
+ " --count=CO | -c CO block count (def: 1)\n"
+ " --dma | -d Use READ LOG DMA EXT (def: READ LOG "
+ "EXT)\n"
+ " --help | -h output this usage message\n"
+ " --hex | -H output response in hex bytes, -HH "
+ "yields hex\n"
+ " words + ASCII (def), -HHH hex words "
+ "only\n"
+ " --len=16|12 | -l 16|12 cdb length: 16 or 12 bytes "
+ "(def: 16)\n"
+ " --log=LA | -L LA Log address to be read (def: 0)\n"
+ " --page=PN|-p PN Log page number within address (def: "
+ "0)\n"
+ " --readonly | -r open DEVICE read-only (def: "
+ "read-write)\n"
+ " --verbose | -v increase verbosity\n"
+ " recommended if DEVICE is ATA disk\n"
+ " --version | -V print version string and exit\n\n"
+ "Sends an ATA READ LOG EXT (or READ LOG DMA EXT) command via a "
+ "SAT pass\nthrough to fetch a General Purpose (GP) log page. Each "
+ "page is accessed\nvia a log address and then a page number "
+ "within that address: LA,PN .\n"
+ "By default the output is the response in hex (16 bit) words.\n"
+ );
+}
+
+static int
+do_read_gplog(int sg_fd, int ata_cmd, unsigned char *inbuff,
+ const struct opts_t * op)
+{
+ int res, ret;
+ int extend = 1;
+ int protocol;
+ int t_dir = 1; /* 0 -> to device, 1 -> from device */
+ int byte_block = 1; /* 0 -> bytes, 1 -> 512 byte blocks */
+ int t_length = 2; /* 0 -> no data transferred, 2 -> sector count */
+ int t_type = 0; /* 0 -> 512 byte blocks, 1 -> logical sectors */
+ int resid = 0;
+ int got_ard = 0; /* got ATA result descriptor */
+ int sb_sz;
+ struct sg_scsi_sense_hdr ssh;
+ unsigned char sense_buffer[64];
+ unsigned char ata_return_desc[16];
+ unsigned char aptCmdBlk[SAT_ATA_PASS_THROUGH16_LEN] =
+ {SAT_ATA_PASS_THROUGH16, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
+ unsigned char apt12CmdBlk[SAT_ATA_PASS_THROUGH12_LEN] =
+ {SAT_ATA_PASS_THROUGH12, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
+ char cmd_name[32];
+
+ snprintf(cmd_name, sizeof(cmd_name), "ATA PASS-THROUGH (%d)",
+ op->cdb_len);
+ if (ata_cmd == ATA_READ_LOG_DMA_EXT) {
+ protocol = 6; /* DMA */
+ } else {
+ protocol = 4; /* PIO Data-In */
+ }
+ sb_sz = sizeof(sense_buffer);
+ memset(sense_buffer, 0, sb_sz);
+ memset(ata_return_desc, 0, sizeof(ata_return_desc));
+ memset(inbuff, 0, op->count * 512);
+ if (op->verbose > 1)
+ pr2serr("Building ATA READ LOG%s EXT command; la=0x%x, pn=0x%x\n",
+ ((ata_cmd == ATA_READ_LOG_DMA_EXT) ? " DMA" : ""), op->la,
+ op->pn);
+ if (op->cdb_len == 16) {
+ /* Prepare ATA PASS-THROUGH COMMAND (16) command */
+ aptCmdBlk[14] = ata_cmd;
+ aptCmdBlk[5] = (op->count >> 8) & 0xff;
+ aptCmdBlk[6] = op->count & 0xff;
+ aptCmdBlk[8] = op->la;
+ aptCmdBlk[9] = (op->pn >> 8) & 0xff;
+ aptCmdBlk[10] = op->pn & 0xff;
+ aptCmdBlk[1] = (protocol << 1) | extend;
+ aptCmdBlk[2] = (op->ck_cond << 5) | (t_type << 4) | (t_dir << 3) |
+ (byte_block << 2) | t_length;
+ res = sg_ll_ata_pt(sg_fd, aptCmdBlk, op->cdb_len, DEF_TIMEOUT, inbuff,
+ NULL, op->count * 512, sense_buffer,
+ sb_sz, ata_return_desc,
+ sizeof(ata_return_desc), &resid, op->verbose);
+ } else {
+ /* Prepare ATA PASS-THROUGH COMMAND (12) command */
+ apt12CmdBlk[9] = ata_cmd;
+ apt12CmdBlk[4] = op->count;
+ apt12CmdBlk[5] = op->la;
+ apt12CmdBlk[6] = op->pn & 0xff;
+ apt12CmdBlk[7] = (op->pn >> 8) & 0xff;
+ apt12CmdBlk[1] = (protocol << 1);
+ apt12CmdBlk[2] = (op->ck_cond << 5) | (t_type << 4) | (t_dir << 3) |
+ (byte_block << 2) | t_length;
+ res = sg_ll_ata_pt(sg_fd, apt12CmdBlk, op->cdb_len, DEF_TIMEOUT,
+ inbuff, NULL, op->count * 512, sense_buffer,
+ sb_sz, ata_return_desc,
+ sizeof(ata_return_desc), &resid, op->verbose);
+ }
+ if (0 == res) {
+ if (op->verbose > 2)
+ pr2serr("command completed with SCSI GOOD status\n");
+ if ((0 == op->hex) || (2 == op->hex))
+ dWordHex((const unsigned short *)inbuff, op->count * 256, 0,
+ sg_is_big_endian());
+ else if (1 == op->hex)
+ dStrHex((const char *)inbuff, 512, 0);
+ else if (3 == op->hex) /* '-HHH' suitable for "hdparm --Istdin" */
+ dWordHex((const unsigned short *)inbuff, 256, -2,
+ sg_is_big_endian());
+ else /* '-HHHH' hex bytes only */
+ dStrHex((const char *)inbuff, 512, -1);
+ } else if ((res > 0) && (res & SAM_STAT_CHECK_CONDITION)) {
+ if (op->verbose > 1)
+ sg_print_sense("ATA pass through", sense_buffer, sb_sz,
+ ((op->verbose > 2) ? 1 : 0));
+ if (sg_scsi_normalize_sense(sense_buffer, sb_sz, &ssh)) {
+ switch (ssh.sense_key) {
+ case SPC_SK_ILLEGAL_REQUEST:
+ if ((0x20 == ssh.asc) && (0x0 == ssh.ascq)) {
+ ret = SG_LIB_CAT_INVALID_OP;
+ if (op->verbose < 2)
+ pr2serr("%s not supported\n", cmd_name);
+ } else {
+ ret = SG_LIB_CAT_ILLEGAL_REQ;
+ if (op->verbose < 2)
+ pr2serr("%s, bad field in cdb\n", cmd_name);
+ }
+ return ret;
+ case SPC_SK_NO_SENSE:
+ case SPC_SK_RECOVERED_ERROR:
+ if ((0x0 == ssh.asc) &&
+ (ASCQ_ATA_PT_INFO_AVAILABLE == ssh.ascq)) {
+ if (SAT_ATA_RETURN_DESC != ata_return_desc[0]) {
+ if (op->verbose)
+ pr2serr("did not find ATA Return (sense) "
+ "Descriptor\n");
+ return SG_LIB_CAT_RECOVERED;
+ }
+ got_ard = 1;
+ break;
+ } else if (SPC_SK_RECOVERED_ERROR == ssh.sense_key)
+ return SG_LIB_CAT_RECOVERED;
+ else {
+ if ((0x0 == ssh.asc) && (0x0 == ssh.ascq))
+ break;
+ return SG_LIB_CAT_SENSE;
+ }
+ case SPC_SK_UNIT_ATTENTION:
+ if (op->verbose < 2)
+ pr2serr("%s, Unit Attention detected\n", cmd_name);
+ return SG_LIB_CAT_UNIT_ATTENTION;
+ case SPC_SK_NOT_READY:
+ if (op->verbose < 2)
+ pr2serr("%s, device not ready\n", cmd_name);
+ return SG_LIB_CAT_NOT_READY;
+ case SPC_SK_MEDIUM_ERROR:
+ case SPC_SK_HARDWARE_ERROR:
+ if (op->verbose < 2)
+ pr2serr("%s, medium or hardware error\n", cmd_name);
+ return SG_LIB_CAT_MEDIUM_HARD;
+ case SPC_SK_ABORTED_COMMAND:
+ if (0x10 == ssh.asc) {
+ pr2serr("Aborted command: protection information\n");
+ return SG_LIB_CAT_PROTECTION;
+ } else {
+ pr2serr("Aborted command\n");
+ return SG_LIB_CAT_ABORTED_COMMAND;
+ }
+ case SPC_SK_DATA_PROTECT:
+ pr2serr("%s: data protect, read only media?\n", cmd_name);
+ return SG_LIB_CAT_DATA_PROTECT;
+ default:
+ if (op->verbose < 2)
+ pr2serr("%s, some sense data, use '-v' for more "
+ "information\n", cmd_name);
+ return SG_LIB_CAT_SENSE;
+ }
+ } else {
+ pr2serr("CHECK CONDITION without response code ??\n");
+ return SG_LIB_CAT_SENSE;
+ }
+ if (0x72 != (sense_buffer[0] & 0x7f)) {
+ pr2serr("expected descriptor sense format, response "
+ "code=0x%x\n", sense_buffer[0]);
+ return SG_LIB_CAT_MALFORMED;
+ }
+ } else if (res > 0) {
+ if (SAM_STAT_RESERVATION_CONFLICT == res) {
+ pr2serr("SCSI status: RESERVATION CONFLICT\n");
+ return SG_LIB_CAT_RES_CONFLICT;
+ } else {
+ pr2serr("Unexpected SCSI status=0x%x\n", res);
+ return SG_LIB_CAT_MALFORMED;
+ }
+ } else {
+ pr2serr("%s failed\n", cmd_name);
+ if (op->verbose < 2)
+ pr2serr(" try adding '-v' for more information\n");
+ return -1;
+ }
+
+ if ((SAT_ATA_RETURN_DESC == ata_return_desc[0]) && (0 == got_ard))
+ pr2serr("Seem to have got ATA Result Descriptor but it was not "
+ "indicated\n");
+ if (got_ard) {
+ if (ata_return_desc[3] & 0x4) {
+ pr2serr("error indication in returned FIS: aborted "
+ "command\n");
+ return SG_LIB_CAT_ABORTED_COMMAND;
+ }
+ }
+ return 0;
+}
+
+
+int
+main(int argc, char * argv[])
+{
+ int sg_fd, c, ret, res, n;
+ int ata_cmd = ATA_READ_LOG_EXT;
+ unsigned char *inbuff;
+ struct opts_t opts;
+ struct opts_t * op;
+
+ op = &opts;
+ memset(op, 0, sizeof(opts));
+ op->cdb_len = SAT_ATA_PASS_THROUGH16_LEN;
+ op->count = 1;
+ while (1) {
+ int option_index = 0;
+
+ c = getopt_long(argc, argv, "c:CdhHl:L:p:rvV", long_options,
+ &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'c':
+ op->count = sg_get_num(optarg);
+ if ((op->count < 1) || (op->count > 0xffff)) {
+ pr2serr("bad argument for '--count'\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
+ case 'C':
+ op->ck_cond = 1;
+ break;
+ case 'd':
+ ata_cmd = ATA_READ_LOG_DMA_EXT;
+ break;
+ case 'h':
+ case '?':
+ usage();
+ return 0;
+ case 'H':
+ ++op->hex;
+ break;
+ case 'l':
+ op->cdb_len = sg_get_num(optarg);
+ if (! ((op->cdb_len == 12) || (op->cdb_len == 16))) {
+ pr2serr("argument to '--len' should be 12 or 16\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
+ case 'L':
+ op->la = sg_get_num(optarg);
+ if (op->la < 0 || op->la > 0xff) {
+ pr2serr("bad argument for '--log'\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
+ case 'p':
+ op->pn = sg_get_num(optarg);
+ if ((op->pn < 0) || (op->pn > 0xffff)) {
+ pr2serr("bad argument for '--page'\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
+ case 'r':
+ ++op->rdonly;
+ break;
+ case 'v':
+ ++op->verbose;
+ break;
+ case 'V':
+ pr2serr("version: %s\n", version_str);
+ return 0;
+ default:
+ pr2serr("unrecognised option code 0x%x ??\n", c);
+ usage();
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ }
+ if (optind < argc) {
+ if (NULL == op->device_name) {
+ op->device_name = argv[optind];
+ ++optind;
+ }
+ if (optind < argc) {
+ for (; optind < argc; ++optind)
+ pr2serr("Unexpected extra argument: %s\n",
+ argv[optind]);
+ usage();
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ }
+
+ if (NULL == op->device_name) {
+ pr2serr("missing device name!\n");
+ usage();
+ return 1;
+ }
+
+ if ((op->count > 0xff) && (12 == op->cdb_len)) {
+ op->cdb_len = 16;
+ if (op->verbose)
+ pr2serr("Since count > 0xff, forcing cdb length to "
+ "16\n");
+ }
+
+ n = op->count * 512;
+ inbuff = malloc(n);
+ if (!inbuff) {
+ pr2serr("Cannot allocate output buffer of size %d\n", n);
+ return SG_LIB_CAT_OTHER;
+ }
+
+ if ((sg_fd = sg_cmds_open_device(op->device_name, op->rdonly,
+ op->verbose)) < 0) {
+ pr2serr("error opening file: %s: %s\n", op->device_name,
+ safe_strerror(-sg_fd));
+ return SG_LIB_FILE_ERROR;
+ }
+
+ ret = do_read_gplog(sg_fd, ata_cmd, inbuff, op);
+
+ res = sg_cmds_close_device(sg_fd);
+ if (res < 0) {
+ pr2serr("close error: %s\n", safe_strerror(-res));
+ if (0 == ret)
+ return SG_LIB_FILE_ERROR;
+ }
+ return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
+}
diff --git a/src/sg_sat_set_features.c b/src/sg_sat_set_features.c
index 974970c0..fd4011dc 100644
--- a/src/sg_sat_set_features.c
+++ b/src/sg_sat_set_features.c
@@ -46,19 +46,20 @@
#define DEF_TIMEOUT 20
-static const char * version_str = "1.09 20141030";
+static const char * version_str = "1.10 20141106";
static struct option long_options[] = {
- {"count", required_argument, 0, 'c'},
- {"ck_cond", no_argument, 0, 'C'},
- {"feature", required_argument, 0, 'f'},
- {"help", no_argument, 0, 'h'},
- {"len", required_argument, 0, 'l'},
- {"lba", required_argument, 0, 'L'},
- {"readonly", no_argument, 0, 'r'},
- {"verbose", no_argument, 0, 'v'},
- {"version", no_argument, 0, 'V'},
- {0, 0, 0, 0},
+ {"count", required_argument, 0, 'c'},
+ {"ck_cond", no_argument, 0, 'C'},
+ {"extended", no_argument, 0, 'e'},
+ {"feature", required_argument, 0, 'f'},
+ {"help", no_argument, 0, 'h'},
+ {"len", required_argument, 0, 'l'},
+ {"lba", required_argument, 0, 'L'},
+ {"readonly", no_argument, 0, 'r'},
+ {"verbose", no_argument, 0, 'v'},
+ {"version", no_argument, 0, 'V'},
+ {0, 0, 0, 0},
};
@@ -66,17 +67,18 @@ static void
usage()
{
fprintf(stderr, "Usage: "
- "sg_sat_set_features [--count=CO] [--ck_cond] [--feature=FEA] "
- "[--help]\n"
- " [--lba=LBA] [--len=16|12] [--readonly] "
- "[--verbose]\n"
- " [--version] DEVICE\n"
+ "sg_sat_set_features [--count=CO] [--ck_cond] [--extended] "
+ "[--feature=FEA]\n"
+ " [--help] [--lba=LBA] [--len=16|12] "
+ "[--readonly]\n"
+ " [--verbose] [--version] DEVICE\n"
" where:\n"
" --count=CO | -c CO count field contents (def: 0)\n"
" --ck_cond | -C set ck_cond field in pass-through "
"(def: 0)\n"
- " --feature=FEA|-f FEA feature field contents\n"
- " (def: 0 (which is reserved))\n"
+ " --extended | -e enable extended lba values\n"
+ " --feature=FEA|-f FEA feature field contents\n"
+ " (def: 0 (which is reserved))\n"
" --help | -h output this usage message\n"
" --lba=LBA | -L LBA LBA field contents (def: 0)\n"
" meaning depends on sub-command "
@@ -100,11 +102,10 @@ usage()
}
static int
-do_set_features(int sg_fd, int feature, int count, unsigned int lba,
- int cdb_len, int ck_cond, int verbose)
+do_set_features(int sg_fd, int feature, int count, uint64_t lba,
+ int cdb_len, int ck_cond, int extend, int verbose)
{
int res, ret;
- int extend = 0;
/* Following for ATA READ/WRITE MULTIPLE (EXT) cmds, normally 0 */
int multiple_count = 0;
int protocol = 3; /* non-data */
@@ -137,6 +138,8 @@ do_set_features(int sg_fd, int feature, int count, unsigned int lba,
aptCmdBlk[10] = (lba >> 8) & 0xff;
aptCmdBlk[12] = (lba >> 16) & 0xff;
aptCmdBlk[7] = (lba >> 24) & 0xff;
+ aptCmdBlk[9] = (lba >> 32) & 0xff;
+ aptCmdBlk[11] = (lba >> 40) & 0xff;
aptCmdBlk[1] = (multiple_count << 5) | (protocol << 1) | extend;
aptCmdBlk[2] = (ck_cond << 5) | (t_type << 4)| (t_dir << 3) |
(byte_block << 2) | t_length;
@@ -277,12 +280,13 @@ do_set_features(int sg_fd, int feature, int count, unsigned int lba,
int
main(int argc, char * argv[])
{
- int sg_fd, c, k, ret, res;
+ int sg_fd, c, ret, res;
const char * device_name = NULL;
int count = 0;
+ int extend = 0;
int rdonly = 0;
int feature = 0;
- unsigned int lba = 0;
+ uint64_t lba = 0;
int verbose = 0;
int ck_cond = 0;
int cdb_len = SAT_ATA_PASS_THROUGH16_LEN;
@@ -290,7 +294,7 @@ main(int argc, char * argv[])
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "c:Cf:hl:L:rvV", long_options,
+ c = getopt_long(argc, argv, "c:Cef:hl:L:rvV", long_options,
&option_index);
if (c == -1)
break;
@@ -306,6 +310,9 @@ main(int argc, char * argv[])
case 'C':
ck_cond = 1;
break;
+ case 'e':
+ extend = 1;
+ break;
case 'f':
feature = sg_get_num(optarg);
if ((feature < 0) || (feature > 255)) {
@@ -324,13 +331,14 @@ main(int argc, char * argv[])
return SG_LIB_SYNTAX_ERROR;
}
break;
- case 'L': /* up to 26 bits, allow for 32 bits (less -1) */
- k = sg_get_num(optarg);
- if (-1 == k) {
+ case 'L': /* up to 32 bits, allow for 48 bits (less -1) */
+ lba = sg_get_llnum(optarg);
+ if ((uint64_t)-1 == lba) {
fprintf(stderr, "bad argument for '--lba'\n");
return SG_LIB_SYNTAX_ERROR;
}
- lba = (unsigned int)k;
+ if (lba > 0xffffffff)
+ extend = 1;
break;
case 'r':
++rdonly;
@@ -381,7 +389,7 @@ main(int argc, char * argv[])
}
ret = do_set_features(sg_fd, feature, count, lba, cdb_len, ck_cond,
- verbose);
+ extend, verbose);
res = sg_cmds_close_device(sg_fd);
if (res < 0) {
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index c6808409..5089efc8 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -36,7 +36,7 @@
*/
-static const char * version_str = "0.95 20141029"; /* spc4r37 + sbc4r02 */
+static const char * version_str = "0.96 20141110"; /* spc4r37 + sbc4r03 */
/* These structures are duplicates of those of the same name in
@@ -1171,6 +1171,13 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
dStrHexErr((const char *)ip, i_len, 0);
break;
}
+ if (strncmp((const char *)ip, "eui.", 4) ||
+ strncmp((const char *)ip, "naa.", 4) ||
+ strncmp((const char *)ip, "iqn.", 4)) {
+ pr2serr(" << expected name string prefix>>\n");
+ dStrHexErr((const char *)ip, i_len, -1);
+ break;
+ }
/* does %s print out UTF-8 ok??
* Seems to depend on the locale. Looks ok here with my
* locale setting: en_AU.UTF-8
@@ -1218,7 +1225,7 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
switch (desig_type) {
case 0: /* vendor specific */
k = 0;
- if ((1 == c_set) || (2 == c_set)) { /* ASCII or UTF-8 */
+ if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
for (k = 0; (k < i_len) && isprint(ip[k]); ++k)
;
if (k >= i_len)
@@ -1445,6 +1452,13 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
dStrHexErr((const char *)ip, i_len, 0);
break;
}
+ if (strncmp((const char *)ip, "eui.", 4) ||
+ strncmp((const char *)ip, "naa.", 4) ||
+ strncmp((const char *)ip, "iqn.", 4)) {
+ pr2serr(" << expected name string prefix>>\n");
+ dStrHexErr((const char *)ip, i_len, -1);
+ break;
+ }
printf(" SCSI name string:\n");
/* does %s print out UTF-8 ok??
* Seems to depend on the locale. Looks ok here with my
@@ -2297,8 +2311,9 @@ decode_proto_port_vpd(unsigned char * buff, int len, int do_hex)
dStrHex((const char *)ucp, bump, 1);
else {
switch (proto) {
- case TPROTO_SAS: /* for SSP, added spl3r2 */
- printf(" pwr_d_s=%d\n", !!(ucp[3] & 0x1));
+ case TPROTO_SAS: /* page added in spl3r02 */
+ printf(" power disable supported (pwr_d_s)=%d\n",
+ !!(ucp[3] & 0x1)); /* added spl3r03 */
pidp = ucp + 8;
for (j = 0; j < desc_len; j += 4, pidp += 4)
printf(" phy id=%d, ssp persistent capable=%d\n",
diff --git a/src/sg_write_buffer.c b/src/sg_write_buffer.c
index ff864aa9..2cfffb1a 100644
--- a/src/sg_write_buffer.c
+++ b/src/sg_write_buffer.c
@@ -26,7 +26,7 @@
* This utility issues the SCSI WRITE BUFFER command to the given device.
*/
-static const char * version_str = "1.17 20140928"; /* spc4r37 */
+static const char * version_str = "1.18 20141107"; /* spc4r37 */
#define ME "sg_write_buffer: "
#define DEF_XFER_LEN (8 * 1024 * 1024)
@@ -110,8 +110,9 @@ usage()
" --verbose|-v increase verbosity\n"
" --version|-V print version string and exit\n\n"
"Performs one or more SCSI WRITE BUFFER commands. Use '-m xxx' "
- "to list\navailable modes. Numbers given in options are decimal "
- "unless they have\na hex indicator.\n"
+ "to list\navailable modes. A chunk size of 4 KB ('--bpw=4k') "
+ "seems to work well.\nExample: sg_write_buffer -b 4k -I xxx.lod "
+ "-m 7 /dev/sg3\n"
);
}
diff --git a/src/sg_write_verify.c b/src/sg_write_verify.c
index 46b0d7ff..e3ae094b 100644
--- a/src/sg_write_verify.c
+++ b/src/sg_write_verify.c
@@ -33,7 +33,7 @@
#include "sg_pt.h"
#include "sg_cmds_basic.h"
-static const char * version_str = "1.04 20140807";
+static const char * version_str = "1.05 20141107";
#define ME "sg_write_verify: "
@@ -52,65 +52,65 @@ static const char * version_str = "1.04 20140807";
static struct option long_options[] = {
- {"16", no_argument, 0, 'S'},
- {"bytchk", required_argument, 0, 'b'},
- {"dpo", no_argument, 0, 'd'},
- {"group", required_argument, 0, 'g'},
- {"help", no_argument, 0, 'h'},
- {"ilen", required_argument, 0, 'I'},
- {"in", required_argument, 0, 'i'},
- {"lba", required_argument, 0, 'l'},
- {"num", required_argument, 0, 'n'},
- {"repeat", no_argument, 0, 'R'},
- {"timeout", required_argument, 0, 't'},
- {"verbose", no_argument, 0, 'v'},
- {"version", no_argument, 0, 'V'},
- {"wrprotect", required_argument, 0, 'w'},
- {0, 0, 0, 0},
+ {"16", no_argument, 0, 'S'},
+ {"bytchk", required_argument, 0, 'b'},
+ {"dpo", no_argument, 0, 'd'},
+ {"group", required_argument, 0, 'g'},
+ {"help", no_argument, 0, 'h'},
+ {"ilen", required_argument, 0, 'I'},
+ {"in", required_argument, 0, 'i'},
+ {"lba", required_argument, 0, 'l'},
+ {"num", required_argument, 0, 'n'},
+ {"repeat", no_argument, 0, 'R'},
+ {"timeout", required_argument, 0, 't'},
+ {"verbose", no_argument, 0, 'v'},
+ {"version", no_argument, 0, 'V'},
+ {"wrprotect", required_argument, 0, 'w'},
+ {0, 0, 0, 0},
};
static void
usage()
{
- fprintf(stderr, "Usage: "
- "sg_write_verify [--16] [--bytchk=BC] [--dpo] [--group=GN] "
- "[--help]\n"
- " [--ilen=IL] [--in=IF] --lba=LBA "
- "[--num=NUM]\n"
- " [--repeat] [--timeout=TO] [--verbose] "
- "[--version]\n"
- " [--wrprotect=WPR] DEVICE\n"
- " where:\n"
- " --16|-S do WRITE AND VERIFY(16) (default: 10)\n"
- " --bytchk=BC|-b BC set BYTCHK field (default: 0)\n"
- " --dpo|-d set DPO bit (default: 0)\n"
- " --group=GN|-g GN GN is group number (default: 0)\n"
- " --help|-h print out usage message\n"
- " --ilen=IL| -I IL input (file) length in bytes, becomes "
- "data-out\n"
- " buffer length (def: deduced from IF "
- "size)\n"
- " --in=IF|-i IF IF is a file containing the data to "
- "be written\n"
- " --lba=LBA|-l LBA LBA of the first block to write "
- "and verify;\n"
- " no default, must be given\n"
- " --num=NUM|-n NUM number of logical blocks to write and "
- "verify\n"
- " --repeat|-R while IF still has data to read, send "
- "another\n"
- " command, bumping LBA with up to NUM "
- "blocks again\n"
- " --timeout=TO|-t TO command timeout in seconds (def: 60)\n"
- " --verbose|-v increase verbosity\n"
- " --version|-V print version string then exit\n"
- " --wrprotect|-w WPR WPR is the WRPROTECT field value "
- "(def: 0)\n\n"
- "Performs a SCSI WRITE AND VERIFY (10 or 16) command on DEVICE, "
- "startings\nat LBA for NUM logical blocks. More commands performed "
- "only if '--repeat'\noption given. Data to be written is fetched "
- "from the IF file.\n"
+ fprintf(stderr, "Usage: "
+ "sg_write_verify [--16] [--bytchk=BC] [--dpo] [--group=GN] "
+ "[--help]\n"
+ " [--ilen=IL] [--in=IF] --lba=LBA "
+ "[--num=NUM]\n"
+ " [--repeat] [--timeout=TO] [--verbose] "
+ "[--version]\n"
+ " [--wrprotect=WPR] DEVICE\n"
+ " where:\n"
+ " --16|-S do WRITE AND VERIFY(16) (default: 10)\n"
+ " --bytchk=BC|-b BC set BYTCHK field (default: 0)\n"
+ " --dpo|-d set DPO bit (default: 0)\n"
+ " --group=GN|-g GN GN is group number (default: 0)\n"
+ " --help|-h print out usage message\n"
+ " --ilen=IL| -I IL input (file) length in bytes, becomes "
+ "data-out\n"
+ " buffer length (def: deduced from IF "
+ "size)\n"
+ " --in=IF|-i IF IF is a file containing the data to "
+ "be written\n"
+ " --lba=LBA|-l LBA LBA of the first block to write "
+ "and verify;\n"
+ " no default, must be given\n"
+ " --num=NUM|-n NUM number of logical blocks to write and "
+ "verify\n"
+ " --repeat|-R while IF still has data to read, send "
+ "another\n"
+ " command, bumping LBA with up to NUM "
+ "blocks again\n"
+ " --timeout=TO|-t TO command timeout in seconds (def: 60)\n"
+ " --verbose|-v increase verbosity\n"
+ " --version|-V print version string then exit\n"
+ " --wrprotect|-w WPR WPR is the WRPROTECT field value "
+ "(def: 0)\n\n"
+ "Performs a SCSI WRITE AND VERIFY (10 or 16) command on DEVICE, "
+ "startings\nat LBA for NUM logical blocks. More commands "
+ "performed only if '--repeat'\noption given. Data to be written "
+ "is fetched from the IF file.\n"
);
}