1
0
Fork 0

Merging upstream version 2.2.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:18:36 +01:00
parent c6eb8bc90e
commit 965e6654c3
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
446 changed files with 8369 additions and 4059 deletions

View file

@ -10,8 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <endian.h>
#include "common.h"
#include "nvme.h"
@ -201,7 +199,8 @@ int solidigm_get_additional_smart_log(int argc, char **argv, struct command *cmd
const int solidigm_vu_smart_log_id = 0xCA;
vu_smart_log_t smart_log_payload;
enum nvme_print_flags flags;
int fd, err;
struct nvme_dev *dev;
int err;
struct config {
__u32 namespace_id;
@ -219,32 +218,36 @@ int solidigm_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;
flags = validate_output_format(cfg.output_format);
if (flags == -EINVAL) {
fprintf(stderr, "Invalid output format '%s'\n", cfg.output_format);
close(fd);
dev_close(dev);
return flags;
}
err = nvme_get_log_simple(fd, solidigm_vu_smart_log_id, sizeof(smart_log_payload), &smart_log_payload);
err = nvme_get_log_simple(dev_fd(dev), solidigm_vu_smart_log_id,
sizeof(smart_log_payload), &smart_log_payload);
if (!err) {
if (flags & JSON) {
vu_smart_log_show_json(&smart_log_payload, cfg.namespace_id, devicename);
vu_smart_log_show_json(&smart_log_payload,
cfg.namespace_id, dev->name);
} else if (flags & BINARY) {
d_raw((unsigned char *)&smart_log_payload, sizeof(smart_log_payload));
} else {
vu_smart_log_show(&smart_log_payload, cfg.namespace_id, devicename);
vu_smart_log_show(&smart_log_payload, cfg.namespace_id,
dev->name);
}
} else if (err > 0) {
nvme_show_status(err);
}
close(fd);
/* Redundant close() to make static code analysis happy */
close(dev->direct.fd);
dev_close(dev);
return err;
}