1
0
Fork 0

Adding upstream version 2.2.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:17:56 +01:00
parent 28d4a2895d
commit 8dc527e3df
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
446 changed files with 8369 additions and 4059 deletions

View file

@ -21,8 +21,8 @@ static void get_ymtc_smart_info(struct nvme_ymtc_smart_log *smart, int index, u8
memcpy(raw_val, smart->itemArr[index].rawVal, RAW_SIZE);
}
static int show_ymtc_smart_log(int fd, __u32 nsid, const char *devname,
struct nvme_ymtc_smart_log *smart)
static int show_ymtc_smart_log(struct nvme_dev *dev, __u32 nsid,
struct nvme_ymtc_smart_log *smart)
{
struct nvme_id_ctrl ctrl;
char fw_ver[10];
@ -40,7 +40,7 @@ static int show_ymtc_smart_log(int fd, __u32 nsid, const char *devname,
free(nm);
return -1;
}
err = nvme_identify_ctrl(fd, &ctrl);
err = nvme_identify_ctrl(dev_fd(dev), &ctrl);
if (err) {
free(nm);
free(raw);
@ -52,7 +52,8 @@ static int show_ymtc_smart_log(int fd, __u32 nsid, const char *devname,
ctrl.fr[4], ctrl.fr[5], ctrl.fr[6]);
/* Table Title */
printf("Additional Smart Log for NVME device:%s namespace-id:%x\n", devname, nsid);
printf("Additional Smart Log for NVME device:%s namespace-id:%x\n",
dev->name, nsid);
/* Clumn Name*/
printf("key normalized raw\n");
/* 00 SI_VD_PROGRAM_FAIL */
@ -119,15 +120,16 @@ static int show_ymtc_smart_log(int fd, __u32 nsid, const char *devname,
static int get_additional_smart_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)
{
struct nvme_ymtc_smart_log smart_log;
int err, fd;
char *desc = "Get Ymtc vendor specific additional smart log (optionally, "\
"for the specified namespace), and show it.";
const char *namespace = "(optional) desired namespace";
const char *raw = "dump output in binary format";
struct nvme_dev *dev;
struct config {
__u32 namespace_id;
bool raw_binary;
};
int err;
struct config cfg = {
.namespace_id = NVME_NSID_ALL,
@ -139,21 +141,21 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
OPT_END()
};
fd = parse_and_open(argc, argv, desc, opts);
if (fd < 0)
return fd;
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
err = nvme_get_nsid_log(fd, false, 0xca, cfg.namespace_id,
err = nvme_get_nsid_log(dev_fd(dev), false, 0xca, cfg.namespace_id,
sizeof(smart_log), &smart_log);
if (!err) {
if (!cfg.raw_binary)
err = show_ymtc_smart_log(fd, cfg.namespace_id, devicename, &smart_log);
err = show_ymtc_smart_log(dev, cfg.namespace_id, &smart_log);
else
d_raw((unsigned char *)&smart_log, sizeof(smart_log));
}
if (err > 0)
nvme_show_status(err);
close(fd);
dev_close(dev);
return err;
}