aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COVERAGE3
-rw-r--r--ChangeLog5
-rw-r--r--README2
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog6
-rw-r--r--doc/sg_verify.812
-rw-r--r--include/sg_cmds_extra.h9
-rw-r--r--lib/sg_cmds_basic.c127
-rw-r--r--lib/sg_cmds_extra.c141
-rw-r--r--sg3_utils.spec6
-rw-r--r--src/sg_get_config.c79
-rw-r--r--src/sg_verify.c36
13 files changed, 293 insertions, 155 deletions
diff --git a/COVERAGE b/COVERAGE
index e472ef93..c9967b05 100644
--- a/COVERAGE
+++ b/COVERAGE
@@ -64,6 +64,7 @@ WRITE(16) sg_dd, sgm_dd, sgp_dd
WRITE BUFFER sg_test_rwbuf, sg_write_buffer, ++
WRITE LONG (10) sg_write_long, ++
WRITE LONG (16) sg_write_long, ++
+<most commands> sg_raw
@@ -87,4 +88,4 @@ SMART READ DATA examples/sg_sat_smart_rd_data
Doug Gilbert
-29th September 2007
+29th October 2007
diff --git a/ChangeLog b/ChangeLog
index 49f2345e..59370721 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@ 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.26 [20071102]
+ - sg_get_config: sync with mmc6r01
+ - sg_cmds_extra: sg_ll_verify10() add vrprotect argument
+ - sg_verify: add --vrprotect= option
+
Changelog for sg3_utils-1.25 [20071016]
- sg_stpg: new utility to Set Target Port Groups
- sg_safte: new utility to query SAF-TE processor (SES like)
diff --git a/README b/README
index a3062fca..650d9b5e 100644
--- a/README
+++ b/README
@@ -327,4 +327,4 @@ See http://www.torque.net/sg/tools.html
Doug Gilbert
-16th October 2007
+2nd November 2007
diff --git a/configure b/configure
index 27cc18d6..4bf58a50 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for sg3_utils 1.25.
+# Generated by GNU Autoconf 2.61 for sg3_utils 1.26.
#
# Report bugs to <dgilbert@interlog.com>.
#
@@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='sg3_utils'
PACKAGE_TARNAME='sg3_utils'
-PACKAGE_VERSION='1.25'
-PACKAGE_STRING='sg3_utils 1.25'
+PACKAGE_VERSION='1.26'
+PACKAGE_STRING='sg3_utils 1.26'
PACKAGE_BUGREPORT='dgilbert@interlog.com'
# Factoring default headers for most tests.
@@ -1404,7 +1404,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sg3_utils 1.25 to adapt to many kinds of systems.
+\`configure' configures sg3_utils 1.26 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1474,7 +1474,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sg3_utils 1.25:";;
+ short | recursive ) echo "Configuration of sg3_utils 1.26:";;
esac
cat <<\_ACEOF
@@ -1576,7 +1576,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sg3_utils configure 1.25
+sg3_utils configure 1.26
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1590,7 +1590,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sg3_utils $as_me 1.25, which was
+It was created by sg3_utils $as_me 1.26, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2281,7 +2281,7 @@ fi
# Define the identity of the package.
PACKAGE='sg3_utils'
- VERSION='1.25'
+ VERSION='1.26'
cat >>confdefs.h <<_ACEOF
@@ -20237,7 +20237,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by sg3_utils $as_me 1.25, which was
+This file was extended by sg3_utils $as_me 1.26, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20290,7 +20290,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-sg3_utils config.status 1.25
+sg3_utils config.status 1.26
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index d4a9c5f6..2fbd6195 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(sg3_utils, 1.25, dgilbert@interlog.com)
+AC_INIT(sg3_utils, 1.26, dgilbert@interlog.com)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
diff --git a/debian/changelog b/debian/changelog
index cfa6a132..daf88a27 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sg3-utils (1.26-0.1) unstable; urgency=low
+
+ * New upstream version
+
+ -- Doug Gilbert <dgilbert@interlog.com> Fri, 02 Nov 2007 10:00:00 +0100
+
sg3-utils (1.25-0.1) unstable; urgency=low
* New upstream version
diff --git a/doc/sg_verify.8 b/doc/sg_verify.8
index 338f5d51..fe79a31c 100644
--- a/doc/sg_verify.8
+++ b/doc/sg_verify.8
@@ -1,10 +1,11 @@
-.TH SG_VERIFY "8" "January 2007" "sg3_utils\-1.23" SG3_UTILS
+.TH SG_VERIFY "8" "November 2007" "sg3_utils\-1.26" SG3_UTILS
.SH NAME
sg_verify \- invoke SCSI VERIFY command(s) on a block device
.SH SYNOPSIS
.B sg_verify
[\fI\-\-bpc=BPC\fR] [\fI\-\-count=COUNT\fR] [\fI\-\-dpo\fR] [\fI\-\-help\fR]
-[\fI\-\-lba=LBA\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR] \fIDEVICE\fR
+[\fI\-\-lba=LBA\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR]
+[\fI\-\-vrprotect=VRP\fR] \fIDEVICE\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -18,6 +19,8 @@ no verify errors detected no messages are sent to stderr and the Unix return
status is 0).
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
+The options are arranged in alphabetical order based on the long
+option name.
.TP
\fB\-b\fR, \fB\-\-bpc\fR=\fIBPC\fR
where \fIBPC\fR specifies the maximum number of blocks that will be verified
@@ -54,6 +57,11 @@ increase the level of verbosity, (i.e. debug output).
.TP
\fB\-V\fR, \fB\-\-version\fR
print the version string and then exit.
+.TP
+\fB\-P\fR, \fB\-\-vrprotect\fR=\fIVRP\fR
+where \fIVRP\fR is the value in the vrprotect field in the VERIFY command
+cdb. It must be a value between 0 and 7 inclusive. The default value is
+zero.
.SH NOTES
The \fIBPC\fR, \fICOUNT\fR and \fILBA\fR arguments may be followed by one of
these multiplicative suffixes:
diff --git a/include/sg_cmds_extra.h b/include/sg_cmds_extra.h
index 164c1af4..7c300892 100644
--- a/include/sg_cmds_extra.h
+++ b/include/sg_cmds_extra.h
@@ -2,7 +2,7 @@
#define SG_CMDS_EXTRA_H
/*
- * Copyright (c) 2004-2006 Douglas Gilbert.
+ * Copyright (c) 2004-2007 Douglas Gilbert.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -213,9 +213,10 @@ extern int sg_ll_set_id_info(int sg_fd, int itype, void * paramp,
* SG_LIB_CAT_MEDIUM_HARD_WITH_INFO -> as previous, with valid info,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-extern int sg_ll_verify10(int sg_fd, int dpo, int bytechk, unsigned long lba,
- int veri_len, void * data_out, int data_out_len,
- unsigned long * infop, int noisy, int verbose);
+extern int sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytechk,
+ unsigned long lba, int veri_len, void * data_out,
+ int data_out_len, unsigned long * infop, int noisy,
+ int verbose);
/* Invokes a SCSI WRITE BUFFER command (SPC). Return of 0 ->
* success, SG_LIB_CAT_INVALID_OP -> invalid opcode,
diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c
index 3974a0f3..89109e96 100644
--- a/lib/sg_cmds_basic.c
+++ b/lib/sg_cmds_basic.c
@@ -45,7 +45,7 @@
#include "sg_pt.h"
-static char * version_str = "1.40 20070803";
+static char * version_str = "1.41 20071102";
#define SENSE_BUFF_LEN 32 /* Arbitrary, could be larger */
@@ -94,21 +94,23 @@ static char * version_str = "1.40 20070803";
#define INQUIRY_RESP_INITIAL_LEN 36
-const char * sg_cmds_version()
+const char *
+sg_cmds_version()
{
return version_str;
}
/* Returns file descriptor >= 0 if successful. If error in Unix returns
negated errno. */
-int sg_cmds_open_device(const char * device_name, int read_only,
- int verbose)
+int
+sg_cmds_open_device(const char * device_name, int read_only, int verbose)
{
return scsi_pt_open_device(device_name, read_only, verbose);
}
/* Returns 0 if successful. If error in Unix returns negated errno. */
-int sg_cmds_close_device(int device_fd)
+int
+sg_cmds_close_device(int device_fd)
{
return scsi_pt_close_device(device_fd);
}
@@ -120,9 +122,10 @@ int sg_cmds_close_device(int device_fd)
output via 'o_sense_cat' pointer (if not NULL). Outputs to
sg_warnings_strm (def: stderr) if problems; depending on 'noisy'
and 'verbose' */
-int sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin, int res,
- int mx_resp_len, const unsigned char * sense_b,
- int noisy, int verbose, int * o_sense_cat)
+int
+sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin, int res,
+ int mx_resp_len, const unsigned char * sense_b,
+ int noisy, int verbose, int * o_sense_cat)
{
int got, cat, duration, slen, scat, n, resid;
char b[1024];
@@ -216,8 +219,9 @@ int sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin, int res,
* Returns 0 when successful, SG_LIB_CAT_INVALID_OP -> not supported,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_MALFORMED -> bad response, -1 -> other errors */
-int sg_ll_inquiry(int sg_fd, int cmddt, int evpd, int pg_op,
- void * resp, int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_inquiry(int sg_fd, int cmddt, int evpd, int pg_op, void * resp,
+ int mx_resp_len, int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char inqCmdBlk[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
@@ -291,8 +295,9 @@ int sg_ll_inquiry(int sg_fd, int cmddt, int evpd, int pg_op,
* Returns 0 when successful, SG_LIB_CAT_INVALID_OP -> not supported,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_MALFORMED -> bad response, -1 -> other errors */
-int sg_simple_inquiry(int sg_fd, struct sg_simple_inquiry_resp * inq_data,
- int noisy, int verbose)
+int
+sg_simple_inquiry(int sg_fd, struct sg_simple_inquiry_resp * inq_data,
+ int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char inqCmdBlk[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
@@ -376,8 +381,9 @@ int sg_simple_inquiry(int sg_fd, struct sg_simple_inquiry_resp * inq_data,
* Return of 0 -> success, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_NOT_READY ->
* device not ready, -1 -> other failure */
-int sg_ll_test_unit_ready_progress(int sg_fd, int pack_id, int * progress,
- int noisy, int verbose)
+int
+sg_ll_test_unit_ready_progress(int sg_fd, int pack_id, int * progress,
+ int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char turCmdBlk[TUR_CMDLEN] = {TUR_CMD, 0, 0, 0, 0, 0};
@@ -441,7 +447,8 @@ int sg_ll_test_unit_ready_progress(int sg_fd, int pack_id, int * progress,
* Return of 0 -> success, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_NOT_READY ->
* device not ready, -1 -> other failure */
-int sg_ll_test_unit_ready(int sg_fd, int pack_id, int noisy, int verbose)
+int
+sg_ll_test_unit_ready(int sg_fd, int pack_id, int noisy, int verbose)
{
return sg_ll_test_unit_ready_progress(sg_fd, pack_id, NULL, noisy,
verbose);
@@ -452,9 +459,10 @@ int sg_ll_test_unit_ready(int sg_fd, int pack_id, int noisy, int verbose)
* SG_LIB_CAT_INVALID_OP -> cdb not supported,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_NOT_READY -> device not ready, -1 -> other failure */
-int sg_ll_sync_cache_10(int sg_fd, int sync_nv, int immed, int group,
- unsigned int lba, unsigned int count, int noisy,
- int verbose)
+int
+sg_ll_sync_cache_10(int sg_fd, int sync_nv, int immed, int group,
+ unsigned int lba, unsigned int count, int noisy,
+ int verbose)
{
int res, ret, k, sense_cat;
unsigned char scCmdBlk[SYNCHRONIZE_CACHE_CMDLEN] =
@@ -527,8 +535,9 @@ int sg_ll_sync_cache_10(int sg_fd, int sync_nv, int immed, int group,
* -> cdb not supported, SG_LIB_CAT_IlLEGAL_REQ -> bad field in cdb,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_NOT_READY -> device not ready,
* -1 -> other failure */
-int sg_ll_readcap_16(int sg_fd, int pmi, unsigned long long llba,
- void * resp, int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_readcap_16(int sg_fd, int pmi, unsigned long long llba, void * resp,
+ int mx_resp_len, int noisy, int verbose)
{
int k, ret, res, sense_cat;
unsigned char rcCmdBlk[SERVICE_ACTION_IN_16_CMDLEN] =
@@ -603,8 +612,9 @@ int sg_ll_readcap_16(int sg_fd, int pmi, unsigned long long llba,
* -> cdb not supported, SG_LIB_CAT_IlLEGAL_REQ -> bad field in cdb,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_NOT_READY -> device not ready,
* -1 -> other failure */
-int sg_ll_readcap_10(int sg_fd, int pmi, unsigned int lba,
- void * resp, int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_readcap_10(int sg_fd, int pmi, unsigned int lba, void * resp,
+ int mx_resp_len, int noisy, int verbose)
{
int k, ret, res, sense_cat;
unsigned char rcCmdBlk[READ_CAPACITY_10_CMDLEN] =
@@ -669,8 +679,9 @@ int sg_ll_readcap_10(int sg_fd, int pmi, unsigned int lba,
* bad field in cdb, * SG_LIB_CAT_NOT_READY -> device not ready,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_UNIT_ATTENTION,
* -1 -> other failure */
-int sg_ll_mode_sense6(int sg_fd, int dbd, int pc, int pg_code, int sub_pg_code,
- void * resp, int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_mode_sense6(int sg_fd, int dbd, int pc, int pg_code, int sub_pg_code,
+ void * resp, int mx_resp_len, int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char modesCmdBlk[MODE_SENSE6_CMDLEN] =
@@ -741,9 +752,10 @@ int sg_ll_mode_sense6(int sg_fd, int dbd, int pc, int pg_code, int sub_pg_code,
* bad field in cdb, * SG_LIB_CAT_NOT_READY -> device not ready,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_UNIT_ATTENTION,
* -1 -> other failure */
-int sg_ll_mode_sense10(int sg_fd, int llbaa, int dbd, int pc, int pg_code,
- int sub_pg_code, void * resp, int mx_resp_len,
- int noisy, int verbose)
+int
+sg_ll_mode_sense10(int sg_fd, int llbaa, int dbd, int pc, int pg_code,
+ int sub_pg_code, void * resp, int mx_resp_len,
+ int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char modesCmdBlk[MODE_SENSE10_CMDLEN] =
@@ -815,8 +827,9 @@ int sg_ll_mode_sense10(int sg_fd, int llbaa, int dbd, int pc, int pg_code,
* bad field in cdb, * SG_LIB_CAT_NOT_READY -> device not ready,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_UNIT_ATTENTION,
* -1 -> other failure */
-int sg_ll_mode_select6(int sg_fd, int pf, int sp, void * paramp,
- int param_len, int noisy, int verbose)
+int
+sg_ll_mode_select6(int sg_fd, int pf, int sp, void * paramp, int param_len,
+ int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char modesCmdBlk[MODE_SELECT6_CMDLEN] =
@@ -885,8 +898,9 @@ int sg_ll_mode_select6(int sg_fd, int pf, int sp, void * paramp,
* bad field in cdb, * SG_LIB_CAT_NOT_READY -> device not ready,
* SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_UNIT_ATTENTION,
* -1 -> other failure */
-int sg_ll_mode_select10(int sg_fd, int pf, int sp, void * paramp,
- int param_len, int noisy, int verbose)
+int
+sg_ll_mode_select10(int sg_fd, int pf, int sp, void * paramp, int param_len,
+ int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char modesCmdBlk[MODE_SELECT10_CMDLEN] =
@@ -957,8 +971,9 @@ int sg_ll_mode_select10(int sg_fd, int pf, int sp, void * paramp,
* page. Set mode_sense_6 to 1 for MODE SENSE (6) and 0 for MODE SENSE (10).
* Returns >= 0 is successful or -1 if failure. If there is a failure
* a message is written to err_buff. */
-int sg_mode_page_offset(const unsigned char * resp, int resp_len,
- int mode_sense_6, char * err_buff, int err_buff_len)
+int
+sg_mode_page_offset(const unsigned char * resp, int resp_len,
+ int mode_sense_6, char * err_buff, int err_buff_len)
{
int bd_len;
int calc_len;
@@ -1011,11 +1026,11 @@ int sg_mode_page_offset(const unsigned char * resp, int resp_len,
* respectively have been fetched. If error on current page
* then stops and returns that error; otherwise continues if an error is
* detected but returns the first error encountered. */
-int sg_get_mode_page_controls(int sg_fd, int mode6, int pg_code,
- int sub_pg_code, int dbd, int flexible,
- int mx_mpage_len, int * success_mask,
- void * pcontrol_arr[], int * reported_len,
- int verbose)
+int
+sg_get_mode_page_controls(int sg_fd, int mode6, int pg_code, int sub_pg_code,
+ int dbd, int flexible, int mx_mpage_len,
+ int * success_mask, void * pcontrol_arr[],
+ int * reported_len, int verbose)
{
int k, n, res, offset, calc_len, xfer_len, resp_mode6;
unsigned char buff[MODE_RESP_ARB_LEN];
@@ -1117,8 +1132,9 @@ int sg_get_mode_page_controls(int sg_fd, int mode6, int pg_code,
* SG_LIB_CAT_INVALID_OP -> Request Sense not supported??,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb,
* SG_LIB_CAT_ABORTED_COMMAND, -1 -> other failure */
-int sg_ll_request_sense(int sg_fd, int desc, void * resp, int mx_resp_len,
- int noisy, int verbose)
+int
+sg_ll_request_sense(int sg_fd, int desc, void * resp, int mx_resp_len,
+ int noisy, int verbose)
{
int k, ret, res, sense_cat;
unsigned char rsCmdBlk[REQUEST_SENSE_CMDLEN] =
@@ -1190,8 +1206,9 @@ int sg_ll_request_sense(int sg_fd, int desc, void * resp, int mx_resp_len,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb,
* SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_NOT_READY (shouldn't happen), -1 -> other failure */
-int sg_ll_report_luns(int sg_fd, int select_report, void * resp,
- int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_report_luns(int sg_fd, int select_report, void * resp, int mx_resp_len,
+ int noisy, int verbose)
{
int k, ret, res, sense_cat;
unsigned char rlCmdBlk[REPORT_LUNS_CMDLEN] =
@@ -1253,9 +1270,10 @@ int sg_ll_report_luns(int sg_fd, int select_report, void * resp,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_log_sense(int sg_fd, int ppc, int sp, int pc, int pg_code,
- int subpg_code, int paramp, unsigned char * resp,
- int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_log_sense(int sg_fd, int ppc, int sp, int pc, int pg_code,
+ int subpg_code, int paramp, unsigned char * resp,
+ int mx_resp_len, int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char logsCmdBlk[LOG_SENSE_CMDLEN] =
@@ -1324,10 +1342,10 @@ int sg_ll_log_sense(int sg_fd, int ppc, int sp, int pc, int pg_code,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_log_select(int sg_fd, int pcr, int sp, int pc,
- int pg_code, int subpg_code,
- unsigned char * paramp, int param_len,
- int noisy, int verbose)
+int
+sg_ll_log_select(int sg_fd, int pcr, int sp, int pc, int pg_code,
+ int subpg_code, unsigned char * paramp, int param_len,
+ int noisy, int verbose)
{
int res, ret, k, sense_cat;
unsigned char logsCmdBlk[LOG_SELECT_CMDLEN] =
@@ -1400,8 +1418,9 @@ int sg_ll_log_select(int sg_fd, int pcr, int sp, int pc,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_start_stop_unit(int sg_fd, int immed, int fl_num, int power_cond,
- int fl, int loej, int start, int noisy, int verbose)
+int
+sg_ll_start_stop_unit(int sg_fd, int immed, int fl_num, int power_cond,
+ int fl, int loej, int start, int noisy, int verbose)
{
unsigned char ssuBlk[START_STOP_CMDLEN] = {START_STOP_CMD, 0, 0, 0, 0, 0};
unsigned char sense_b[SENSE_BUFF_LEN];
@@ -1456,14 +1475,16 @@ int sg_ll_start_stop_unit(int sg_fd, int immed, int fl_num, int power_cond,
return ret;
}
-/* Invokes a SCSI PREVENT ALLOW MEDIUM REMOVAL command (SPC-3)
+/* Invokes a SCSI PREVENT ALLOW MEDIUM REMOVAL command
+ * [was in SPC-3 but displaced from SPC-4 into SBC-3, MMC-5, SSC-3]
* prevent==0 allows removal, prevent==1 prevents removal ...
* Return of 0 -> success,
* SG_LIB_CAT_INVALID_OP -> command not supported
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_prevent_allow(int sg_fd, int prevent, int noisy, int verbose)
+int
+sg_ll_prevent_allow(int sg_fd, int prevent, int noisy, int verbose)
{
int k, res, ret, sense_cat;
unsigned char pCmdBlk[PREVENT_ALLOW_CMDLEN] =
diff --git a/lib/sg_cmds_extra.c b/lib/sg_cmds_extra.c
index 286aac94..3685088c 100644
--- a/lib/sg_cmds_extra.c
+++ b/lib/sg_cmds_extra.c
@@ -100,8 +100,9 @@
* SG_LIB_CAT_INVALID_OP -> Report Target Port Groups not supported,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_UNIT_ATTENTION, -1 -> other failure */
-int sg_ll_report_tgt_prt_grp(int sg_fd, void * resp,
- int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_report_tgt_prt_grp(int sg_fd, void * resp, int mx_resp_len, int noisy,
+ int verbose)
{
int k, res, ret, sense_cat;
unsigned char rtpgCmdBlk[MAINTENANCE_IN_CMDLEN] =
@@ -164,8 +165,9 @@ int sg_ll_report_tgt_prt_grp(int sg_fd, void * resp,
* SG_LIB_CAT_INVALID_OP -> Set Target Port Groups not supported,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_UNIT_ATTENTION, -1 -> other failure */
-int sg_ll_set_tgt_prt_grp(int sg_fd, void * paramp,
- int param_len, int noisy, int verbose)
+int
+sg_ll_set_tgt_prt_grp(int sg_fd, void * paramp, int param_len, int noisy,
+ int verbose)
{
int k, res, ret, sense_cat;
unsigned char stpgCmdBlk[MAINTENANCE_OUT_CMDLEN] =
@@ -234,10 +236,10 @@ int sg_ll_set_tgt_prt_grp(int sg_fd, void * paramp,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_send_diag(int sg_fd, int sf_code, int pf_bit, int sf_bit,
- int devofl_bit, int unitofl_bit, int long_duration,
- void * paramp, int param_len, int noisy,
- int verbose)
+int
+sg_ll_send_diag(int sg_fd, int sf_code, int pf_bit, int sf_bit, int devofl_bit,
+ int unitofl_bit, int long_duration, void * paramp,
+ int param_len, int noisy, int verbose)
{
int k, res, ret, sense_cat;
unsigned char senddiagCmdBlk[SEND_DIAGNOSTIC_CMDLEN] =
@@ -308,8 +310,9 @@ int sg_ll_send_diag(int sg_fd, int sf_code, int pf_bit, int sf_bit,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_receive_diag(int sg_fd, int pcv, int pg_code, void * resp,
- int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_receive_diag(int sg_fd, int pcv, int pg_code, void * resp,
+ int mx_resp_len, int noisy, int verbose)
{
int k, res, ret, sense_cat;
unsigned char rcvdiagCmdBlk[RECEIVE_DIAGNOSTICS_CMDLEN] =
@@ -374,9 +377,9 @@ int sg_ll_receive_diag(int sg_fd, int pcv, int pg_code, void * resp,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_read_defect10(int sg_fd, int req_plist, int req_glist,
- int dl_format, void * resp, int mx_resp_len,
- int noisy, int verbose)
+int
+sg_ll_read_defect10(int sg_fd, int req_plist, int req_glist, int dl_format,
+ void * resp, int mx_resp_len, int noisy, int verbose)
{
int res, k, ret, sense_cat;
unsigned char rdefCmdBlk[READ_DEFECT10_CMDLEN] =
@@ -448,8 +451,9 @@ int sg_ll_read_defect10(int sg_fd, int req_plist, int req_glist,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_read_media_serial_num(int sg_fd, void * resp, int mx_resp_len,
- int noisy, int verbose)
+int
+sg_ll_read_media_serial_num(int sg_fd, void * resp, int mx_resp_len,
+ int noisy, int verbose)
{
int k, res, ret, sense_cat;
unsigned char rmsnCmdBlk[SERVICE_ACTION_IN_12_CMDLEN] =
@@ -521,8 +525,9 @@ int sg_ll_read_media_serial_num(int sg_fd, void * resp, int mx_resp_len,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_report_id_info(int sg_fd, int itype, void * resp,
- int max_resp_len, int noisy, int verbose)
+int
+sg_ll_report_id_info(int sg_fd, int itype, void * resp, int max_resp_len,
+ int noisy, int verbose)
{
int k, res, ret, sense_cat;
unsigned char riiCmdBlk[MAINTENANCE_IN_CMDLEN] = {MAINTENANCE_IN_CMD,
@@ -596,8 +601,9 @@ int sg_ll_report_id_info(int sg_fd, int itype, void * resp,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_set_id_info(int sg_fd, int itype, void * paramp,
- int param_len, int noisy, int verbose)
+int
+sg_ll_set_id_info(int sg_fd, int itype, void * paramp, int param_len,
+ int noisy, int verbose)
{
int k, res, ret, sense_cat;
unsigned char siiCmdBlk[MAINTENANCE_OUT_CMDLEN] = {MAINTENANCE_OUT_CMD,
@@ -668,10 +674,10 @@ int sg_ll_set_id_info(int sg_fd, int itype, void * paramp,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_format_unit(int sg_fd, int fmtpinfo, int rto_req, int longlist,
- int fmtdata, int cmplst, int dlist_format,
- int timeout_secs, void * paramp, int param_len,
- int noisy, int verbose)
+int
+sg_ll_format_unit(int sg_fd, int fmtpinfo, int rto_req, int longlist,
+ int fmtdata, int cmplst, int dlist_format, int timeout_secs,
+ void * paramp, int param_len, int noisy, int verbose)
{
int k, res, ret, sense_cat, tmout;
unsigned char fuCmdBlk[FORMAT_UNIT_CMDLEN] =
@@ -746,9 +752,9 @@ int sg_ll_format_unit(int sg_fd, int fmtpinfo, int rto_req, int longlist,
* SG_LIB_CAT_INVALID_OP -> invalid opcode, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_NOT_READY -> device not ready, -1 -> other failure */
-int sg_ll_reassign_blocks(int sg_fd, int longlba, int longlist,
- void * paramp, int param_len, int noisy,
- int verbose)
+int
+sg_ll_reassign_blocks(int sg_fd, int longlba, int longlist, void * paramp,
+ int param_len, int noisy, int verbose)
{
int res, k, ret, sense_cat;
unsigned char reassCmdBlk[REASSIGN_BLKS_CMDLEN] =
@@ -811,8 +817,9 @@ int sg_ll_reassign_blocks(int sg_fd, int longlba, int longlist,
* Returns 0 when successful, SG_LIB_CAT_INVALID_OP if command not
* supported, SG_LIB_CAT_ILLEGAL_REQ if field in cdb not supported,
* SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
-int sg_ll_get_config(int sg_fd, int rt, int starting, void * resp,
- int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_get_config(int sg_fd, int rt, int starting, void * resp,
+ int mx_resp_len, int noisy, int verbose)
{
int res, k, ret, sense_cat;
unsigned char gcCmdBlk[GET_CONFIG_CMD_LEN] = {GET_CONFIG_CMD, 0, 0, 0,
@@ -893,8 +900,9 @@ int sg_ll_get_config(int sg_fd, int rt, int starting, void * resp,
* when successful, SG_LIB_CAT_INVALID_OP if command not supported,
* SG_LIB_CAT_ILLEGAL_REQ if field in cdb not supported,
* SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
-int sg_ll_persistent_reserve_in(int sg_fd, int rq_servact, void * resp,
- int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_persistent_reserve_in(int sg_fd, int rq_servact, void * resp,
+ int mx_resp_len, int noisy, int verbose)
{
int res, k, ret, sense_cat;
unsigned char prinCmdBlk[PERSISTENT_RESERVE_IN_CMDLEN] =
@@ -962,9 +970,10 @@ int sg_ll_persistent_reserve_in(int sg_fd, int rq_servact, void * resp,
* when successful, SG_LIB_CAT_INVALID_OP if command not supported,
* SG_LIB_CAT_ILLEGAL_REQ if field in cdb not supported,
* SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
-int sg_ll_persistent_reserve_out(int sg_fd, int rq_servact, int rq_scope,
- unsigned int rq_type, void * paramp,
- int param_len, int noisy, int verbose)
+int
+sg_ll_persistent_reserve_out(int sg_fd, int rq_servact, int rq_scope,
+ unsigned int rq_type, void * paramp,
+ int param_len, int noisy, int verbose)
{
int res, k, ret, sense_cat;
unsigned char proutCmdBlk[PERSISTENT_RESERVE_OUT_CMDLEN] =
@@ -1027,7 +1036,8 @@ int sg_ll_persistent_reserve_out(int sg_fd, int rq_servact, int rq_scope,
return ret;
}
-static int has_blk_ili(unsigned char * sensep, int sb_len)
+static int
+has_blk_ili(unsigned char * sensep, int sb_len)
{
int resp_code;
const unsigned char * cup;
@@ -1051,9 +1061,10 @@ static int has_blk_ili(unsigned char * sensep, int sb_len)
* SG_LIB_CAT_ILLEGAL_REQ_WITH_INFO -> bad field in cdb, with info
* field written to 'offsetp', SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_NOT_READY -> device not ready, -1 -> other failure */
-int sg_ll_read_long10(int sg_fd, int pblock, int correct, unsigned long lba,
- void * resp, int xfer_len, int * offsetp,
- int noisy, int verbose)
+int
+sg_ll_read_long10(int sg_fd, int pblock, int correct, unsigned long lba,
+ void * resp, int xfer_len, int * offsetp, int noisy,
+ int verbose)
{
int k, res, sense_cat, ret;
unsigned char readLongCmdBlk[READ_LONG10_CMDLEN];
@@ -1144,9 +1155,10 @@ int sg_ll_read_long10(int sg_fd, int pblock, int correct, unsigned long lba,
* SG_LIB_CAT_ILLEGAL_REQ_WITH_INFO -> bad field in cdb, with info
* field written to 'offsetp', SG_LIB_CAT_ABORTED_COMMAND,
* SG_LIB_CAT_NOT_READY -> device not ready, -1 -> other failure */
-int sg_ll_read_long16(int sg_fd, int pblock, int correct,
- unsigned long long llba, void * resp, int xfer_len,
- int * offsetp, int noisy, int verbose)
+int
+sg_ll_read_long16(int sg_fd, int pblock, int correct, unsigned long long llba,
+ void * resp, int xfer_len, int * offsetp, int noisy,
+ int verbose)
{
int k, res, sense_cat, ret;
unsigned char readLongCmdBlk[SERVICE_ACTION_IN_16_CMDLEN];
@@ -1243,9 +1255,10 @@ int sg_ll_read_long16(int sg_fd, int pblock, int correct,
* field written to 'offsetp', SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready,
* SG_LIB_CAT_ABORTED_COMMAND, -1 -> other failure */
-int sg_ll_write_long10(int sg_fd, int cor_dis, int wr_uncor, int pblock,
- unsigned long lba, void * data_out, int xfer_len,
- int * offsetp, int noisy, int verbose)
+int
+sg_ll_write_long10(int sg_fd, int cor_dis, int wr_uncor, int pblock,
+ unsigned long lba, void * data_out, int xfer_len,
+ int * offsetp, int noisy, int verbose)
{
int k, res, sense_cat, ret;
unsigned char writeLongCmdBlk[WRITE_LONG10_CMDLEN];
@@ -1340,9 +1353,10 @@ int sg_ll_write_long10(int sg_fd, int cor_dis, int wr_uncor, int pblock,
* field written to 'offsetp', SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready,
* SG_LIB_CAT_ABORTED_COMMAND, -1 -> other failure */
-int sg_ll_write_long16(int sg_fd, int cor_dis, int wr_uncor, int pblock,
- unsigned long long llba, void * data_out,
- int xfer_len, int * offsetp, int noisy, int verbose)
+int
+sg_ll_write_long16(int sg_fd, int cor_dis, int wr_uncor, int pblock,
+ unsigned long long llba, void * data_out, int xfer_len,
+ int * offsetp, int noisy, int verbose)
{
int k, res, sense_cat, ret;
unsigned char writeLongCmdBlk[SERVICE_ACTION_OUT_16_CMDLEN];
@@ -1443,9 +1457,11 @@ int sg_ll_write_long16(int sg_fd, int cor_dis, int wr_uncor, int pblock,
* SG_LIB_CAT_MEDIUM_HARD_WITH_INFO -> as previous, with valid info,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_verify10(int sg_fd, int dpo, int bytechk, unsigned long lba,
- int veri_len, void * data_out, int data_out_len,
- unsigned long * infop, int noisy, int verbose)
+int
+sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytechk,
+ unsigned long lba, int veri_len, void * data_out,
+ int data_out_len, unsigned long * infop, int noisy,
+ int verbose)
{
int k, res, ret, sense_cat;
unsigned char vCmdBlk[VERIFY10_CMDLEN] =
@@ -1453,10 +1469,8 @@ int sg_ll_verify10(int sg_fd, int dpo, int bytechk, unsigned long lba,
unsigned char sense_b[SENSE_BUFF_LEN];
struct sg_pt_base * ptvp;
- if (dpo)
- vCmdBlk[1] |= 0x10;
- if (bytechk)
- vCmdBlk[1] |= 0x2;
+ vCmdBlk[1] = ((vrprotect & 0x7) << 5) | ((dpo & 0x1) << 4) |
+ ((bytechk & 0x1) << 1) ;
vCmdBlk[2] = (unsigned char)((lba >> 24) & 0xff);
vCmdBlk[3] = (unsigned char)((lba >> 16) & 0xff);
vCmdBlk[4] = (unsigned char)((lba >> 8) & 0xff);
@@ -1541,11 +1555,12 @@ int sg_ll_verify10(int sg_fd, int dpo, int bytechk, unsigned long lba,
* sense buffer themselves. If available the data in resid is written to
* residp.
*/
-int sg_ll_ata_pt(int sg_fd, const unsigned char * cdbp, int cdb_len,
- int timeout_secs, void * dinp, void * doutp, int dlen,
- unsigned char * sensep, int max_sense_len,
- unsigned char * ata_return_dp, int max_ata_return_len,
- int * residp, int verbose)
+int
+sg_ll_ata_pt(int sg_fd, const unsigned char * cdbp, int cdb_len,
+ int timeout_secs, void * dinp, void * doutp, int dlen,
+ unsigned char * sensep, int max_sense_len,
+ unsigned char * ata_return_dp, int max_ata_return_len,
+ int * residp, int verbose)
{
int k, res, slen, duration;
unsigned char aptCmdBlk[ATA_PT_16_CMDLEN] =
@@ -1688,8 +1703,9 @@ out:
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_read_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
- void * resp, int mx_resp_len, int noisy, int verbose)
+int
+sg_ll_read_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
+ void * resp, int mx_resp_len, int noisy, int verbose)
{
int res, k, ret, sense_cat;
unsigned char rbufCmdBlk[READ_BUFFER_CMDLEN] =
@@ -1761,8 +1777,9 @@ int sg_ll_read_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
* SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
-int sg_ll_write_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
- void * paramp, int param_len, int noisy, int verbose)
+int
+sg_ll_write_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
+ void * paramp, int param_len, int noisy, int verbose)
{
int k, res, ret, sense_cat;
unsigned char wbufCmdBlk[WRITE_BUFFER_CMDLEN] =
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 27fd4671..962baac3 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -1,6 +1,6 @@
Summary: Utilities for devices that use SCSI command sets
Name: sg3_utils
-Version: 1.25
+Version: 1.26
# Release: 1%{?dist}
Release: 1
License: GPL
@@ -79,6 +79,10 @@ fi
%{_libdir}/*.la
%changelog
+* Fri Nov 02 2007 - dgilbert at interlog dot com
+- sg_get_config sync with mmc6r01
+ * sg3_utils-1.26
+
* Tue Oct 16 2007 - dgilbert at interlog dot com
- add sg_sat_set_features, sg_stpg, sg_safte; sg_dd oflag=sparse,null
* sg3_utils-1.25
diff --git a/src/sg_get_config.c b/src/sg_get_config.c
index dccde24b..3c3cbc2c 100644
--- a/src/sg_get_config.c
+++ b/src/sg_get_config.c
@@ -45,11 +45,11 @@
/* A utility program for the Linux OS SCSI subsystem.
*
* This program outputs information provided by a SCSI "Get Configuration"
- command [0x46] which is only defined for CD/DVDs (in MMC-2,3,4,5).
+ command [0x46] which is only defined for CD/DVDs (in MMC-2,3,4,5,6).
*/
-static char * version_str = "0.30 20070919";
+static char * version_str = "0.31 20071026"; /* mmc6r01 */
#define MX_ALLOC_LEN 8192
#define NAME_BUFF_SZ 64
@@ -112,7 +112,7 @@ struct code_desc {
static struct code_desc profile_desc_arr[] = {
{0x0, "No current profile"},
- {0x1, "Non-removable disk"},
+ {0x1, "Non-removable disk (obs)"},
{0x2, "Removable disk"},
{0x3, "Magneto optical erasable"},
{0x4, "Optical write once"},
@@ -127,6 +127,8 @@ static struct code_desc profile_desc_arr[] = {
{0x14, "DVD-RW sequential recording"},
{0x15, "DVD-R dual layer sequental recording"},
{0x16, "DVD-R dual layer jump recording"},
+ {0x17, "DVD-RW dual layer"},
+ {0x18, "DVD-Download disc recording"},
{0x1a, "DVD+RW"},
{0x1b, "DVD+R"},
{0x20, "DDCD-ROM"},
@@ -141,6 +143,9 @@ static struct code_desc profile_desc_arr[] = {
{0x50, "HD DVD-ROM"},
{0x51, "HD DVD-R"},
{0x52, "HD DVD-RAM"},
+ {0x53, "HD DVD-RW"},
+ {0x58, "HD DVD-R dual layer"},
+ {0x5a, "HD DVD-RW dual layer"},
{0xffff, "Non-conforming profile"},
};
@@ -189,6 +194,8 @@ static struct code_desc feature_desc_arr[] = {
{0x31, "Double density CD-R write"},
{0x32, "Double density CD-RW write"},
{0x33, "Layer jump recording"},
+ {0x34, "LJ rigid restricted oberwrite"},
+ {0x35, "Stop long operation"},
{0x37, "CD-RW media write support"},
{0x38, "BD-R POW"},
{0x3a, "DVD+RW dual layer"},
@@ -198,6 +205,7 @@ static struct code_desc feature_desc_arr[] = {
{0x42, "TSR (timely safe recording)"},
{0x50, "HD DVD read"},
{0x51, "HD DVD write"},
+ {0x52, "HD DVD-RW fragment recording"},
{0x80, "Hybrid disc"},
{0x100, "Power management"},
{0x101, "SMART"},
@@ -213,7 +221,9 @@ static struct code_desc feature_desc_arr[] = {
{0x10b, "DVD CPRM"},
{0x10c, "Firmware information"},
{0x10d, "AACS"},
+ {0x10e, "DVD CSS managed recording"},
{0x110, "VCPS"},
+ {0x113, "SecurDisc"},
{0x120, "BD CPS"},
};
@@ -316,8 +326,9 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
break;
}
printf(" Loading mechanism: %s\n", cp);
- printf(" Eject=%d, Prevent jumper=%d, Lock=%d\n",
- !!(ucp[4] & 0x8), !!(ucp[4] & 0x4), !!(ucp[4] & 0x1));
+ printf(" Load=%d, Eject=%d, Prevent jumper=%d, Lock=%d\n",
+ !!(ucp[4] & 0x10), !!(ucp[4] & 0x8), !!(ucp[4] & 0x4),
+ !!(ucp[4] & 0x1));
break;
case 4: /* Write protect */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
@@ -346,11 +357,13 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
case 0x22: /* Sector erasable */
case 0x26: /* Restricted overwrite */
case 0x27: /* CDRW CAV write */
+ case 0x35: /* Stop long operation */
case 0x38: /* BD-R pseudo-overwrite (POW) */
case 0x42: /* TSR (timely safe recording) */
case 0x100: /* Power management */
case 0x109: /* Media serial number */
case 0x110: /* VCPS */
+ case 0x113: /* SecurDisc */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
feature);
@@ -374,8 +387,8 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" additional length [%d] too short\n", len - 4);
break;
}
- printf(" MULTI110=%d, Dual-R=%d\n", !!(ucp[4] & 0x1),
- !!(ucp[6] & 0x1));
+ printf(" MULTI110=%d, Dual-RW=%d, Dual-R=%d\n",
+ !!(ucp[4] & 0x1), !!(ucp[6] & 0x2), !!(ucp[6] & 0x1));
break;
case 0x20: /* Random writable */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
@@ -407,14 +420,15 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
for (k = 0; k < num; ++k)
printf(" %d\n", ucp[8 + k]);
break;
+ /* case 0x22: Sector erasable -> see 0x1d entry */
case 0x23: /* Formattable */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
feature);
if (len > 4)
- printf(" BD-RE: RENoSA=%d, Expand=%d, QCert=%d, Cert=%d\n",
- !!(ucp[4] & 0x8), !!(ucp[4] & 0x4), !!(ucp[4] & 0x2),
- !!(ucp[4] & 0x1));
+ printf(" BD-RE: RENoSA=%d, Expand=%d, QCert=%d, Cert=%d, "
+ "FRF=%d\n", !!(ucp[4] & 0x8), !!(ucp[4] & 0x4),
+ !!(ucp[4] & 0x2), !!(ucp[4] & 0x1), !!(ucp[5] & 0x80));
if (len > 8)
printf(" BD-R: RRM=%d\n", !!(ucp[8] & 0x1));
break;
@@ -437,6 +451,8 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" Logical block size=0x%x, blocking=0x%x, PP=%d\n",
num, ((ucp[8] << 8) + ucp[9]), !!(ucp[10] & 0x1));
break;
+ /* case 0x26: Restricted overwrite -> see 0x1d entry */
+ /* case 0x27: CDRW CAV write -> see 0x1d entry */
case 0x28: /* MRW (Mount Rainier reWriteable) */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -528,7 +544,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" additional length [%d] too short\n", len - 4);
break;
}
- printf(" BUF=%d, RDL=%d, Test write=%d, DVD-RW=%d\n",
+ printf(" BUF=%d, RDL=%d, Test write=%d, DVD-RW SL=%d\n",
!!(ucp[4] & 0x40), !!(ucp[4] & 0x8), !!(ucp[4] & 0x4),
!!(ucp[4] & 0x2));
break;
@@ -545,6 +561,18 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
for (k = 0; k < num; ++k)
printf(" %d\n", ucp[8 + k]);
break;
+ case 0x34: /* Layer jump rigid restricted overwrite */
+ printf(" version=%d, persist=%d, current=%d [0x%x]\n",
+ ((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
+ feature);
+ if (len < 8) {
+ printf(" additional length [%d] too short\n", len - 4);
+ break;
+ }
+ printf(" CLJB=%d\n", !!(ucp[4] & 0x1));
+ printf(" Buffer block size=%d\n", ucp[7]);
+ break;
+ /* case 0x35: Stop long operation -> see 0x1d entry */
case 0x37: /* CD-RW media write support */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -555,6 +583,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
}
printf(" CD-RW media sub-type support (bitmask)=0x%x\n", ucp[5]);
break;
+ /* case 0x38: BD-R pseudo-overwrite (POW) -> see 0x1d entry */
case 0x3a: /* DVD+RW dual layer */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -631,6 +660,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
(ucp[28] << 8) + ucp[29],
(ucp[30] << 8) + ucp[31]);
break;
+ /* case 0x42: TSR (timely safe recording) -> see 0x1d entry */
case 0x50: /* HD DVD Read */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -653,6 +683,16 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" HD DVD-R=%d, HD DVD-RAM=%d\n", !!(ucp[4] & 0x1),
!!(ucp[6] & 0x1));
break;
+ case 0x52: /* HD DVD-RW fragment recording */
+ printf(" version=%d, persist=%d, current=%d [0x%x]\n",
+ ((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
+ feature);
+ if (len < 8) {
+ printf(" additional length [%d] too short\n", len - 4);
+ break;
+ }
+ printf(" BGP=%d\n", !!(ucp[4] & 0x1));
+ break;
case 0x80: /* Hybrid disc */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -663,6 +703,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
}
printf(" RI=%d\n", !!(ucp[4] & 0x1));
break;
+ /* case 0x100: Power management -> see 0x1d entry */
case 0x101: /* SMART */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -684,7 +725,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" SCC=%d, SDP=%d, highest slot number=%d\n",
!!(ucp[4] & 0x10), !!(ucp[4] & 0x4), (ucp[7] & 0x1f));
break;
- case 0x103: /* CD audio external play */
+ case 0x103: /* CD audio external play (obsolete) */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
feature);
@@ -748,6 +789,7 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
buff[n] = '\0';
printf(" Drive serial number: %s\n", buff);
break;
+ /* case 0x109: Media serial number -> see 0x1d entry */
case 0x10a: /* Disc control blocks */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
@@ -792,6 +834,19 @@ static void decode_feature(int feature, unsigned char * ucp, int len)
printf(" Number of AGIDs=%d, AACS version=%d\n",
(ucp[6] & 0xf), ucp[7]);
break;
+ case 0x10e: /* DVD CSS managed recording */
+ printf(" version=%d, persist=%d, current=%d [0x%x]\n",
+ ((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
+ feature);
+ if (len < 8) {
+ printf(" additional length [%d] too short\n", len - 4);
+ break;
+ }
+ printf(" Maximum number of scrambled extent information "
+ "entries=%d\n", ucp[4]);
+ break;
+ /* case 0x110: VCPS -> see 0x1d entry */
+ /* case 0x113: SecurDisc -> see 0x1d entry */
case 0x120: /* BD CPS */
printf(" version=%d, persist=%d, current=%d [0x%x]\n",
((ucp[2] >> 2) & 0xf), !!(ucp[2] & 0x2), !!(ucp[2] & 0x1),
diff --git a/src/sg_verify.c b/src/sg_verify.c
index 58b93fcf..75afa1fd 100644
--- a/src/sg_verify.c
+++ b/src/sg_verify.c
@@ -48,7 +48,7 @@
* This program issues the SCSI VERIFY command to the given SCSI block device.
*/
-static char * version_str = "1.10 20070919";
+static char * version_str = "1.11 20071102";
#define ME "sg_verify: "
@@ -61,15 +61,18 @@ static struct option long_options[] = {
{"lba", 1, 0, 'l'},
{"verbose", 0, 0, 'v'},
{"version", 0, 0, 'V'},
+ {"vrprotect", 1, 0, 'P'},
{0, 0, 0, 0},
};
-static void usage()
+static void
+usage()
{
fprintf(stderr, "Usage: "
"sg_verify [--bpc=BPC] [--count=COUNT] [--dpo] [--help] "
"[--lba=LBA]\n"
- " [--verbose] [--version] DEVICE\n"
+ " [--verbose] [--version] [--vrprotect=VRP] "
+ "DEVICE\n"
" where:\n"
" --bpc=BPC|-b BPC max blocks per verify command "
"(def 128)\n"
@@ -81,17 +84,21 @@ static void usage()
" --lba=LBA|-l LBA logical block address to start "
"verify (def 0)\n"
" --verbose|-v increase verbosity\n"
- " --version|-V print version string and exit\n\n"
+ " --version|-V print version string and exit\n"
+ " --vrprotect=VRP|-P VRP set vrprotect field to VRP "
+ "(def 0)\n"
"Performs a SCSI VERIFY(10) command\n"
);
}
-int main(int argc, char * argv[])
+int
+main(int argc, char * argv[])
{
int sg_fd, res, c, num;
long long ll;
int dpo = 0;
int bytechk = 0;
+ int vrprotect = 0;
long long count = 1;
long long orig_count;
int bpc = 128;
@@ -105,7 +112,7 @@ int main(int argc, char * argv[])
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "b:c:dhl:vV", long_options,
+ c = getopt_long(argc, argv, "b:c:dhl:P:vV", long_options,
&option_index);
if (c == -1)
break;
@@ -140,6 +147,18 @@ int main(int argc, char * argv[])
}
lba = (unsigned long long)ll;
break;
+ case 'P':
+ vrprotect = sg_get_num(optarg);
+ if (-1 == vrprotect) {
+ fprintf(stderr, "bad argument to '--vrprotect'\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ if ((vrprotect < 0) || (vrprotect > 7)) {
+ fprintf(stderr, "'--vrprotect' requires a value from 0 to "
+ "7 (inclusive)\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
case 'v':
++verbose;
break;
@@ -192,8 +211,9 @@ int main(int argc, char * argv[])
for (; count > 0; count -= bpc, lba +=bpc) {
num = (count > bpc) ? bpc : count;
- res = sg_ll_verify10(sg_fd, dpo, bytechk, (unsigned long)lba, num,
- NULL, 0, &info, 1, verbose);
+ res = sg_ll_verify10(sg_fd, vrprotect, dpo, bytechk,
+ (unsigned long)lba, num, NULL, 0,
+ &info, 1, verbose);
if (0 != res) {
ret = res;
switch (res) {