Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/nvmecontrol/logpage.c
Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | NVME_LOGPAGE(health, | ||||
print_log_health, sizeof(struct nvme_health_information_page)); | print_log_health, sizeof(struct nvme_health_information_page)); | ||||
NVME_LOGPAGE(fw, | NVME_LOGPAGE(fw, | ||||
NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information", | NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information", | ||||
print_log_firmware, sizeof(struct nvme_firmware_page)); | print_log_firmware, sizeof(struct nvme_firmware_page)); | ||||
static void | static void | ||||
logpage_help(void) | logpage_help(void) | ||||
{ | { | ||||
struct logpage_function **f; | const struct logpage_function * const *f; | ||||
const char *v; | const char *v; | ||||
fprintf(stderr, "\n"); | fprintf(stderr, "\n"); | ||||
fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name"); | fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name"); | ||||
fprintf(stderr, "-------- ---------- ----------\n"); | fprintf(stderr, "-------- ---------- ----------\n"); | ||||
for (f = logpage_begin(); f < logpage_limit(); f++) { | for (f = logpage_begin(); f < logpage_limit(); f++) { | ||||
v = (*f)->vendor == NULL ? "-" : (*f)->vendor; | v = (*f)->vendor == NULL ? "-" : (*f)->vendor; | ||||
fprintf(stderr, "0x%02x %-10s %s\n", (*f)->log_page, v, (*f)->name); | fprintf(stderr, "0x%02x %-10s %s\n", (*f)->log_page, v, (*f)->name); | ||||
} | } | ||||
exit(1); | exit(1); | ||||
} | } | ||||
static void | static void | ||||
logpage(struct nvme_function *nf, int argc, char *argv[]) | logpage(const struct nvme_function *nf, int argc, char *argv[]) | ||||
{ | { | ||||
int fd; | int fd; | ||||
int log_page = 0, pageflag = false; | int log_page = 0, pageflag = false; | ||||
int binflag = false, hexflag = false, ns_specified; | int binflag = false, hexflag = false, ns_specified; | ||||
int opt; | int opt; | ||||
char *p; | char *p; | ||||
char cname[64]; | char cname[64]; | ||||
uint32_t nsid, size; | uint32_t nsid, size; | ||||
void *buf; | void *buf; | ||||
const char *vendor = NULL; | const char *vendor = NULL; | ||||
struct logpage_function **f; | const struct logpage_function * const *f; | ||||
struct nvme_controller_data cdata; | struct nvme_controller_data cdata; | ||||
print_fn_t print_fn; | print_fn_t print_fn; | ||||
uint8_t ns_smart; | uint8_t ns_smart; | ||||
while ((opt = getopt(argc, argv, "bp:xv:")) != -1) { | while ((opt = getopt(argc, argv, "bp:xv:")) != -1) { | ||||
switch (opt) { | switch (opt) { | ||||
case 'b': | case 'b': | ||||
binflag = true; | binflag = true; | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |