diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2022-08-18 19:46:38 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2022-08-18 19:46:38 +0000 |
commit | 7e7308a2dbdec4c900b0805ad94324d3a288a163 (patch) | |
tree | c6c84399abcab97cc9bb0657f0734e0aa56a917d /lib | |
parent | 98b99ad2ab348bbba1676b95a8895f12ee48fd31 (diff) | |
download | sg3_utils-7e7308a2dbdec4c900b0805ad94324d3a288a163.tar.gz |
sg_inq+sg_vpd: more updates but not finished
The sg_inq+sg_inq work is mainly JSON additions.
sg_vpd has a new --sinq_inraw=RFN option.
Update and place names for the 64 TapeAlert flags
in the library. This improves TapeAlert reporting
for sg_inq, sg_vpd and sg_logs.
Refine the description of the VPD page merge of
processing for sg_inq and sg_vpd to only include _T10_
defined pages, so the vendor specific VPD page
processings of those utilities are still separate.
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@969 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 1 | ||||
-rw-r--r-- | lib/Makefile.in | 1 | ||||
-rw-r--r-- | lib/sg_lib.c | 6 | ||||
-rw-r--r-- | lib/sg_lib_data.c | 75 | ||||
-rw-r--r-- | lib/sg_pr2serr.c | 5 |
5 files changed, 82 insertions, 6 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 3f98edfb..69c64aff 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -91,6 +91,7 @@ AM_CFLAGS = -Wall -W $(DBG_CFLAGS) # AM_CFLAGS = -Wall -W -Wextra -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference -Wshadow -Wjump-misses-init # AM_CFLAGS = -Wall -W -pedantic -std=c11 # AM_CFLAGS = -Wall -W -pedantic -std=c11 --analyze +# AM_CFLAGS = -Wall -W -pedantic -std=c++11 # AM_CFLAGS = -Wall -W -pedantic -std=c++14 # AM_CFLAGS = -Wall -W -pedantic -std=c++1z # AM_CFLAGS = -Wall -W -pedantic -std=c++20 diff --git a/lib/Makefile.in b/lib/Makefile.in index 5f07c745..88ba65b9 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -404,6 +404,7 @@ AM_CFLAGS = -Wall -W $(DBG_CFLAGS) # AM_CFLAGS = -Wall -W -Wextra -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference -Wshadow -Wjump-misses-init # AM_CFLAGS = -Wall -W -pedantic -std=c11 # AM_CFLAGS = -Wall -W -pedantic -std=c11 --analyze +# AM_CFLAGS = -Wall -W -pedantic -std=c++11 # AM_CFLAGS = -Wall -W -pedantic -std=c++14 # AM_CFLAGS = -Wall -W -pedantic -std=c++1z # AM_CFLAGS = -Wall -W -pedantic -std=c++20 diff --git a/lib/sg_lib.c b/lib/sg_lib.c index 827a96b3..e1fbea6b 100644 --- a/lib/sg_lib.c +++ b/lib/sg_lib.c @@ -3580,7 +3580,7 @@ sg_f2hex_arr(const char * fname, bool as_binary, bool no_space, int ret = 0; unsigned int h; const char * lcp; - FILE * fp; + FILE * fp = NULL; struct stat a_stat; char line[512]; char carry_over[4]; @@ -3791,11 +3791,11 @@ sg_f2hex_arr(const char * fname, bool as_binary, bool no_space, return SG_LIB_LBA_OUT_OF_RANGE; } *mp_arr_len = off; - if (stdin != fp) + if (fp && (! has_stdin)) fclose(fp); return 0; fini: - if (fp && (stdin != fp)) + if (fp && (! has_stdin)) fclose(fp); return ret; } diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c index 92884b38..66c9e98d 100644 --- a/lib/sg_lib_data.c +++ b/lib/sg_lib_data.c @@ -19,7 +19,7 @@ #include "sg_lib_data.h" -const char * sg_lib_version_str = "2.92 20220809"; +const char * sg_lib_version_str = "2.93 20220816"; /* spc6r06, sbc5r03, zbc2r13 */ @@ -557,6 +557,75 @@ struct sg_lib_value_name_t sg_lib_zoning_in_arr[] = { {0xffff, 0, NULL}, }; +const char * sg_lib_tapealert_strs[] = { + "<parameter code 0, unknown>", /* 0x0 */ + "Read warning", + "Write warning", + "Hard error", + "Media", + "Read failure", + "Write failure", + "Media life", + "Not data grade", /* 0x8 */ + "Write protect", + "No removal", + "Cleaning media", + "Unsupported format", + "Recoverable mechanical cartridge failure", + "Unrecoverable mechanical cartridge failure", + "Memory chip in cartridge failure", + "Forced eject", /* 0x10 */ + "Read only format", + "Tape directory corrupted on load", + "Nearing media life", + "Cleaning required", + "Cleaning requested", + "Expired cleaning media", + "Invalid cleaning tape", + "Retension requested", /* 0x18 */ + "Dual port interface error", + "Cooling fan failing", + "Power supply failure", + "Power consumption", + "Drive maintenance", + "Hardware A", + "Hardware B", + "Interface", /* 0x20 */ + "Eject media", + "Microcode update fail", + "Drive humidity", + "Drive temperature", + "Drive voltage", + "Predictive failure", + "Diagnostics required", + "Reserved (28h)", /* 0x28 */ + "Reserved (29h)", + "Reserved (2Ah)", + "Reserved (2Bh)", + "Reserved (2Ch)", + "Reserved (2Dh)", + "Reserved (2Eh)", + "External data encryption control - communications failure", + "External data encryption control - key manager returned error",/* 0x30 */ + "Diminished native capacity", + "Lost statistics", + "Tape directory invalid at unload", + "Tape system area write failure", + "Tape system area read failure", + "No start of data", + "Loading failure", + "Unrecoverable unload failure", /* 0x38 */ + "Automation interface failure", + "Firmware failure", + "WORM medium - integrity check failed", + "WORM medium - overwrite attempted", + "Encryption policy violation", + "Reserved (3Eh)", + "Reserved (3Fh)", + "Reserved (40h)", /* 0x40 */ + NULL, +}; + /* Read attribute [0x8c] service actions */ struct sg_lib_value_name_t sg_lib_read_attr_arr[] = { {0x0, PDT_ALL, "attribute values"}, @@ -649,6 +718,10 @@ struct sg_lib_value_name_t sg_lib_read_attr_arr[] = { {0xffff, 0, NULL}, }; +const char * sg_lib_tapealert_strs[] = { + NULL, +}; + #endif /* SG_SCSI_STRINGS */ /* A conveniently formatted list of SCSI ASC/ASCQ codes and their diff --git a/lib/sg_pr2serr.c b/lib/sg_pr2serr.c index 52a4d000..5112fbfb 100644 --- a/lib/sg_pr2serr.c +++ b/lib/sg_pr2serr.c @@ -669,11 +669,12 @@ void sgj_js_nv_ihex_nex(sgj_state * jsp, sgj_opaque_p jop, const char * name, int64_t val_i, bool hex_as_well, const char * nex_s) { - bool as_hex = jsp->pr_hex && hex_as_well; - bool as_nex = jsp->pr_name_ex && nex_s; + bool as_hex, as_nex; if ((NULL == jsp) || (! jsp->pr_as_json)) return; + as_hex = jsp->pr_hex && hex_as_well; + as_nex = jsp->pr_name_ex && nex_s; if (! (as_hex || as_nex)) sgj_js_nv_i(jsp, jop, name, val_i); else { |