diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2016-05-28 20:14:47 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2016-05-28 20:14:47 +0000 |
commit | 2eb082b82dc3bb4413205a7a0994dae34ecd5db0 (patch) | |
tree | ca489ea53d4ff1a5690ca4357acfca8cd697f84b /examples | |
parent | eb96c6181e4436199a942054891420a07969f885 (diff) | |
download | sg3_utils-2eb082b82dc3bb4413205a7a0994dae34ecd5db0.tar.gz |
cdb naming clean up
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@709 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bsg_queue_tst.c | 12 | ||||
-rw-r--r-- | examples/scsi_inquiry.c | 8 | ||||
-rw-r--r-- | examples/sg__sat_identify.c | 22 | ||||
-rw-r--r-- | examples/sg__sat_phy_event.c | 26 | ||||
-rw-r--r-- | examples/sg__sat_set_features.c | 28 | ||||
-rw-r--r-- | examples/sg_excl.c | 14 | ||||
-rw-r--r-- | examples/sg_queue_tst.c | 14 | ||||
-rw-r--r-- | examples/sg_sat_chk_power.c | 16 | ||||
-rw-r--r-- | examples/sg_sat_smart_rd_data.c | 26 | ||||
-rw-r--r-- | examples/sg_simple1.c | 14 | ||||
-rw-r--r-- | examples/sg_simple16.c | 8 | ||||
-rw-r--r-- | examples/sg_simple2.c | 18 | ||||
-rw-r--r-- | examples/sg_simple3.c | 16 | ||||
-rw-r--r-- | examples/sg_simple4.c | 16 | ||||
-rw-r--r-- | examples/sg_simple5.c | 10 | ||||
-rw-r--r-- | examples/sgq_dd.c | 8 |
16 files changed, 128 insertions, 128 deletions
diff --git a/examples/bsg_queue_tst.c b/examples/bsg_queue_tst.c index ae7e3d00..af9ccff0 100644 --- a/examples/bsg_queue_tst.c +++ b/examples/bsg_queue_tst.c @@ -52,9 +52,9 @@ int main(int argc, char * argv[]) { int bsg_fd, k, ok; - unsigned char inqCmdBlk[INQ_CMD_LEN] = + unsigned char inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; - unsigned char sdiagCmdBlk[SDIAG_CMD_LEN] = + unsigned char sdiag_cdb[SDIAG_CMD_LEN] = {0x1d, 0, 0, 0, 0, 0}; unsigned char inqBuff[16][INQ_REPLY_LEN]; struct sg_io_v4 io_hdr[16]; @@ -100,11 +100,11 @@ int main(int argc, char * argv[]) io_hdr[k].guard = 'Q'; /* io_hdr[k].iovec_count = 0; */ /* memset takes care of this */ if (0 == (k % 3)) { - io_hdr[k].request_len = sizeof(sdiagCmdBlk); - io_hdr[k].request = (uint64_t)(long)sdiagCmdBlk; + io_hdr[k].request_len = sizeof(sdiag_cdb); + io_hdr[k].request = (uint64_t)(long)sdiag_cdb; } else { - io_hdr[k].request_len = sizeof(inqCmdBlk); - io_hdr[k].request = (uint64_t)(long)inqCmdBlk; + io_hdr[k].request_len = sizeof(inq_cdb); + io_hdr[k].request = (uint64_t)(long)inq_cdb; io_hdr[k].din_xfer_len = INQ_REPLY_LEN; io_hdr[k].din_xferp = (uint64_t)(long)inqBuff[k]; } diff --git a/examples/scsi_inquiry.c b/examples/scsi_inquiry.c index 80222950..32fe74d6 100644 --- a/examples/scsi_inquiry.c +++ b/examples/scsi_inquiry.c @@ -26,7 +26,7 @@ this is a good idea on a disk while it is mounted is debatable. No detrimental effects when this was tested ...] -Version 0.14 20011218 +Version 0.15 20160528 */ @@ -51,10 +51,10 @@ typedef struct my_scsi_ioctl_command { int main(int argc, char * argv[]) { int s_fd, res, k, to; - unsigned char inqCmdBlk [INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, + unsigned char inq_cdb [INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, INQUIRY_REPLY_LEN, 0}; unsigned char * inqBuff = (unsigned char *) - malloc(OFF + sizeof(inqCmdBlk) + 512); + malloc(OFF + sizeof(inq_cdb) + 512); unsigned char * buffp = inqBuff + OFF; My_Scsi_Ioctl_Command * ishp = (My_Scsi_Ioctl_Command *)inqBuff; char * file_name = 0; @@ -107,7 +107,7 @@ int main(int argc, char * argv[]) ishp->inlen = 0; ishp->outlen = INQUIRY_REPLY_LEN; - memcpy(buffp, inqCmdBlk, INQUIRY_CMDLEN); + memcpy(buffp, inq_cdb, INQUIRY_CMDLEN); res = ioctl(s_fd, SCSI_IOCTL_SEND_COMMAND, inqBuff); if (0 == res) { to = (int)*(buffp + 7); diff --git a/examples/sg__sat_identify.c b/examples/sg__sat_identify.c index 06ecfe6f..79c2a3a9 100644 --- a/examples/sg__sat_identify.c +++ b/examples/sg__sat_identify.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2007 Douglas Gilbert. + * Copyright (c) 2006-2016 Douglas Gilbert. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,7 +64,7 @@ #define EBUFF_SZ 256 -static char * version_str = "1.02 20070130"; +static char * version_str = "1.03 20160528"; static void usage() { @@ -81,7 +81,7 @@ static void usage() int main(int argc, char * argv[]) { int sg_fd, k, ok; - unsigned char aptCmdBlk[SAT_ATA_PASS_THROUGH16_LEN] = + unsigned char apt_cdb[SAT_ATA_PASS_THROUGH16_LEN] = {SAT_ATA_PASS_THROUGH16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; sg_io_hdr_t io_hdr; @@ -138,28 +138,28 @@ int main(int argc, char * argv[]) } /* Prepare ATA PASS-THROUGH COMMAND (16) command */ - aptCmdBlk[6] = 1; /* sector count */ - aptCmdBlk[14] = (do_packet ? ATA_IDENTIFY_PACKET_DEVICE : + apt_cdb[6] = 1; /* sector count */ + apt_cdb[14] = (do_packet ? ATA_IDENTIFY_PACKET_DEVICE : ATA_IDENTIFY_DEVICE); - aptCmdBlk[1] = (protocol << 1) | extend; - aptCmdBlk[2] = (chk_cond << 5) | (t_dir << 3) | - (byte_block << 2) | t_length; + apt_cdb[1] = (protocol << 1) | extend; + apt_cdb[2] = (chk_cond << 5) | (t_dir << 3) | + (byte_block << 2) | t_length; if (verbose) { fprintf(stderr, " ata pass through(16) cdb: "); for (k = 0; k < SAT_ATA_PASS_THROUGH16_LEN; ++k) - fprintf(stderr, "%02x ", aptCmdBlk[k]); + fprintf(stderr, "%02x ", apt_cdb[k]); fprintf(stderr, "\n"); } memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(aptCmdBlk); + io_hdr.cmd_len = sizeof(apt_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = ID_RESPONSE_LEN; io_hdr.dxferp = inBuff; - io_hdr.cmdp = aptCmdBlk; + io_hdr.cmdp = apt_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ diff --git a/examples/sg__sat_phy_event.c b/examples/sg__sat_phy_event.c index b21b3c90..e2dd2d01 100644 --- a/examples/sg__sat_phy_event.c +++ b/examples/sg__sat_phy_event.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2007 Douglas Gilbert. + * Copyright (c) 2006-2016 Douglas Gilbert. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,7 +64,7 @@ #define EBUFF_SZ 256 -static const char * version_str = "1.00 20070507"; +static const char * version_str = "1.01 20160528"; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -146,7 +146,7 @@ static void dStrRaw(const char* str, int len) int main(int argc, char * argv[]) { int sg_fd, c, k, j, ok, res, id, len, vendor; - unsigned char aptCmdBlk[SAT_ATA_PASS_THROUGH16_LEN] = + unsigned char apt_cdb[SAT_ATA_PASS_THROUGH16_LEN] = {SAT_ATA_PASS_THROUGH16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; sg_io_hdr_t io_hdr; @@ -235,29 +235,29 @@ int main(int argc, char * argv[]) /* Prepare SCSI ATA PASS-THROUGH COMMAND (16) command */ if (reset > 0) - aptCmdBlk[4] = 1; /* features (7:0) */ - aptCmdBlk[6] = 1; /* sector count */ - aptCmdBlk[8] = SATA_PHY_EVENT_LPAGE; /* lba_low (7:0) */ - aptCmdBlk[14] = ATA_READ_LOG_EXT; /* command */ - aptCmdBlk[1] = (protocol << 1) | extend; - aptCmdBlk[2] = (chk_cond << 5) | (t_dir << 3) | - (byte_block << 2) | t_length; + apt_cdb[4] = 1; /* features (7:0) */ + apt_cdb[6] = 1; /* sector count */ + apt_cdb[8] = SATA_PHY_EVENT_LPAGE; /* lba_low (7:0) */ + apt_cdb[14] = ATA_READ_LOG_EXT; /* command */ + apt_cdb[1] = (protocol << 1) | extend; + apt_cdb[2] = (chk_cond << 5) | (t_dir << 3) | (byte_block << 2) | + t_length; if (verbose) { fprintf(stderr, " ata pass through(16) cdb: "); for (k = 0; k < SAT_ATA_PASS_THROUGH16_LEN; ++k) - fprintf(stderr, "%02x ", aptCmdBlk[k]); + fprintf(stderr, "%02x ", apt_cdb[k]); fprintf(stderr, "\n"); } memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(aptCmdBlk); + io_hdr.cmd_len = sizeof(apt_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = READ_LOG_EXT_RESPONSE_LEN; io_hdr.dxferp = inBuff; - io_hdr.cmdp = aptCmdBlk; + io_hdr.cmdp = apt_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ diff --git a/examples/sg__sat_set_features.c b/examples/sg__sat_set_features.c index 9ea1ee0d..215d2351 100644 --- a/examples/sg__sat_set_features.c +++ b/examples/sg__sat_set_features.c @@ -58,7 +58,7 @@ #define EBUFF_SZ 256 -static char * version_str = "1.04 20160423"; +static char * version_str = "1.04 20160528"; static struct option long_options[] = { {"count", required_argument, 0, 'c'}, @@ -100,7 +100,7 @@ void usage() int main(int argc, char * argv[]) { int sg_fd, c, k; - unsigned char aptCmdBlk[SAT_ATA_PASS_THROUGH16_LEN] = + unsigned char apt_cdb[SAT_ATA_PASS_THROUGH16_LEN] = {SAT_ATA_PASS_THROUGH16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; sg_io_hdr_t io_hdr; @@ -198,31 +198,31 @@ int main(int argc, char * argv[]) } /* Prepare ATA PASS-THROUGH COMMAND (16) command */ - aptCmdBlk[14] = ATA_SET_FEATURES; - aptCmdBlk[1] = (protocol << 1) | extend; - aptCmdBlk[2] = (chk_cond << 5) | (t_dir << 3) | - (byte_block << 2) | t_length; - aptCmdBlk[4] = feature; - aptCmdBlk[6] = count; - aptCmdBlk[8] = lba & 0xff; - aptCmdBlk[10] = (lba >> 8) & 0xff; - aptCmdBlk[12] = (lba >> 16) & 0xff; + apt_cdb[14] = ATA_SET_FEATURES; + apt_cdb[1] = (protocol << 1) | extend; + apt_cdb[2] = (chk_cond << 5) | (t_dir << 3) | (byte_block << 2) | + t_length; + apt_cdb[4] = feature; + apt_cdb[6] = count; + apt_cdb[8] = lba & 0xff; + apt_cdb[10] = (lba >> 8) & 0xff; + apt_cdb[12] = (lba >> 16) & 0xff; if (verbose) { fprintf(stderr, " ata pass through(16) cdb: "); for (k = 0; k < SAT_ATA_PASS_THROUGH16_LEN; ++k) - fprintf(stderr, "%02x ", aptCmdBlk[k]); + fprintf(stderr, "%02x ", apt_cdb[k]); fprintf(stderr, "\n"); } memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(aptCmdBlk); + io_hdr.cmd_len = sizeof(apt_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_NONE; io_hdr.dxfer_len = 0; io_hdr.dxferp = NULL; - io_hdr.cmdp = aptCmdBlk; + io_hdr.cmdp = apt_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ diff --git a/examples/sg_excl.c b/examples/sg_excl.c index 6f9aa3ad..de84905c 100644 --- a/examples/sg_excl.c +++ b/examples/sg_excl.c @@ -22,7 +22,7 @@ Invocation: sg_excl [-x] <sg_device> - Version 3.58 (20130731) + Version 3.59 (20160528) 6 byte INQUIRY command: [0x12][ |lu][pg cde][res ][al len][cntrl ] @@ -43,9 +43,9 @@ int main(int argc, char * argv[]) { int sg_fd, k, ok /*, sg_fd2 */; - unsigned char inqCmdBlk [INQ_CMD_LEN] = + unsigned char inq_cdb [INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; - unsigned char turCmdBlk [TUR_CMD_LEN] = + unsigned char tur_cdb [TUR_CMD_LEN] = {0x00, 0, 0, 0, 0, 0}; unsigned char inqBuff[INQ_REPLY_LEN]; sg_io_hdr_t io_hdr; @@ -103,13 +103,13 @@ int main(int argc, char * argv[]) /* Prepare INQUIRY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inqCmdBlk); + io_hdr.cmd_len = sizeof(inq_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = INQ_REPLY_LEN; io_hdr.dxferp = inqBuff; - io_hdr.cmdp = inqCmdBlk; + io_hdr.cmdp = inq_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ @@ -154,10 +154,10 @@ int main(int argc, char * argv[]) /* Prepare TEST UNIT READY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(turCmdBlk); + io_hdr.cmd_len = sizeof(tur_cdb); io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; + io_hdr.cmdp = tur_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ diff --git a/examples/sg_queue_tst.c b/examples/sg_queue_tst.c index b8bc549e..9690b0ba 100644 --- a/examples/sg_queue_tst.c +++ b/examples/sg_queue_tst.c @@ -26,7 +26,7 @@ Invocation: sg_queue_tst [-t] <sg_device> -t queue at tail - Version 0.90 (20100324) + Version 0.91 (20160528) */ @@ -49,9 +49,9 @@ int main(int argc, char * argv[]) { int sg_fd, k, ok; - unsigned char inqCmdBlk[INQ_CMD_LEN] = + unsigned char inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; - unsigned char sdiagCmdBlk[SDIAG_CMD_LEN] = + unsigned char sdiag_cdb[SDIAG_CMD_LEN] = {0x1d, 0, 0, 0, 0, 0}; unsigned char inqBuff[16][INQ_REPLY_LEN]; sg_io_hdr_t io_hdr[16]; @@ -98,12 +98,12 @@ int main(int argc, char * argv[]) /* io_hdr[k].iovec_count = 0; */ /* memset takes care of this */ io_hdr[k].mx_sb_len = (unsigned char)sizeof(sense_buffer); if (0 == (k % 3)) { - io_hdr[k].cmd_len = sizeof(sdiagCmdBlk); - io_hdr[k].cmdp = sdiagCmdBlk; + io_hdr[k].cmd_len = sizeof(sdiag_cdb); + io_hdr[k].cmdp = sdiag_cdb; io_hdr[k].dxfer_direction = SG_DXFER_NONE; } else { - io_hdr[k].cmd_len = sizeof(inqCmdBlk); - io_hdr[k].cmdp = inqCmdBlk; + io_hdr[k].cmd_len = sizeof(inq_cdb); + io_hdr[k].cmdp = inq_cdb; io_hdr[k].dxfer_direction = SG_DXFER_FROM_DEV; io_hdr[k].dxfer_len = INQ_REPLY_LEN; io_hdr[k].dxferp = inqBuff[k]; diff --git a/examples/sg_sat_chk_power.c b/examples/sg_sat_chk_power.c index 14583300..5e65e927 100644 --- a/examples/sg_sat_chk_power.c +++ b/examples/sg_sat_chk_power.c @@ -56,7 +56,7 @@ #define EBUFF_SZ 256 -static const char * version_str = "1.05 20160423"; +static const char * version_str = "1.05 20160528"; #if 0 @@ -98,7 +98,7 @@ sg_sat_decode_fixed_sense(const unsigned char * sp, int slen, char * bp, int main(int argc, char * argv[]) { int sg_fd, k; - unsigned char aptCmdBlk[SAT_ATA_PASS_THROUGH16_LEN] = + unsigned char apt_cdb[SAT_ATA_PASS_THROUGH16_LEN] = {SAT_ATA_PASS_THROUGH16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; sg_io_hdr_t io_hdr; @@ -150,26 +150,26 @@ int main(int argc, char * argv[]) } /* Prepare ATA PASS-THROUGH COMMAND (16) command */ - aptCmdBlk[14] = ATA_CHECK_POWER_MODE; - aptCmdBlk[1] = (protocol << 1) | extend; - aptCmdBlk[2] = (chk_cond << 5) | (t_dir << 3) | + apt_cdb[14] = ATA_CHECK_POWER_MODE; + apt_cdb[1] = (protocol << 1) | extend; + apt_cdb[2] = (chk_cond << 5) | (t_dir << 3) | (byte_block << 2) | t_length; if (verbose) { fprintf(stderr, " ata pass through(16) cdb: "); for (k = 0; k < SAT_ATA_PASS_THROUGH16_LEN; ++k) - fprintf(stderr, "%02x ", aptCmdBlk[k]); + fprintf(stderr, "%02x ", apt_cdb[k]); fprintf(stderr, "\n"); } memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(aptCmdBlk); + io_hdr.cmd_len = sizeof(apt_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_NONE; io_hdr.dxfer_len = 0; io_hdr.dxferp = NULL; - io_hdr.cmdp = aptCmdBlk; + io_hdr.cmdp = apt_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ diff --git a/examples/sg_sat_smart_rd_data.c b/examples/sg_sat_smart_rd_data.c index deaf1454..36b824ca 100644 --- a/examples/sg_sat_smart_rd_data.c +++ b/examples/sg_sat_smart_rd_data.c @@ -57,12 +57,12 @@ #define EBUFF_SZ 256 -static char * version_str = "1.03 20160423"; +static char * version_str = "1.03 20160528"; int main(int argc, char * argv[]) { int sg_fd, k, ok; - unsigned char aptCmdBlk[SAT_ATA_PASS_THROUGH16_LEN] = + unsigned char apt_cdb[SAT_ATA_PASS_THROUGH16_LEN] = {SAT_ATA_PASS_THROUGH16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; sg_io_hdr_t io_hdr; @@ -115,30 +115,30 @@ int main(int argc, char * argv[]) } /* Prepare ATA PASS-THROUGH COMMAND (16) command */ - aptCmdBlk[4] = ATA_SMART_READ_DATA; /* feature (7:0) */ - aptCmdBlk[6] = 1; /* number of block (sector count) */ - aptCmdBlk[10] = 0x4f; /* lba_mid (7:0) */ - aptCmdBlk[12] = 0xc2; /* lba_high (7:0) */ - aptCmdBlk[14] = ATA_SMART; - aptCmdBlk[1] = (protocol << 1) | extend; - aptCmdBlk[2] = (chk_cond << 5) | (t_dir << 3) | - (byte_block << 2) | t_length; + apt_cdb[4] = ATA_SMART_READ_DATA; /* feature (7:0) */ + apt_cdb[6] = 1; /* number of block (sector count) */ + apt_cdb[10] = 0x4f; /* lba_mid (7:0) */ + apt_cdb[12] = 0xc2; /* lba_high (7:0) */ + apt_cdb[14] = ATA_SMART; + apt_cdb[1] = (protocol << 1) | extend; + apt_cdb[2] = (chk_cond << 5) | (t_dir << 3) | (byte_block << 2) | + t_length; if (verbose) { fprintf(stderr, " ata pass through(16) cdb: "); for (k = 0; k < SAT_ATA_PASS_THROUGH16_LEN; ++k) - fprintf(stderr, "%02x ", aptCmdBlk[k]); + fprintf(stderr, "%02x ", apt_cdb[k]); fprintf(stderr, "\n"); } memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(aptCmdBlk); + io_hdr.cmd_len = sizeof(apt_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = SMART_READ_DATA_RESPONSE_LEN; io_hdr.dxferp = inBuff; - io_hdr.cmdp = aptCmdBlk; + io_hdr.cmdp = apt_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ diff --git a/examples/sg_simple1.c b/examples/sg_simple1.c index 73ba76e9..d8352678 100644 --- a/examples/sg_simple1.c +++ b/examples/sg_simple1.c @@ -26,7 +26,7 @@ Invocation: sg_simple1 [-x] <scsi_device> - Version 03.58 (20070312) + Version 03.59 (20160528) 6 byte INQUIRY command: [0x12][ |lu][pg cde][res ][al len][cntrl ] @@ -45,9 +45,9 @@ int main(int argc, char * argv[]) { int sg_fd, k, ok; - unsigned char inqCmdBlk [INQ_CMD_LEN] = + unsigned char inq_cdb [INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; - unsigned char turCmdBlk [TUR_CMD_LEN] = + unsigned char tur_cdb [TUR_CMD_LEN] = {0x00, 0, 0, 0, 0, 0}; unsigned char inqBuff[INQ_REPLY_LEN]; sg_io_hdr_t io_hdr; @@ -95,13 +95,13 @@ int main(int argc, char * argv[]) /* Prepare INQUIRY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inqCmdBlk); + io_hdr.cmd_len = sizeof(inq_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = INQ_REPLY_LEN; io_hdr.dxferp = inqBuff; - io_hdr.cmdp = inqCmdBlk; + io_hdr.cmdp = inq_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ @@ -146,10 +146,10 @@ int main(int argc, char * argv[]) /* Prepare TEST UNIT READY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(turCmdBlk); + io_hdr.cmd_len = sizeof(tur_cdb); io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; + io_hdr.cmdp = tur_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ diff --git a/examples/sg_simple16.c b/examples/sg_simple16.c index 9f8a48ca..b4ad9582 100644 --- a/examples/sg_simple16.c +++ b/examples/sg_simple16.c @@ -21,7 +21,7 @@ Invocation: sg_simple16 <scsi_device> - Version 1.02 (20020206) + Version 1.03 (20160528) */ @@ -33,7 +33,7 @@ int main(int argc, char * argv[]) { int sg_fd, k, ok; - unsigned char r16CmdBlk [READ16_CMD_LEN] = + unsigned char r16_cdb [READ16_CMD_LEN] = {0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}; sg_io_hdr_t io_hdr; char * file_name = 0; @@ -77,13 +77,13 @@ int main(int argc, char * argv[]) /* Prepare READ_16 command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(r16CmdBlk); + io_hdr.cmd_len = sizeof(r16_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = READ16_REPLY_LEN; io_hdr.dxferp = inBuff; - io_hdr.cmdp = r16CmdBlk; + io_hdr.cmdp = r16_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ diff --git a/examples/sg_simple2.c b/examples/sg_simple2.c index a4763b54..a0710be5 100644 --- a/examples/sg_simple2.c +++ b/examples/sg_simple2.c @@ -18,7 +18,7 @@ In the lk 2.6 series devices nodes such as /dev/sda also support the SG_IO ioctl. -* Copyright (C) 1999-2007 D. Gilbert +* Copyright (C) 1999-2016 D. Gilbert * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -26,7 +26,7 @@ Invocation: sg_simple2 [-x] <scsi_device> - Version 03.58 (20070312) + Version 03.59 (20160528) 6 byte INQUIRY command: [0x12][ |lu][pg cde][res ][al len][cntrl ] @@ -36,7 +36,7 @@ */ -#define INQ_REPLY_LEN 96 /* logic assumes >= sizeof(inqCmdBlk) */ +#define INQ_REPLY_LEN 96 /* logic assumes >= sizeof(inq_cdb) */ #define INQ_CMD_LEN 6 #define TUR_CMD_LEN 6 @@ -46,9 +46,9 @@ int main(int argc, char * argv[]) { int sg_fd, k; - unsigned char inqCmdBlk [INQ_CMD_LEN] = + unsigned char inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; - unsigned char turCmdBlk [TUR_CMD_LEN] = + unsigned char tur_cdb[TUR_CMD_LEN] = {0x00, 0, 0, 0, 0, 0}; unsigned char inqBuff[INQ_REPLY_LEN]; sg_io_hdr_t io_hdr; @@ -96,13 +96,13 @@ int main(int argc, char * argv[]) /* Prepare INQUIRY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inqCmdBlk); + io_hdr.cmd_len = sizeof(inq_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = INQ_REPLY_LEN; io_hdr.dxferp = inqBuff; - io_hdr.cmdp = inqCmdBlk; + io_hdr.cmdp = inq_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ @@ -149,10 +149,10 @@ int main(int argc, char * argv[]) /* Prepare TEST UNIT READY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(turCmdBlk); + io_hdr.cmd_len = sizeof(tur_cdb); io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; + io_hdr.cmdp = tur_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ diff --git a/examples/sg_simple3.c b/examples/sg_simple3.c index 93f2971e..4927a923 100644 --- a/examples/sg_simple3.c +++ b/examples/sg_simple3.c @@ -17,7 +17,7 @@ the sg_io_hdr interface to break an INQUIRY response into its component parts. -* Copyright (C) 1999 D. Gilbert +* Copyright (C) 1999-2016 D. Gilbert * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -25,7 +25,7 @@ Invocation: sg_simple3 [-x] <sg_device> - Version 03.58 (20020226) + Version 03.59 (20160528) 6 byte INQUIRY command: [0x12][ |lu][pg cde][res ][al len][cntrl ] @@ -48,10 +48,10 @@ int main(int argc, char * argv[]) { int sg_fd, k, ok; - unsigned char inqCmdBlk [INQ_CMD_LEN] = {0x12, 0, 0, 0, + unsigned char inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_BASE_LEN + INQ_REPLY_VID_LEN + INQ_REPLY_PID_LEN + INQ_REPLY_PREV_LEN, 0}; - unsigned char turCmdBlk [TUR_CMD_LEN] = {0x00, 0, 0, 0, 0, 0}; + unsigned char tur_cdb[TUR_CMD_LEN] = {0x00, 0, 0, 0, 0, 0}; sg_iovec_t iovec[INQ_REPLY_IOVEC_COUNT]; unsigned char inqBaseBuff[INQ_REPLY_BASE_LEN]; char inqVidBuff[INQ_REPLY_VID_LEN]; @@ -102,7 +102,7 @@ int main(int argc, char * argv[]) /* Prepare INQUIRY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inqCmdBlk); + io_hdr.cmd_len = sizeof(inq_cdb); io_hdr.iovec_count = INQ_REPLY_IOVEC_COUNT; io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; @@ -117,7 +117,7 @@ int main(int argc, char * argv[]) iovec[3].iov_base = inqPRevBuff; iovec[3].iov_len = INQ_REPLY_PREV_LEN; io_hdr.dxferp = iovec; - io_hdr.cmdp = inqCmdBlk; + io_hdr.cmdp = inq_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */ @@ -162,10 +162,10 @@ int main(int argc, char * argv[]) /* Prepare TEST UNIT READY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(turCmdBlk); + io_hdr.cmd_len = sizeof(tur_cdb); io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; + io_hdr.cmdp = tur_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ diff --git a/examples/sg_simple4.c b/examples/sg_simple4.c index 8b633ab2..95a5023b 100644 --- a/examples/sg_simple4.c +++ b/examples/sg_simple4.c @@ -16,7 +16,7 @@ This variant shows mmap-ed IO being used to read the data returned by the INQUIRY command. -* Copyright (C) 2001 D. Gilbert +* Copyright (C) 2001-2016 D. Gilbert * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -24,7 +24,7 @@ Invocation: sg_simple4 [-x] <sg_device> - Version 1.01 (20020113) + Version 1.02 (20160528) 6 byte INQUIRY command: [0x12][ |lu][pg cde][res ][al len][cntrl ] @@ -47,9 +47,9 @@ int main(int argc, char * argv[]) { int sg_fd, k, ok; - unsigned char inqCmdBlk [INQ_CMD_LEN] = + unsigned char inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; - unsigned char turCmdBlk [TUR_CMD_LEN] = + unsigned char tur_cdb[TUR_CMD_LEN] = {0x00, 0, 0, 0, 0, 0}; unsigned char * inqBuff; unsigned char * inqBuff2; @@ -113,13 +113,13 @@ int main(int argc, char * argv[]) /* Prepare INQUIRY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inqCmdBlk); + io_hdr.cmd_len = sizeof(inq_cdb); /* io_hdr.iovec_count = 0; */ /* memset takes care of this */ io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = INQ_REPLY_LEN; /* io_hdr.dxferp = inqBuff; // ignored in mmap-ed IO */ - io_hdr.cmdp = inqCmdBlk; + io_hdr.cmdp = inq_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ io_hdr.flags = SG_FLAG_MMAP_IO; @@ -164,10 +164,10 @@ int main(int argc, char * argv[]) /* Prepare TEST UNIT READY command */ memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(turCmdBlk); + io_hdr.cmd_len = sizeof(tur_cdb); io_hdr.mx_sb_len = sizeof(sense_buffer); io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; + io_hdr.cmdp = tur_cdb; io_hdr.sbp = sense_buffer; io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */ diff --git a/examples/sg_simple5.c b/examples/sg_simple5.c index 3a09d8f7..0471bec8 100644 --- a/examples/sg_simple5.c +++ b/examples/sg_simple5.c @@ -19,7 +19,7 @@ Invocation: sg_simple5 [-x] <scsi_device> - Version 1.01 (20070331) + Version 1.02 (20160528) */ @@ -33,9 +33,9 @@ int main(int argc, char * argv[]) { int sg_fd, k, ok, dsize, res, duration, resid, cat, got, slen; - unsigned char inqCmdBlk [INQ_CMD_LEN] = + unsigned char inq_cdb [INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; - unsigned char turCmdBlk [TUR_CMD_LEN] = + unsigned char tur_cdb [TUR_CMD_LEN] = {0x00, 0, 0, 0, 0, 0}; unsigned char inqBuff[INQ_REPLY_LEN]; char * file_name = 0; @@ -85,7 +85,7 @@ int main(int argc, char * argv[]) fprintf(stderr, "sg_simple5: out of memory\n"); return -1; } - set_scsi_pt_cdb(ptvp, inqCmdBlk, sizeof(inqCmdBlk)); + set_scsi_pt_cdb(ptvp, inq_cdb, sizeof(inq_cdb)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_data_in(ptvp, inqBuff, dsize); res = do_scsi_pt(ptvp, sg_fd, CMD_TIMEOUT_SECS, verbose); @@ -168,7 +168,7 @@ finish_inq: fprintf(stderr, "sg_simple5: out of memory\n"); return -1; } - set_scsi_pt_cdb(ptvp, turCmdBlk, sizeof(turCmdBlk)); + set_scsi_pt_cdb(ptvp, tur_cdb, sizeof(tur_cdb)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); /* no data in or out */ res = do_scsi_pt(ptvp, sg_fd, CMD_TIMEOUT_SECS, verbose); diff --git a/examples/sgq_dd.c b/examples/sgq_dd.c index b3d82736..4b6bd041 100644 --- a/examples/sgq_dd.c +++ b/examples/sgq_dd.c @@ -48,7 +48,7 @@ typedef unsigned char u_char; /* horrible, for scsi.h */ */ -static char * version_str = "0.58 20151209"; +static char * version_str = "0.59 20160528"; /* resurrected from "0.55 20020509" */ #define DEF_BLOCK_SIZE 512 @@ -285,19 +285,19 @@ static int read_capacity(int sg_fd, int * num_sect, int * sect_sz) { int res; - unsigned char rcCmdBlk [10] = {0x25, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + unsigned char rc_cdb [10] = {0x25, 0, 0, 0, 0, 0, 0, 0, 0, 0}; unsigned char rcBuff[64]; unsigned char sense_b[64]; sg_io_hdr_t io_hdr; memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(rcCmdBlk); + io_hdr.cmd_len = sizeof(rc_cdb); io_hdr.mx_sb_len = sizeof(sense_b); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = sizeof(rcBuff); io_hdr.dxferp = rcBuff; - io_hdr.cmdp = rcCmdBlk; + io_hdr.cmdp = rc_cdb; io_hdr.sbp = sense_b; io_hdr.timeout = DEF_TIMEOUT; |