Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/nvmecontrol/wdc.c
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
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(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" | ||||
NVME_COMMAND(wdc, cap-diag, wdc_cap_diag, WDC_CAP_DIAG_USAGE); | NVME_COMMAND(wdc, cap-diag, wdc_cap_diag, WDC_CAP_DIAG_USAGE); | ||||
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) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | do { | ||||
offset += resid; | offset += resid; | ||||
len -= resid; | len -= resid; | ||||
} while (len > 0); | } while (len > 0); | ||||
free(buf); | free(buf); | ||||
close(fd2); | close(fd2); | ||||
} | } | ||||
static void | static void | ||||
wdc_cap_diag(struct nvme_function *nf, int argc, char *argv[]) | wdc_cap_diag(const struct nvme_function *nf, int argc, char *argv[]) | ||||
{ | { | ||||
char path_tmpl[MAXPATHLEN]; | char path_tmpl[MAXPATHLEN]; | ||||
int ch, fd; | int ch, fd; | ||||
path_tmpl[0] = '\0'; | path_tmpl[0] = '\0'; | ||||
while ((ch = getopt(argc, argv, "o:")) != -1) { | while ((ch = getopt(argc, argv, "o:")) != -1) { | ||||
switch ((char)ch) { | switch ((char)ch) { | ||||
case 'o': | case 'o': | ||||
Show All 12 Lines | wdc_do_dump(fd, path_tmpl, "cap_diag", WDC_NVME_CAP_DIAG_OPCODE, | ||||
WDC_NVME_CAP_DIAG_CMD, 4); | WDC_NVME_CAP_DIAG_CMD, 4); | ||||
close(fd); | close(fd); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
static void | static void | ||||
wdc(struct nvme_function *nf __unused, int argc, char *argv[]) | wdc(const struct nvme_function *nf __unused, int argc, char *argv[]) | ||||
{ | { | ||||
DISPATCH(argc, argv, wdc); | DISPATCH(argc, argv, wdc); | ||||
} | } | ||||
/* | /* | ||||
* HGST's 0xc1 page. This is a grab bag of additional data. Please see | * HGST's 0xc1 page. This is a grab bag of additional data. Please see | ||||
* https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf | * https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf | ||||
▲ Show 20 Lines • Show All 403 Lines • Show Last 20 Lines |