support reporting of Error Counter logging details (#2136439)
Resolves: #2136439
This commit is contained in:
parent
18b9274092
commit
0491688502
85
smartmontools-7.2-logsuppagefix1.patch
Normal file
85
smartmontools-7.2-logsuppagefix1.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
From da45fc39390208c30b3ba656ccfb478e217b7401 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Milan P. Gandhi" <mgandhi@redhat.com>
|
||||||
|
Date: Mon, 17 Oct 2022 14:23:54 +0530
|
||||||
|
Subject: [PATCH 1/3] scsiprint.cpp: Attempted fix to tickets 1272, 1331 and
|
||||||
|
1346: Log sub-page handling
|
||||||
|
|
||||||
|
---
|
||||||
|
smartmontools-7.1/scsiprint.cpp | 27 +++++++++++++++++----------
|
||||||
|
1 file changed, 17 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/smartmontools-7.1/scsiprint.cpp b/smartmontools-7.1/scsiprint.cpp
|
||||||
|
index 4c52268..1edb7c2 100644
|
||||||
|
--- a/smartmontools-7.1/scsiprint.cpp
|
||||||
|
+++ b/smartmontools-7.1/scsiprint.cpp
|
||||||
|
@@ -118,8 +118,10 @@ static void
|
||||||
|
scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
{
|
||||||
|
bool got_subpages = false;
|
||||||
|
- int k, bump, err, payload_len, num_unreported, num_unreported_spg;
|
||||||
|
- int payload_len_pg0_0 = 0;
|
||||||
|
+ int k, bump, err, resp_len, num_unreported, num_unreported_spg;
|
||||||
|
+ int resp_len_pg0_0 = 0;
|
||||||
|
+ int resp_len_pg0_ff = 0; /* in SPC-4, response length of supported
|
||||||
|
+ * log pages _and_ log subpages */
|
||||||
|
const uint8_t * up;
|
||||||
|
uint8_t sup_lpgs[LOG_RESP_LEN];
|
||||||
|
|
||||||
|
@@ -143,7 +145,7 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
(scsi_version <= SCSI_VERSION_HIGHEST)) {
|
||||||
|
/* unclear what code T10 will choose for SPC-6 */
|
||||||
|
memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
||||||
|
- payload_len_pg0_0 = sup_lpgs[3];
|
||||||
|
+ resp_len_pg0_0 = sup_lpgs[3];
|
||||||
|
if ((err = scsiLogSense(device, SUPPORTED_LPAGES, SUPP_SPAGE_L_SPAGE,
|
||||||
|
gBuf, LOG_RESP_LONG_LEN,
|
||||||
|
-1 /* just single not double fetch */))) {
|
||||||
|
@@ -160,33 +162,38 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
if (scsi_debugmode > 0)
|
||||||
|
pout("%s supported subpages is bad SPF=%u SUBPG=%u\n",
|
||||||
|
logSenRspStr, !! (0x40 & gBuf[0]), gBuf[2]);
|
||||||
|
- } else
|
||||||
|
+ } else {
|
||||||
|
+ resp_len_pg0_ff = sg_get_unaligned_be16(gBuf + 2);
|
||||||
|
got_subpages = true;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
- } else
|
||||||
|
+ } else {
|
||||||
|
memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
||||||
|
+ resp_len_pg0_0 = sup_lpgs[3];
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (got_subpages) {
|
||||||
|
- payload_len = sg_get_unaligned_be16(gBuf + 2);
|
||||||
|
- if (payload_len <= payload_len_pg0_0) {
|
||||||
|
+ resp_len = sg_get_unaligned_be16(gBuf + 2);
|
||||||
|
+ if (resp_len_pg0_ff <= resp_len_pg0_0) {
|
||||||
|
/* something is rotten ....., ignore SUPP_SPAGE_L_SPAGE */
|
||||||
|
- payload_len = payload_len_pg0_0;
|
||||||
|
+ resp_len = resp_len_pg0_0;
|
||||||
|
bump = 1;
|
||||||
|
up = sup_lpgs + LOGPAGEHDRSIZE;
|
||||||
|
got_subpages = false;
|
||||||
|
(void)got_subpages; // not yet used below, suppress warning
|
||||||
|
} else {
|
||||||
|
+ resp_len = resp_len_pg0_ff;
|
||||||
|
bump = 2;
|
||||||
|
up = gBuf + LOGPAGEHDRSIZE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
- payload_len = payload_len_pg0_0;
|
||||||
|
+ resp_len = resp_len_pg0_0;
|
||||||
|
bump = 1;
|
||||||
|
up = sup_lpgs + LOGPAGEHDRSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
num_unreported_spg = 0;
|
||||||
|
- for (num_unreported = 0, k = 0; k < payload_len; k += bump, up += bump) {
|
||||||
|
+ for (num_unreported = 0, k = 0; k < resp_len; k += bump, up += bump) {
|
||||||
|
uint8_t pg_num = 0x3f & up[0];
|
||||||
|
uint8_t sub_pg_num = (0x40 & up[0]) ? up[1] : 0;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
185
smartmontools-7.2-logsuppagefix2.patch
Normal file
185
smartmontools-7.2-logsuppagefix2.patch
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
From b6064d5ba30ee355e71e7543fdb66ea99fcebae4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Milan P. Gandhi" <mgandhi@redhat.com>
|
||||||
|
Date: Mon, 17 Oct 2022 14:24:42 +0530
|
||||||
|
Subject: [PATCH 2/3] scsiprint.cpp: Add 'Accumulated power on time' field to
|
||||||
|
'smartctl -a'
|
||||||
|
|
||||||
|
---
|
||||||
|
smartmontools-7.1/scsiprint.cpp | 82 ++++++++++++++++++++++-----------
|
||||||
|
1 file changed, 56 insertions(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/smartmontools-7.1/scsiprint.cpp b/smartmontools-7.1/scsiprint.cpp
|
||||||
|
index 1edb7c2..81bed88 100644
|
||||||
|
--- a/smartmontools-7.1/scsiprint.cpp
|
||||||
|
+++ b/smartmontools-7.1/scsiprint.cpp
|
||||||
|
@@ -120,7 +120,7 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
bool got_subpages = false;
|
||||||
|
int k, bump, err, resp_len, num_unreported, num_unreported_spg;
|
||||||
|
int resp_len_pg0_0 = 0;
|
||||||
|
- int resp_len_pg0_ff = 0; /* in SPC-4, response length of supported
|
||||||
|
+ int resp_len_pg0_ff = 0; /* in SPC-4, response length of supported
|
||||||
|
* log pages _and_ log subpages */
|
||||||
|
const uint8_t * up;
|
||||||
|
uint8_t sup_lpgs[LOG_RESP_LEN];
|
||||||
|
@@ -163,13 +163,13 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
pout("%s supported subpages is bad SPF=%u SUBPG=%u\n",
|
||||||
|
logSenRspStr, !! (0x40 & gBuf[0]), gBuf[2]);
|
||||||
|
} else {
|
||||||
|
- resp_len_pg0_ff = sg_get_unaligned_be16(gBuf + 2);
|
||||||
|
+ resp_len_pg0_ff = sg_get_unaligned_be16(gBuf + 2);
|
||||||
|
got_subpages = true;
|
||||||
|
- }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
||||||
|
- resp_len_pg0_0 = sup_lpgs[3];
|
||||||
|
+ resp_len_pg0_0 = sup_lpgs[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (got_subpages) {
|
||||||
|
@@ -182,7 +182,7 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
got_subpages = false;
|
||||||
|
(void)got_subpages; // not yet used below, suppress warning
|
||||||
|
} else {
|
||||||
|
- resp_len = resp_len_pg0_ff;
|
||||||
|
+ resp_len = resp_len_pg0_ff;
|
||||||
|
bump = 2;
|
||||||
|
up = gBuf + LOGPAGEHDRSIZE;
|
||||||
|
}
|
||||||
|
@@ -1162,12 +1162,14 @@ static const char * reassign_status[] = {
|
||||||
|
// Returns 0 if ok else FAIL* bitmask. Note can have a status entry
|
||||||
|
// and up to 2048 events (although would hope to have less). May set
|
||||||
|
// FAILLOG if serious errors detected (in the future).
|
||||||
|
+// When only_pow_time is true only print "Accumulated power on time"
|
||||||
|
+// data, if available.
|
||||||
|
static int
|
||||||
|
-scsiPrintBackgroundResults(scsi_device * device)
|
||||||
|
+scsiPrintBackgroundResults(scsi_device * device, bool only_pow_time)
|
||||||
|
{
|
||||||
|
+ bool noheader = true;
|
||||||
|
+ bool firstresult = true;
|
||||||
|
int num, j, m, err, truncated;
|
||||||
|
- int noheader = 1;
|
||||||
|
- int firstresult = 1;
|
||||||
|
int retval = 0;
|
||||||
|
uint8_t * ucp;
|
||||||
|
static const char * hname = "Background scan results";
|
||||||
|
@@ -1188,9 +1190,12 @@ scsiPrintBackgroundResults(scsi_device * device)
|
||||||
|
// compute page length
|
||||||
|
num = sg_get_unaligned_be16(gBuf + 2) + 4;
|
||||||
|
if (num < 20) {
|
||||||
|
- print_on();
|
||||||
|
- pout("%s %s length is %d, no scan status\n", hname, logSenStr, num);
|
||||||
|
- print_off();
|
||||||
|
+ if (! only_pow_time) {
|
||||||
|
+ print_on();
|
||||||
|
+ pout("%s %s length is %d, no scan status\n", hname, logSenStr,
|
||||||
|
+ num);
|
||||||
|
+ print_off();
|
||||||
|
+ }
|
||||||
|
return FAILSMART;
|
||||||
|
}
|
||||||
|
truncated = (num > LOG_RESP_LONG_LEN) ? num : 0;
|
||||||
|
@@ -1205,22 +1210,32 @@ scsiPrintBackgroundResults(scsi_device * device)
|
||||||
|
switch (pc) {
|
||||||
|
case 0:
|
||||||
|
if (noheader) {
|
||||||
|
- noheader = 0;
|
||||||
|
- pout("%s log\n", hname);
|
||||||
|
+ noheader = false;
|
||||||
|
+ if (! only_pow_time)
|
||||||
|
+ pout("%s log\n", hname);
|
||||||
|
}
|
||||||
|
- pout(" Status: ");
|
||||||
|
+ if (! only_pow_time)
|
||||||
|
+ pout(" Status: ");
|
||||||
|
if ((pl < 16) || (num < 16)) {
|
||||||
|
- pout("\n");
|
||||||
|
+ if (! only_pow_time)
|
||||||
|
+ pout("\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
j = ucp[9];
|
||||||
|
- if (j < (int)(sizeof(bms_status) / sizeof(bms_status[0])))
|
||||||
|
- pout("%s\n", bms_status[j]);
|
||||||
|
- else
|
||||||
|
- pout("unknown [0x%x] background scan status value\n", j);
|
||||||
|
+ if (! only_pow_time) {
|
||||||
|
+ if (j < (int)(sizeof(bms_status) / sizeof(bms_status[0])))
|
||||||
|
+ pout("%s\n", bms_status[j]);
|
||||||
|
+ else
|
||||||
|
+ pout("unknown [0x%x] background scan status value\n", j);
|
||||||
|
+ }
|
||||||
|
j = sg_get_unaligned_be32(ucp + 4);
|
||||||
|
- pout(" Accumulated power on time, hours:minutes %d:%02d "
|
||||||
|
- "[%d minutes]\n", (j / 60), (j % 60), j);
|
||||||
|
+ pout("%sAccumulated power on time, hours:minutes %d:%02d",
|
||||||
|
+ (only_pow_time ? "" : " "), (j / 60), (j % 60));
|
||||||
|
+ if (only_pow_time) {
|
||||||
|
+ pout("\n");
|
||||||
|
+ break;
|
||||||
|
+ } else
|
||||||
|
+ pout(" [%d minutes]\n", j);
|
||||||
|
jglb["power_on_time"]["hours"] = j / 60;
|
||||||
|
jglb["power_on_time"]["minutes"] = j % 60;
|
||||||
|
pout(" Number of background scans performed: %d, ",
|
||||||
|
@@ -1232,9 +1247,12 @@ scsiPrintBackgroundResults(scsi_device * device)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (noheader) {
|
||||||
|
- noheader = 0;
|
||||||
|
- pout("\n%s log\n", hname);
|
||||||
|
+ noheader = false;
|
||||||
|
+ if (! only_pow_time)
|
||||||
|
+ pout("\n%s log\n", hname);
|
||||||
|
}
|
||||||
|
+ if (only_pow_time)
|
||||||
|
+ break;
|
||||||
|
if (firstresult) {
|
||||||
|
firstresult = 0;
|
||||||
|
pout("\n # when lba(hex) [sk,asc,ascq] "
|
||||||
|
@@ -1262,10 +1280,11 @@ scsiPrintBackgroundResults(scsi_device * device)
|
||||||
|
num -= pl;
|
||||||
|
ucp += pl;
|
||||||
|
}
|
||||||
|
- if (truncated)
|
||||||
|
+ if (truncated && (! only_pow_time))
|
||||||
|
pout(" >>>> log truncated, fetched %d of %d available "
|
||||||
|
"bytes\n", LOG_RESP_LONG_LEN, truncated);
|
||||||
|
- pout("\n");
|
||||||
|
+ if (! only_pow_time)
|
||||||
|
+ pout("\n");
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2447,6 +2466,17 @@ scsiPrintMain(scsi_device * device, const scsi_print_options & options)
|
||||||
|
scsiGetSupportedLogPages(device);
|
||||||
|
if (gTempLPage)
|
||||||
|
scsiPrintTemp(device);
|
||||||
|
+ }
|
||||||
|
+ // in the 'smartctl -a" case only want: "Accumulated power on time"
|
||||||
|
+ if ((! options.smart_background_log) && is_disk) {
|
||||||
|
+ if (! checkedSupportedLogPages)
|
||||||
|
+ scsiGetSupportedLogPages(device);
|
||||||
|
+ res = 0;
|
||||||
|
+ if (gBackgroundResultsLPage)
|
||||||
|
+ res = scsiPrintBackgroundResults(device, true);
|
||||||
|
+ any_output = true;
|
||||||
|
+ }
|
||||||
|
+ if (options.smart_vendor_attrib) {
|
||||||
|
if (gStartStopLPage)
|
||||||
|
scsiGetStartStopData(device);
|
||||||
|
if (is_disk) {
|
||||||
|
@@ -2488,7 +2518,7 @@ scsiPrintMain(scsi_device * device, const scsi_print_options & options)
|
||||||
|
scsiGetSupportedLogPages(device);
|
||||||
|
res = 0;
|
||||||
|
if (gBackgroundResultsLPage)
|
||||||
|
- res = scsiPrintBackgroundResults(device);
|
||||||
|
+ res = scsiPrintBackgroundResults(device, false);
|
||||||
|
else {
|
||||||
|
pout("Device does not support Background scan results logging\n");
|
||||||
|
failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
231
smartmontools-7.2-logsuppagefix3.patch
Normal file
231
smartmontools-7.2-logsuppagefix3.patch
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
From 7c207dd5d06efccdee7258f832d4216fe5d1d998 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Milan P. Gandhi" <mgandhi@redhat.com>
|
||||||
|
Date: Mon, 17 Oct 2022 14:25:34 +0530
|
||||||
|
Subject: [PATCH 3/3] scsiprint.cpp: applied patch proposed by Yannick Hemery
|
||||||
|
to merge both 'supported' log pages
|
||||||
|
|
||||||
|
---
|
||||||
|
smartmontools-7.1/scsicmds.h | 5 ++
|
||||||
|
smartmontools-7.1/scsiprint.cpp | 103 +++++++++++++++++---------------
|
||||||
|
2 files changed, 59 insertions(+), 49 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/smartmontools-7.1/scsicmds.h b/smartmontools-7.1/scsicmds.h
|
||||||
|
index 516f773..9bd8b21 100644
|
||||||
|
--- a/smartmontools-7.1/scsicmds.h
|
||||||
|
+++ b/smartmontools-7.1/scsicmds.h
|
||||||
|
@@ -167,6 +167,11 @@ struct scsi_readcap_resp {
|
||||||
|
uint16_t l_a_lba; /* Lowest Aligned Logical Block Address */
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct scsi_supp_log_pages {
|
||||||
|
+ uint8_t page_code;
|
||||||
|
+ uint8_t subpage_code;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
/* SCSI Peripheral types (of interest) */
|
||||||
|
#define SCSI_PT_DIRECT_ACCESS 0x0
|
||||||
|
#define SCSI_PT_SEQUENTIAL_ACCESS 0x1
|
||||||
|
diff --git a/smartmontools-7.1/scsiprint.cpp b/smartmontools-7.1/scsiprint.cpp
|
||||||
|
index 81bed88..21a4929 100644
|
||||||
|
--- a/smartmontools-7.1/scsiprint.cpp
|
||||||
|
+++ b/smartmontools-7.1/scsiprint.cpp
|
||||||
|
@@ -39,6 +39,9 @@ uint8_t gBuf[GBUF_SIZE];
|
||||||
|
#define LOG_RESP_LONG_LEN ((62 * 256) + 252)
|
||||||
|
#define LOG_RESP_TAPE_ALERT_LEN 0x144
|
||||||
|
|
||||||
|
+/* Supported log pages + Supported log pages and subpages maximum count */
|
||||||
|
+#define SCSI_SUPP_LOG_PAGES_MAX_COUNT (252 + (62 * 128) + 126)
|
||||||
|
+
|
||||||
|
/* Log pages supported */
|
||||||
|
static bool gSmartLPage = false; /* Informational Exceptions log page */
|
||||||
|
static bool gTempLPage = false;
|
||||||
|
@@ -118,14 +121,17 @@ static void
|
||||||
|
scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
{
|
||||||
|
bool got_subpages = false;
|
||||||
|
- int k, bump, err, resp_len, num_unreported, num_unreported_spg;
|
||||||
|
- int resp_len_pg0_0 = 0;
|
||||||
|
- int resp_len_pg0_ff = 0; /* in SPC-4, response length of supported
|
||||||
|
- * log pages _and_ log subpages */
|
||||||
|
+ int k, err, resp_len, num_unreported, num_unreported_spg;
|
||||||
|
+ int supp_lpg_and_spg_count = 0;
|
||||||
|
+
|
||||||
|
const uint8_t * up;
|
||||||
|
uint8_t sup_lpgs[LOG_RESP_LEN];
|
||||||
|
+ struct scsi_supp_log_pages supp_lpg_and_spg[SCSI_SUPP_LOG_PAGES_MAX_COUNT];
|
||||||
|
|
||||||
|
memset(gBuf, 0, LOG_RESP_LEN);
|
||||||
|
+ memset(supp_lpg_and_spg, 0, sizeof(supp_lpg_and_spg));
|
||||||
|
+
|
||||||
|
+ /* Get supported log pages */
|
||||||
|
if ((err = scsiLogSense(device, SUPPORTED_LPAGES, 0, gBuf,
|
||||||
|
LOG_RESP_LEN, 0 /* do double fetch */))) {
|
||||||
|
if (scsi_debugmode > 0)
|
||||||
|
@@ -140,12 +146,23 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
logSenStr, scsiErrString(err));
|
||||||
|
if (err)
|
||||||
|
return;
|
||||||
|
- memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
||||||
|
- } else if ((scsi_version >= SCSI_VERSION_SPC_4) &&
|
||||||
|
- (scsi_version <= SCSI_VERSION_HIGHEST)) {
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
||||||
|
+ resp_len = gBuf[3];
|
||||||
|
+ up = gBuf + LOGPAGEHDRSIZE;
|
||||||
|
+
|
||||||
|
+ for (k = 0; k < resp_len; k += 1) {
|
||||||
|
+ uint8_t page_code = 0x3f & up[k];
|
||||||
|
+ supp_lpg_and_spg[supp_lpg_and_spg_count++] = {page_code, 0};
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Get supported log pages and subpages. Most drives seems to include the
|
||||||
|
+ supported log pages here as well, but some drives such as the Samsung
|
||||||
|
+ PM1643a will only report the additional log pages with subpages here */
|
||||||
|
+ if ((scsi_version >= SCSI_VERSION_SPC_4) &&
|
||||||
|
+ (scsi_version <= SCSI_VERSION_HIGHEST)) {
|
||||||
|
/* unclear what code T10 will choose for SPC-6 */
|
||||||
|
- memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
||||||
|
- resp_len_pg0_0 = sup_lpgs[3];
|
||||||
|
if ((err = scsiLogSense(device, SUPPORTED_LPAGES, SUPP_SPAGE_L_SPAGE,
|
||||||
|
gBuf, LOG_RESP_LONG_LEN,
|
||||||
|
-1 /* just single not double fetch */))) {
|
||||||
|
@@ -153,6 +170,7 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
pout("%s for supported pages and subpages failed [%s]\n",
|
||||||
|
logSenStr, scsiErrString(err));
|
||||||
|
} else {
|
||||||
|
+ /* Ensure we didn't get the same answer than without the subpages */
|
||||||
|
if (0 == memcmp(gBuf, sup_lpgs, LOG_RESP_LEN)) {
|
||||||
|
if (scsi_debugmode > 0)
|
||||||
|
pout("%s: %s ignored subpage field, bad\n",
|
||||||
|
@@ -163,48 +181,34 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
pout("%s supported subpages is bad SPF=%u SUBPG=%u\n",
|
||||||
|
logSenRspStr, !! (0x40 & gBuf[0]), gBuf[2]);
|
||||||
|
} else {
|
||||||
|
- resp_len_pg0_ff = sg_get_unaligned_be16(gBuf + 2);
|
||||||
|
got_subpages = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- } else {
|
||||||
|
- memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
||||||
|
- resp_len_pg0_0 = sup_lpgs[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (got_subpages) {
|
||||||
|
resp_len = sg_get_unaligned_be16(gBuf + 2);
|
||||||
|
- if (resp_len_pg0_ff <= resp_len_pg0_0) {
|
||||||
|
- /* something is rotten ....., ignore SUPP_SPAGE_L_SPAGE */
|
||||||
|
- resp_len = resp_len_pg0_0;
|
||||||
|
- bump = 1;
|
||||||
|
- up = sup_lpgs + LOGPAGEHDRSIZE;
|
||||||
|
- got_subpages = false;
|
||||||
|
- (void)got_subpages; // not yet used below, suppress warning
|
||||||
|
- } else {
|
||||||
|
- resp_len = resp_len_pg0_ff;
|
||||||
|
- bump = 2;
|
||||||
|
- up = gBuf + LOGPAGEHDRSIZE;
|
||||||
|
+ up = gBuf + LOGPAGEHDRSIZE;
|
||||||
|
+ for (k = 0; k < resp_len; k += 2) {
|
||||||
|
+ uint8_t page_code = 0x3f & up[k];
|
||||||
|
+ uint8_t subpage_code = up[k+1];
|
||||||
|
+ supp_lpg_and_spg[supp_lpg_and_spg_count++] = {page_code, subpage_code};
|
||||||
|
}
|
||||||
|
- } else {
|
||||||
|
- resp_len = resp_len_pg0_0;
|
||||||
|
- bump = 1;
|
||||||
|
- up = sup_lpgs + LOGPAGEHDRSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ num_unreported = 0;
|
||||||
|
num_unreported_spg = 0;
|
||||||
|
- for (num_unreported = 0, k = 0; k < resp_len; k += bump, up += bump) {
|
||||||
|
- uint8_t pg_num = 0x3f & up[0];
|
||||||
|
- uint8_t sub_pg_num = (0x40 & up[0]) ? up[1] : 0;
|
||||||
|
+ for (k = 0; k < supp_lpg_and_spg_count; k += 1) {
|
||||||
|
+ struct scsi_supp_log_pages supp_lpg = supp_lpg_and_spg[k];
|
||||||
|
|
||||||
|
- switch (pg_num)
|
||||||
|
+ switch (supp_lpg.page_code)
|
||||||
|
{
|
||||||
|
case SUPPORTED_LPAGES:
|
||||||
|
- if (! ((NO_SUBPAGE_L_SPAGE == sub_pg_num) ||
|
||||||
|
- (SUPP_SPAGE_L_SPAGE == sub_pg_num))) {
|
||||||
|
+ if (! ((NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code) ||
|
||||||
|
+ (SUPP_SPAGE_L_SPAGE == supp_lpg.subpage_code))) {
|
||||||
|
if (scsi_debugmode > 1)
|
||||||
|
pout("%s: Strange Log page number: 0x0,0x%x\n",
|
||||||
|
- __func__, sub_pg_num);
|
||||||
|
+ __func__, supp_lpg.subpage_code);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case READ_ERROR_COUNTER_LPAGE:
|
||||||
|
@@ -223,13 +227,13 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
gNonMediumELPage = true;
|
||||||
|
break;
|
||||||
|
case TEMPERATURE_LPAGE:
|
||||||
|
- if (NO_SUBPAGE_L_SPAGE == sub_pg_num)
|
||||||
|
+ if (NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gTempLPage = true;
|
||||||
|
- else if (ENVIRO_REP_L_SPAGE == sub_pg_num)
|
||||||
|
+ else if (ENVIRO_REP_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gEnviroReportingLPage = true;
|
||||||
|
- else if (ENVIRO_LIMITS_L_SPAGE == sub_pg_num)
|
||||||
|
+ else if (ENVIRO_LIMITS_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gEnviroLimitsLPage = true;
|
||||||
|
- else if (SUPP_SPAGE_L_SPAGE != sub_pg_num) {
|
||||||
|
+ else if (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code) {
|
||||||
|
++num_unreported;
|
||||||
|
++num_unreported_spg;
|
||||||
|
}
|
||||||
|
@@ -238,11 +242,11 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
reporting of <lpage>,0xff so it is not an error. */
|
||||||
|
break;
|
||||||
|
case STARTSTOP_CYCLE_COUNTER_LPAGE:
|
||||||
|
- if (NO_SUBPAGE_L_SPAGE == sub_pg_num)
|
||||||
|
+ if (NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gStartStopLPage = true;
|
||||||
|
- else if (UTILIZATION_L_SPAGE == sub_pg_num)
|
||||||
|
+ else if (UTILIZATION_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gUtilizationLPage = true;
|
||||||
|
- else if (SUPP_SPAGE_L_SPAGE != sub_pg_num) {
|
||||||
|
+ else if (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code) {
|
||||||
|
++num_unreported;
|
||||||
|
++num_unreported_spg;
|
||||||
|
}
|
||||||
|
@@ -254,15 +258,15 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
gSmartLPage = true;
|
||||||
|
break;
|
||||||
|
case BACKGROUND_RESULTS_LPAGE:
|
||||||
|
- if (NO_SUBPAGE_L_SPAGE == sub_pg_num)
|
||||||
|
+ if (NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gBackgroundResultsLPage = true;
|
||||||
|
- else if (PEND_DEFECTS_L_SPAGE == sub_pg_num)
|
||||||
|
+ else if (PEND_DEFECTS_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gPendDefectsLPage = true;
|
||||||
|
- else if (BACKGROUND_OP_L_SPAGE == sub_pg_num)
|
||||||
|
+ else if (BACKGROUND_OP_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gBackgroundOpLPage = true;
|
||||||
|
- else if (LPS_MISALIGN_L_SPAGE == sub_pg_num)
|
||||||
|
+ else if (LPS_MISALIGN_L_SPAGE == supp_lpg.subpage_code)
|
||||||
|
gLPSMisalignLPage = true;
|
||||||
|
- else if (SUPP_SPAGE_L_SPAGE != sub_pg_num) {
|
||||||
|
+ else if (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code) {
|
||||||
|
++num_unreported;
|
||||||
|
++num_unreported_spg;
|
||||||
|
}
|
||||||
|
@@ -296,9 +300,10 @@ scsiGetSupportedLogPages(scsi_device * device)
|
||||||
|
gSeagateFactoryLPage = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
- if (pg_num < 0x30) { /* don't count VS pages */
|
||||||
|
+ if (supp_lpg.page_code < 0x30) { /* don't count VS pages */
|
||||||
|
++num_unreported;
|
||||||
|
- if ((sub_pg_num > 0) && (SUPP_SPAGE_L_SPAGE != sub_pg_num))
|
||||||
|
+ if ((supp_lpg.subpage_code > 0) &&
|
||||||
|
+ (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code))
|
||||||
|
++num_unreported_spg;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
31
smartmontools-7.2-logsuppagefix4.patch
Normal file
31
smartmontools-7.2-logsuppagefix4.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
Index: trunk/smartmontools/scsiprint.cpp
|
||||||
|
===================================================================
|
||||||
|
--- smartmontools/scsiprint.cpp (revision 5076)
|
||||||
|
+++ smartmontools/scsiprint.cpp (revision 5090)
|
||||||
|
@@ -2340,6 +2340,6 @@
|
||||||
|
!wce ? "Disabled" : "Enabled");
|
||||||
|
}
|
||||||
|
- } else
|
||||||
|
any_output = true;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (options.drive_info)
|
||||||
|
@@ -2463,12 +2463,10 @@
|
||||||
|
if (gTempLPage)
|
||||||
|
scsiPrintTemp(device);
|
||||||
|
- }
|
||||||
|
- // in the 'smartctl -a" case only want: "Accumulated power on time"
|
||||||
|
- if ((! options.smart_background_log) && is_disk) {
|
||||||
|
- if (! checkedSupportedLogPages)
|
||||||
|
- scsiGetSupportedLogPages(device);
|
||||||
|
- res = 0;
|
||||||
|
- if (gBackgroundResultsLPage)
|
||||||
|
- res = scsiPrintBackgroundResults(device, true);
|
||||||
|
+ // in the 'smartctl -A' case only want: "Accumulated power on time"
|
||||||
|
+ if ((! options.smart_background_log) && is_disk) {
|
||||||
|
+ res = 0;
|
||||||
|
+ if (gBackgroundResultsLPage)
|
||||||
|
+ res = scsiPrintBackgroundResults(device, true);
|
||||||
|
+ }
|
||||||
|
any_output = true;
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
Summary: Tools for monitoring SMART capable hard disks
|
Summary: Tools for monitoring SMART capable hard disks
|
||||||
Name: smartmontools
|
Name: smartmontools
|
||||||
Version: 7.1
|
Version: 7.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
@ -15,6 +15,10 @@ Source5: drivedb.h
|
|||||||
|
|
||||||
#fedora/rhel specific
|
#fedora/rhel specific
|
||||||
Patch1: smartmontools-5.38-defaultconf.patch
|
Patch1: smartmontools-5.38-defaultconf.patch
|
||||||
|
Patch2: smartmontools-7.2-logsuppagefix1.patch
|
||||||
|
Patch3: smartmontools-7.2-logsuppagefix2.patch
|
||||||
|
Patch4: smartmontools-7.2-logsuppagefix3.patch
|
||||||
|
Patch5: smartmontools-7.2-logsuppagefix4.patch
|
||||||
|
|
||||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||||
#new rpm does not handle this (yet?)
|
#new rpm does not handle this (yet?)
|
||||||
@ -37,6 +41,10 @@ failure.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch1 -p1 -b .defaultconf
|
%patch1 -p1 -b .defaultconf
|
||||||
|
%patch2 -p2 -b .logsuppagefix1
|
||||||
|
%patch3 -p2 -b .logsuppagefix2
|
||||||
|
%patch4 -p2 -b .logsuppagefix3
|
||||||
|
%patch5 -p1 -b .logsuppagefix4
|
||||||
|
|
||||||
# update SOURCE5 on maintainer's machine prior commiting, there's no internet connection on builders
|
# update SOURCE5 on maintainer's machine prior commiting, there's no internet connection on builders
|
||||||
curl %{UrlSource5} -o %{SOURCE5} ||:
|
curl %{UrlSource5} -o %{SOURCE5} ||:
|
||||||
@ -108,6 +116,9 @@ fi
|
|||||||
%{_sharedstatedir}/%{name}
|
%{_sharedstatedir}/%{name}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 29 2023 Michal Hlavinka <mhlavink@redhat.com> - 1:7.1-2
|
||||||
|
- support reporting of Error Counter logging details (#2136439)
|
||||||
|
|
||||||
* Wed Apr 22 2020 Michal Hlavinka <mhlavink@redhat.com> - 1:7.1-1
|
* Wed Apr 22 2020 Michal Hlavinka <mhlavink@redhat.com> - 1:7.1-1
|
||||||
- smartmontools updated to 7.1 (#1671154)
|
- smartmontools updated to 7.1 (#1671154)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user