Make nvmecontrol logpage -p help list known pages.
Make -p help and -v help list all the pages we know about. Add -v to usage. Update the man page. Sponsored by: Netflix
This commit is contained in:
parent
e71bab696f
commit
d8fab838af
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=314230
@ -369,7 +369,7 @@ print_intel_write_lat_log(void *buf, uint32_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Table 19. 5.4 SMART Attributes
|
* Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra data not documented.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_intel_add_smart(void *buf, uint32_t size __unused)
|
print_intel_add_smart(void *buf, uint32_t size __unused)
|
||||||
@ -835,34 +835,39 @@ print_hgst_info_log(void *buf, uint32_t size __unused)
|
|||||||
/*
|
/*
|
||||||
* Table of log page printer / sizing.
|
* Table of log page printer / sizing.
|
||||||
*
|
*
|
||||||
* This includes Intel specific pages that are widely implemented. Not
|
* This includes Intel specific pages that are widely implemented.
|
||||||
* sure how best to switch between different vendors.
|
* Make sure you keep all the pages of one vendor together so -v help
|
||||||
|
* lists all the vendors pages.
|
||||||
*/
|
*/
|
||||||
static struct logpage_function {
|
static struct logpage_function {
|
||||||
uint8_t log_page;
|
uint8_t log_page;
|
||||||
const char *vendor;
|
const char *vendor;
|
||||||
|
const char *name;
|
||||||
print_fn_t print_fn;
|
print_fn_t print_fn;
|
||||||
size_t size;
|
size_t size;
|
||||||
} logfuncs[] = {
|
} logfuncs[] = {
|
||||||
{NVME_LOG_ERROR, NULL, print_log_error,
|
{NVME_LOG_ERROR, NULL, "Drive Error Log",
|
||||||
0},
|
print_log_error, 0},
|
||||||
{NVME_LOG_HEALTH_INFORMATION, NULL, print_log_health,
|
{NVME_LOG_HEALTH_INFORMATION, NULL, "Health/SMART Data",
|
||||||
sizeof(struct nvme_health_information_page)},
|
print_log_health, sizeof(struct nvme_health_information_page)},
|
||||||
{NVME_LOG_FIRMWARE_SLOT, NULL, print_log_firmware,
|
{NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information",
|
||||||
sizeof(struct nvme_firmware_page)},
|
print_log_firmware, sizeof(struct nvme_firmware_page)},
|
||||||
{HGST_INFO_LOG, "hgst", print_hgst_info_log,
|
{HGST_INFO_LOG, "hgst", "Detailed Health/SMART",
|
||||||
DEFAULT_SIZE},
|
print_hgst_info_log, DEFAULT_SIZE},
|
||||||
{HGST_INFO_LOG, "wdc", print_hgst_info_log,
|
{HGST_INFO_LOG, "wds", "Detailed Health/SMART",
|
||||||
DEFAULT_SIZE},
|
print_hgst_info_log, DEFAULT_SIZE},
|
||||||
{INTEL_LOG_TEMP_STATS, "intel", print_intel_temp_stats,
|
{INTEL_LOG_TEMP_STATS, "intel", "Temperature Stats",
|
||||||
sizeof(struct intel_log_temp_stats)},
|
print_intel_temp_stats, sizeof(struct intel_log_temp_stats)},
|
||||||
{INTEL_LOG_READ_LAT_LOG, "intel", print_intel_read_lat_log,
|
{INTEL_LOG_READ_LAT_LOG, "intel", "Read Latencies",
|
||||||
DEFAULT_SIZE},
|
print_intel_read_lat_log, DEFAULT_SIZE},
|
||||||
{INTEL_LOG_WRITE_LAT_LOG, "intel", print_intel_write_lat_log,
|
{INTEL_LOG_WRITE_LAT_LOG, "intel", "Write Latencies",
|
||||||
DEFAULT_SIZE},
|
print_intel_write_lat_log, DEFAULT_SIZE},
|
||||||
{INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart,
|
{INTEL_LOG_ADD_SMART, "intel", "Extra Health/SMART Data",
|
||||||
DEFAULT_SIZE},
|
print_intel_add_smart, DEFAULT_SIZE},
|
||||||
{0, NULL, NULL, 0},
|
{INTEL_LOG_ADD_SMART, "samsung", "Extra Health/SMART Data",
|
||||||
|
print_intel_add_smart, DEFAULT_SIZE},
|
||||||
|
|
||||||
|
{0, NULL, NULL, NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -873,6 +878,23 @@ logpage_usage(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
logpage_help(void)
|
||||||
|
{
|
||||||
|
struct logpage_function *f;
|
||||||
|
const char *v;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name");
|
||||||
|
fprintf(stderr, "-------- ---------- ----------\n");
|
||||||
|
for (f = logfuncs; f->log_page > 0; f++) {
|
||||||
|
v = f->vendor == NULL ? "-" : f->vendor;
|
||||||
|
fprintf(stderr, "0x%02x %-10s %s\n", f->log_page, v, f->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
logpage(int argc, char *argv[])
|
logpage(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -894,6 +916,9 @@ logpage(int argc, char *argv[])
|
|||||||
binflag = true;
|
binflag = true;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
|
if (strcmp(optarg, "help") == 0)
|
||||||
|
logpage_help();
|
||||||
|
|
||||||
/* TODO: Add human-readable ASCII page IDs */
|
/* TODO: Add human-readable ASCII page IDs */
|
||||||
log_page = strtol(optarg, &p, 0);
|
log_page = strtol(optarg, &p, 0);
|
||||||
if (p != NULL && *p != '\0') {
|
if (p != NULL && *p != '\0') {
|
||||||
@ -908,6 +933,8 @@ logpage(int argc, char *argv[])
|
|||||||
hexflag = true;
|
hexflag = true;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
|
if (strcmp(optarg, "help") == 0)
|
||||||
|
logpage_help();
|
||||||
vendor = optarg;
|
vendor = optarg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd February 4, 2017
|
.Dd February 24, 2017
|
||||||
.Dt NVMECONTROL 8
|
.Dt NVMECONTROL 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -108,6 +108,15 @@ Page 0xc1 is read latency stats for intel.
|
|||||||
Page 0xc2 is write latency stats for intel.
|
Page 0xc2 is write latency stats for intel.
|
||||||
Page 0xc5 is temperature stats for intel.
|
Page 0xc5 is temperature stats for intel.
|
||||||
Page 0xca is advanced smart information for intel.
|
Page 0xca is advanced smart information for intel.
|
||||||
|
.Pp
|
||||||
|
Specifying
|
||||||
|
.Fl p
|
||||||
|
.Ic help
|
||||||
|
will list all valid vendors and pages.
|
||||||
|
.Fl x
|
||||||
|
will print the page as hex.
|
||||||
|
.Fl b
|
||||||
|
will print the binary data for the page.
|
||||||
.Ss wdc
|
.Ss wdc
|
||||||
The various wdc command retrieve log data from the wdc/hgst drives.
|
The various wdc command retrieve log data from the wdc/hgst drives.
|
||||||
The
|
The
|
||||||
|
@ -58,7 +58,7 @@ struct nvme_function {
|
|||||||
" nvmecontrol reset <controller id>\n"
|
" nvmecontrol reset <controller id>\n"
|
||||||
|
|
||||||
#define LOGPAGE_USAGE \
|
#define LOGPAGE_USAGE \
|
||||||
" nvmecontrol logpage <-p page_id> [-x] <controller id|namespace id>\n" \
|
" nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] <controller id|namespace id>\n" \
|
||||||
|
|
||||||
#define FIRMWARE_USAGE \
|
#define FIRMWARE_USAGE \
|
||||||
" nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] <controller id>\n"
|
" nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] <controller id>\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user