aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_cmds_extra.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2012-02-18 03:05:34 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2012-02-18 03:05:34 +0000
commitd02d2889c502cdccd3ec326bec8cc6651fc257be (patch)
tree49bf64b8fb0523bf6ecb5e3e029296a4c0768ece /lib/sg_cmds_extra.c
parentdd92db0e9896e4577f2309209920a58c109c1366 (diff)
downloadsg3_utils-d02d2889c502cdccd3ec326bec8cc6651fc257be.tar.gz
sg_verify, 16 byte cdb, bytchk and group number support
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@439 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib/sg_cmds_extra.c')
-rw-r--r--lib/sg_cmds_extra.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/sg_cmds_extra.c b/lib/sg_cmds_extra.c
index d7233924..647fb81a 100644
--- a/lib/sg_cmds_extra.c
+++ b/lib/sg_cmds_extra.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2011 Douglas Gilbert.
+ * Copyright (c) 1999-2012 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -1545,7 +1545,7 @@ sg_ll_write_long16(int sg_fd, int cor_dis, int wr_uncor, int pblock,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
int
-sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytechk,
+sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytchk,
unsigned int lba, int veri_len, void * data_out,
int data_out_len, unsigned int * infop, int noisy,
int verbose)
@@ -1557,7 +1557,7 @@ sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytechk,
struct sg_pt_base * ptvp;
vCmdBlk[1] = ((vrprotect & 0x7) << 5) | ((dpo & 0x1) << 4) |
- ((bytechk & 0x1) << 1) ;
+ ((bytchk & 0x1) << 1) ;
vCmdBlk[2] = (unsigned char)((lba >> 24) & 0xff);
vCmdBlk[3] = (unsigned char)((lba >> 16) & 0xff);
vCmdBlk[4] = (unsigned char)((lba >> 8) & 0xff);
@@ -1571,6 +1571,12 @@ sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytechk,
for (k = 0; k < VERIFY10_CMDLEN; ++k)
fprintf(sg_warnings_strm, "%02x ", vCmdBlk[k]);
fprintf(sg_warnings_strm, "\n");
+ if ((verbose > 3) && bytchk && data_out && (data_out_len > 0)) {
+ k = data_out_len > 4104 ? 4104 : data_out_len;
+ fprintf(sg_warnings_strm, " data_out buffer%s\n",
+ (data_out_len > 4104 ? ", first 4104 bytes" : ""));
+ dStrHex((const char *)data_out, k, verbose < 5);
+ }
}
ptvp = construct_scsi_pt_obj();
if (NULL == ptvp) {
@@ -1635,7 +1641,7 @@ sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytechk,
* SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
* -1 -> other failure */
int
-sg_ll_verify16(int sg_fd, int vrprotect, int dpo, int bytechk, uint64_t llba,
+sg_ll_verify16(int sg_fd, int vrprotect, int dpo, int bytchk, uint64_t llba,
int veri_len, int group_num, void * data_out,
int data_out_len, uint64_t * infop, int noisy, int verbose)
{
@@ -1646,7 +1652,7 @@ sg_ll_verify16(int sg_fd, int vrprotect, int dpo, int bytechk, uint64_t llba,
struct sg_pt_base * ptvp;
vCmdBlk[1] = ((vrprotect & 0x7) << 5) | ((dpo & 0x1) << 4) |
- ((bytechk & 0x1) << 1) ;
+ ((bytchk & 0x1) << 1) ;
vCmdBlk[2] = (llba >> 56) & 0xff;
vCmdBlk[3] = (llba >> 48) & 0xff;
vCmdBlk[4] = (llba >> 40) & 0xff;
@@ -1667,6 +1673,12 @@ sg_ll_verify16(int sg_fd, int vrprotect, int dpo, int bytechk, uint64_t llba,
for (k = 0; k < VERIFY16_CMDLEN; ++k)
fprintf(sg_warnings_strm, "%02x ", vCmdBlk[k]);
fprintf(sg_warnings_strm, "\n");
+ if ((verbose > 3) && bytchk && data_out && (data_out_len > 0)) {
+ k = data_out_len > 4104 ? 4104 : data_out_len;
+ fprintf(sg_warnings_strm, " data_out buffer%s\n",
+ (data_out_len > 4104 ? ", first 4104 bytes" : ""));
+ dStrHex((const char *)data_out, k, verbose < 5);
+ }
}
ptvp = construct_scsi_pt_obj();
if (NULL == ptvp) {