Flag the vendor specific pages as such. This allows different decoding
for the same page number as different vendors encode vendor specific pages differently.
This commit is contained in:
parent
158c18ffb4
commit
5619c99fb3
@ -793,23 +793,23 @@ print_hgst_info_log(void *buf, uint32_t size __unused)
|
||||
*/
|
||||
static struct logpage_function {
|
||||
uint8_t log_page;
|
||||
const char *vendor;
|
||||
print_fn_t print_fn;
|
||||
size_t size;
|
||||
} logfuncs[] = {
|
||||
{NVME_LOG_ERROR, print_log_error,
|
||||
{NVME_LOG_ERROR, NULL, print_log_error,
|
||||
0},
|
||||
{NVME_LOG_HEALTH_INFORMATION, print_log_health,
|
||||
{NVME_LOG_HEALTH_INFORMATION, NULL, print_log_health,
|
||||
sizeof(struct nvme_health_information_page)},
|
||||
{NVME_LOG_FIRMWARE_SLOT, print_log_firmware,
|
||||
{NVME_LOG_FIRMWARE_SLOT, NULL, print_log_firmware,
|
||||
sizeof(struct nvme_firmware_page)},
|
||||
{INTEL_LOG_TEMP_STATS, print_intel_temp_stats,
|
||||
{INTEL_LOG_TEMP_STATS, "intel", print_intel_temp_stats,
|
||||
sizeof(struct intel_log_temp_stats)},
|
||||
{INTEL_LOG_ADD_SMART, print_intel_add_smart,
|
||||
{INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart,
|
||||
DEFAULT_SIZE},
|
||||
{HGST_INFO_LOG, print_hgst_info_log,
|
||||
{HGST_INFO_LOG, "hgst", print_hgst_info_log,
|
||||
DEFAULT_SIZE},
|
||||
{0, NULL,
|
||||
0},
|
||||
{0, NULL, NULL, 0},
|
||||
};
|
||||
|
||||
static void
|
||||
@ -830,11 +830,12 @@ logpage(int argc, char *argv[])
|
||||
char cname[64];
|
||||
uint32_t size;
|
||||
void *buf;
|
||||
const char *vendor = NULL;
|
||||
struct logpage_function *f;
|
||||
struct nvme_controller_data cdata;
|
||||
print_fn_t print_fn;
|
||||
|
||||
while ((ch = getopt(argc, argv, "p:x")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "p:xv:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'p':
|
||||
/* TODO: Add human-readable ASCII page IDs */
|
||||
@ -850,6 +851,9 @@ logpage(int argc, char *argv[])
|
||||
case 'x':
|
||||
hexflag = true;
|
||||
break;
|
||||
case 'v':
|
||||
vendor = optarg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -893,18 +897,21 @@ logpage(int argc, char *argv[])
|
||||
size = DEFAULT_SIZE;
|
||||
if (!hexflag) {
|
||||
/*
|
||||
* See if there is a pretty print function for the
|
||||
* specified log page. If one isn't found, we
|
||||
* just revert to the default (print_hex).
|
||||
* See if there is a pretty print function for the specified log
|
||||
* page. If one isn't found, we just revert to the default
|
||||
* (print_hex). If there was a vendor specified bt the user, and
|
||||
* the page is vendor specific, don't match the print function
|
||||
* unless the vendors match.
|
||||
*/
|
||||
f = logfuncs;
|
||||
while (f->log_page > 0) {
|
||||
if (log_page == f->log_page) {
|
||||
print_fn = f->print_fn;
|
||||
size = f->size;
|
||||
break;
|
||||
}
|
||||
f++;
|
||||
for (f = logfuncs; f->log_page > 0; f++) {
|
||||
if (f->vendor != NULL && vendor != NULL &&
|
||||
strcmp(f->vendor, vendor) != 0)
|
||||
continue;
|
||||
if (log_page != f->log_page)
|
||||
continue;
|
||||
print_fn = f->print_fn;
|
||||
size = f->size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user