Changeset View
Changeset View
Standalone View
Standalone View
sbin/nvmecontrol/modules/wdc/wdc.c
Show All 35 Lines | |||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "nvmecontrol.h" | #include "nvmecontrol.h" | ||||
#define WDC_USAGE \ | #define WDC_USAGE \ | ||||
"wdc (cap-diag)\n" | "wdc (cap-diag)\n" | ||||
#define WDC_ARGS \ | |||||
"subcommand" | |||||
#define WDC_DESCR \ | |||||
"Western Digital (WDC, HGST) specific commands" | |||||
NVME_CMD_DECLARE(wdc, struct nvme_function); | NVME_CMD_DECLARE(wdc, struct nvme_function); | ||||
#define WDC_NVME_TOC_SIZE 8 | #define WDC_NVME_TOC_SIZE 8 | ||||
#define WDC_NVME_CAP_DIAG_OPCODE 0xe6 | #define WDC_NVME_CAP_DIAG_OPCODE 0xe6 | ||||
#define WDC_NVME_CAP_DIAG_CMD 0x0000 | #define WDC_NVME_CAP_DIAG_CMD 0x0000 | ||||
static void wdc_cap_diag(const struct nvme_function *nf, int argc, char *argv[]); | static void wdc_cap_diag(const struct nvme_function *nf, int argc, char *argv[]); | ||||
#define WDC_CAP_DIAG_USAGE "wdc cap-diag [-o path-template]\n" | #define WDC_CAP_DIAG_USAGE "wdc cap-diag [-o path-template]\n" | ||||
#define WDC_CAP_ARGS "<controller-id>" | |||||
#define WDC_CAP_DESCR "Retrieve the drive's cap-diag logs" | |||||
NVME_COMMAND(wdc, cap-diag, wdc_cap_diag, WDC_CAP_DIAG_USAGE); | NVME_COMMAND(wdc, cap-diag, wdc_cap_diag, WDC_CAP_DIAG_USAGE, WDC_CAP_ARGS, WDC_CAP_DESCR); | ||||
static void | static void | ||||
wdc_append_serial_name(int fd, char *buf, size_t len, const char *suffix) | wdc_append_serial_name(int fd, char *buf, size_t len, const char *suffix) | ||||
{ | { | ||||
struct nvme_controller_data cdata; | struct nvme_controller_data cdata; | ||||
char sn[NVME_SERIAL_NUMBER_LENGTH + 1]; | char sn[NVME_SERIAL_NUMBER_LENGTH + 1]; | ||||
char *walker; | char *walker; | ||||
▲ Show 20 Lines • Show All 521 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
NVME_LOGPAGE(hgst_info, | NVME_LOGPAGE(hgst_info, | ||||
HGST_INFO_LOG, "hgst", "Detailed Health/SMART", | HGST_INFO_LOG, "hgst", "Detailed Health/SMART", | ||||
print_hgst_info_log, DEFAULT_SIZE); | print_hgst_info_log, DEFAULT_SIZE); | ||||
NVME_LOGPAGE(wdc_info, | NVME_LOGPAGE(wdc_info, | ||||
HGST_INFO_LOG, "wdc", "Detailed Health/SMART", | HGST_INFO_LOG, "wdc", "Detailed Health/SMART", | ||||
print_hgst_info_log, DEFAULT_SIZE); | print_hgst_info_log, DEFAULT_SIZE); | ||||
NVME_COMMAND(top, wdc, wdc, WDC_USAGE); | NVME_COMMAND(top, wdc, wdc, WDC_USAGE, WDC_ARGS, WDC_DESCR); |