diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2015-05-12 04:21:05 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2015-05-12 04:21:05 +0000 |
commit | 77c837a07783a4e63b7f4a85852f55a112b994e0 (patch) | |
tree | 59ea0b252047bccea1e04c5ceeed3ccec04465c5 /src | |
parent | f54b2fbd8e1cc79cf1bafe9516a4771f88be29a7 (diff) | |
download | sg3_utils-77c837a07783a4e63b7f4a85852f55a112b994e0.tar.gz |
sg_lib: Linux: ENXIO errno --> SG_LIB_CAT_NOT_READY; asc/ascq codes --> T10 20150423
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@644 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r-- | src/sg_compare_and_write.c | 8 | ||||
-rw-r--r-- | src/sg_inq.c | 26 | ||||
-rw-r--r-- | src/sg_modes.c | 5 | ||||
-rw-r--r-- | src/sg_opcodes.c | 11 | ||||
-rw-r--r-- | src/sg_raw.c | 10 | ||||
-rw-r--r-- | src/sg_sanitize.c | 6 | ||||
-rw-r--r-- | src/sg_sync.c | 6 | ||||
-rw-r--r-- | src/sg_vpd.c | 7 | ||||
-rw-r--r-- | src/sg_write_same.c | 4 |
9 files changed, 53 insertions, 30 deletions
diff --git a/src/sg_compare_and_write.c b/src/sg_compare_and_write.c index 6fc18ce2..eb8082fc 100644 --- a/src/sg_compare_and_write.c +++ b/src/sg_compare_and_write.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2012-2014, Kaminario Technologies LTD +* Copyright (c) 2012-2015, Kaminario Technologies LTD * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -51,7 +51,7 @@ #include "sg_cmds_basic.h" #include "sg_pt.h" -static const char * version_str = "1.09 20140715"; +static const char * version_str = "1.10 20150511"; #define DEF_BLOCK_SIZE 512 #define DEF_NUM_BLOCKS (1) @@ -356,8 +356,8 @@ sg_compare_and_write(int sg_fd, unsigned char * buff, int blocks, } ptvp = construct_scsi_pt_obj(); if (NULL == ptvp) { - fprintf(sg_warnings_strm, "Could not construct scsit_pt_obj, " - "out of " "memory\n"); + fprintf(stderr, "Could not construct scsit_pt_obj, out of " + "memory\n"); return -1; } diff --git a/src/sg_inq.c b/src/sg_inq.c index 1623ccb2..fe302ae3 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.47 20150421"; /* SPC-5 rev 02 */ +static const char * version_str = "1.48 20150511"; /* SPC-5 rev 02 */ /* INQUIRY notes: * It is recommended that the initial allocation length given to a @@ -1839,7 +1839,17 @@ export_dev_ids(unsigned char * buff, int len, int verbose) printf("SCSI_IDENT_%s_VENDOR=", assoc_str); if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */ k = encode_whitespaces(ip, i_len); - printf("%.*s\n", k, ip); + /* udev-conformant character encoding */ + for (m = 0; m < k; ++m) { + if ((ip[m] >= '0' && ip[m] <= '9') || + (ip[m] >= 'A' && ip[m] <= 'Z') || + (ip[m] >= 'a' && ip[m] <= 'z') || + strchr("#+-.:=@_", ip[m]) != NULL) + printf("%c", ip[m]); + else + printf("\\x%02x", ip[m]); + } + printf("\n"); } else { for (m = 0; m < i_len; ++m) printf("%02x", (unsigned int)ip[m]); @@ -1850,7 +1860,17 @@ export_dev_ids(unsigned char * buff, int len, int verbose) printf("SCSI_IDENT_%s_T10=", assoc_str); if ((2 == c_set) || (3 == c_set)) { k = encode_whitespaces(ip, i_len); - printf("%.*s\n", k, ip); + /* udev-conformant character encoding */ + for (m = 0; m < k; ++m) { + if ((ip[m] >= '0' && ip[m] <= '9') || + (ip[m] >= 'A' && ip[m] <= 'Z') || + (ip[m] >= 'a' && ip[m] <= 'z') || + strchr("#+-.:=@_", ip[m]) != NULL) + printf("%c", ip[m]); + else + printf("\\x%02x", ip[m]); + } + printf("\n"); if (!memcmp(ip, "ATA_", 4)) { printf("SCSI_IDENT_%s_ATA=%.*s\n", assoc_str, k - 4, ip + 4); diff --git a/src/sg_modes.c b/src/sg_modes.c index 45bc9009..ed6ffdfa 100644 --- a/src/sg_modes.c +++ b/src/sg_modes.c @@ -26,7 +26,7 @@ #include "sg_lib.h" #include "sg_cmds_basic.h" -static const char * version_str = "1.45 20150110"; +static const char * version_str = "1.46 20150511"; #define DEF_ALLOC_LEN (1024 * 4) #define DEF_6_ALLOC_LEN 252 @@ -553,7 +553,8 @@ static struct page_code_desc pc_desc_disk[] = { {0x5, 0x0, "Flexible geometry (obsolete)"}, {0x7, 0x0, "Verify error recovery"}, {0x8, 0x0, "Caching"}, - {0xa, 0x02, "Application tag"}, + {0xa, 0x2, "Application tag"}, + {0xa, 0x5, "IO advice hints grouping"}, /* added sbc4r06 */ {0xa, 0xf1, "Parallel ATA control (SAT)"}, {0xa, 0xf2, "Reserved (SATA control) (SAT)"}, {0xb, 0x0, "Medium types supported (obsolete)"}, diff --git a/src/sg_opcodes.c b/src/sg_opcodes.c index 9aa3da38..34c00053 100644 --- a/src/sg_opcodes.c +++ b/src/sg_opcodes.c @@ -1,5 +1,5 @@ /* A utility program originally written for the Linux OS SCSI subsystem. - * Copyright (C) 2004-2014 D. Gilbert + * Copyright (C) 2004-2015 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 @@ #include "sg_pt.h" -static const char * version_str = "0.42 20140904"; /* spc4r37 */ +static const char * version_str = "0.43 20150511"; /* spc4r37 */ #define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */ @@ -952,8 +952,7 @@ do_rsoc(int sg_fd, int rctd, int rep_opts, int rq_opcode, int rq_servact, } ptvp = construct_scsi_pt_obj(); if (NULL == ptvp) { - fprintf(sg_warnings_strm, "Report Supported Operation Codes: out " - "of memory\n"); + fprintf(stderr, "Report Supported Operation Codes: out of memory\n"); return -1; } set_scsi_pt_cdb(ptvp, rsocCmdBlk, sizeof(rsocCmdBlk)); @@ -1008,8 +1007,8 @@ do_rstmf(int sg_fd, int repd, void * resp, int mx_resp_len, int noisy, } ptvp = construct_scsi_pt_obj(); if (NULL == ptvp) { - fprintf(sg_warnings_strm, "Report Supported Task Management " - "Functions: out of memory\n"); + fprintf(stderr, "Report Supported Task Management Functions: out of " + "memory\n"); return -1; } set_scsi_pt_cdb(ptvp, rstmfCmdBlk, sizeof(rstmfCmdBlk)); diff --git a/src/sg_raw.c b/src/sg_raw.c index 90d4fc50..510684fa 100644 --- a/src/sg_raw.c +++ b/src/sg_raw.c @@ -1,7 +1,7 @@ /* * A utility program originally written for the Linux OS SCSI subsystem. * - * Copyright (C) 2000-2014 Ingo van Lil <inguin@gmx.de> + * Copyright (C) 2000-2015 Ingo van Lil <inguin@gmx.de> * * 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 @@ -534,17 +534,17 @@ main(int argc, char *argv[]) break; case SCSI_PT_RESULT_TRANSPORT_ERR: get_scsi_pt_transport_err_str(ptvp, sizeof(b), b); - fprintf(sg_warnings_strm, ">>> transport error: %s\n", b); + fprintf(stderr, ">>> transport error: %s\n", b); ret = SG_LIB_CAT_OTHER; break; case SCSI_PT_RESULT_OS_ERR: get_scsi_pt_os_err_str(ptvp, sizeof(b), b); - fprintf(sg_warnings_strm, ">>> os error: %s\n", b); + fprintf(stderr, ">>> os error: %s\n", b); ret = SG_LIB_CAT_OTHER; break; default: - fprintf(sg_warnings_strm, ">>> unknown pass through result " - "category (%d)\n", res_cat); + fprintf(stderr, ">>> unknown pass through result category (%d)\n", + res_cat); ret = SG_LIB_CAT_OTHER; break; } diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c index 860fc7cb..96b9e317 100644 --- a/src/sg_sanitize.c +++ b/src/sg_sanitize.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Douglas Gilbert. + * Copyright (c) 2011-2015 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. @@ -26,7 +26,7 @@ #include "sg_cmds_basic.h" #include "sg_cmds_extra.h" -static const char * version_str = "0.96 20141006"; +static const char * version_str = "0.97 20150511"; /* Not all environments support the Unix sleep() */ #if defined(MSC_VER) || defined(__MINGW32__) @@ -201,7 +201,7 @@ do_sanitize(int sg_fd, const struct opts_t * op, const void * param_lstp, } ptvp = construct_scsi_pt_obj(); if (NULL == ptvp) { - fprintf(sg_warnings_strm, "Sanitize: out of memory\n"); + fprintf(stderr, "Sanitize: out of memory\n"); return -1; } set_scsi_pt_cdb(ptvp, sanCmdBlk, sizeof(sanCmdBlk)); diff --git a/src/sg_sync.c b/src/sg_sync.c index 64de2841..b79a8633 100644 --- a/src/sg_sync.c +++ b/src/sg_sync.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2014 Douglas Gilbert. + * Copyright (c) 2004-2015 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. @@ -25,7 +25,7 @@ * (e.g. disks). */ -static const char * version_str = "1.11 20140516"; +static const char * version_str = "1.12 20150511"; #define SYNCHRONIZE_CACHE16_CMD 0x91 #define SYNCHRONIZE_CACHE16_CMDLEN 16 @@ -116,7 +116,7 @@ ll_sync_cache_16(int sg_fd, int sync_nv, int immed, int group, fprintf(stderr, " synchronize cache(16) cdb: "); for (k = 0; k < SYNCHRONIZE_CACHE16_CMDLEN; ++k) fprintf(stderr, "%02x ", scCmdBlk[k]); - fprintf(sg_warnings_strm, "\n"); + fprintf(stderr, "\n"); } ptvp = construct_scsi_pt_obj(); if (NULL == ptvp) { diff --git a/src/sg_vpd.c b/src/sg_vpd.c index f0c71d8b..b5ad4155 100644 --- a/src/sg_vpd.c +++ b/src/sg_vpd.c @@ -36,7 +36,7 @@ */ -static const char * version_str = "1.04 20150407"; /* spc5r02 + sbc4r05 */ +static const char * version_str = "1.05 20150529"; /* spc5r02 + sbc4r05 */ /* These structures are duplicates of those of the same name in @@ -280,7 +280,10 @@ usage() " number unless hex indicator " "is given (e.g. '0x83')\n" " --quiet|-q suppress some output when decoding\n" - " --raw|-r output page in binary\n" + " --raw|-r output page in binary; if --inhex=FN is " + "also\n" + " given, FN is in binary (else FN is in " + "hex)\n" " --vendor=VP | -M VP vendor/product abbreviation [or " "number]\n" " --verbose|-v increase verbosity\n" diff --git a/src/sg_write_same.c b/src/sg_write_same.c index 0ac601b8..f6bcefd3 100644 --- a/src/sg_write_same.c +++ b/src/sg_write_same.c @@ -26,7 +26,7 @@ #include "sg_cmds_basic.h" #include "sg_cmds_extra.h" -static const char * version_str = "1.08 20150216"; +static const char * version_str = "1.09 20150511"; #define ME "sg_write_same: " @@ -271,7 +271,7 @@ do_write_same(int sg_fd, const struct opts_t * op, const void * dataoutp, } ptvp = construct_scsi_pt_obj(); if (NULL == ptvp) { - fprintf(sg_warnings_strm, "Write same(%d): out of memory\n", cdb_len); + fprintf(stderr, "Write same(%d): out of memory\n", cdb_len); return -1; } set_scsi_pt_cdb(ptvp, wsCmdBlk, cdb_len); |