summaryrefslogtreecommitdiffstats
path: root/plugins/toshiba
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-14 18:27:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-16 15:11:56 +0000
commit6197903bd42478987516bc4cc3f0769488a37065 (patch)
tree508d399340039960289dd1d96696db7c56c22321 /plugins/toshiba
parentAdding upstream version 1.16. (diff)
downloadnvme-cli-6197903bd42478987516bc4cc3f0769488a37065.tar.xz
nvme-cli-6197903bd42478987516bc4cc3f0769488a37065.zip
Adding upstream version 2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/toshiba')
-rw-r--r--plugins/toshiba/toshiba-nvme.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/plugins/toshiba/toshiba-nvme.c b/plugins/toshiba/toshiba-nvme.c
index cba1af8..fd2e9c1 100644
--- a/plugins/toshiba/toshiba-nvme.c
+++ b/plugins/toshiba/toshiba-nvme.c
@@ -7,13 +7,11 @@
#include <inttypes.h>
#include <stdbool.h>
-#include "linux/nvme_ioctl.h"
#include "nvme.h"
-#include "nvme-print.h"
-#include "nvme-ioctl.h"
+#include "libnvme.h"
#include "plugin.h"
-#include "argconfig.h"
-#include "suffix.h"
+#include "linux/types.h"
+#include "nvme-print.h"
#define CREATE_CMD
#include "toshiba-nvme.h"
@@ -67,7 +65,7 @@ static int nvme_sct_op(int fd, __u32 opcode, __u32 cdw10, __u32 cdw11, void* da
int err = 0;
__u32 result;
- err = nvme_passthru(fd, NVME_IOCTL_ADMIN_CMD, opcode, flags, rsvd,
+ err = nvme_admin_passthru(fd, opcode, flags, rsvd,
namespace_id, cdw2, cdw3, cdw10,
cdw11, cdw12, cdw13, cdw14, cdw15,
data_len, data, metadata_len, metadata,
@@ -392,8 +390,7 @@ static int nvme_get_vendor_log(int fd, __u32 namespace_id, int log_page,
if (err) {
goto end;
}
- err = nvme_get_log(fd, namespace_id, log_page, false,
- NVME_NO_LOG_LSP, log_len, log);
+ err = nvme_get_nsid_log(fd, false, log_page, namespace_id, log_len, log);
if (err) {
fprintf(stderr, "%s: couldn't get log 0x%x\n", __func__,
log_page);
@@ -476,7 +473,7 @@ static int vendor_log(int argc, char **argv, struct command *cmd, struct plugin
fprintf(stderr, "%s: couldn't get vendor log 0x%x\n", __func__, cfg.log);
end:
if (err > 0)
- fprintf(stderr, "%s: NVMe Status:%s(%x)\n", __func__, nvme_status_to_string(err), err);
+ nvme_show_status(err);
return err;
}
@@ -518,8 +515,8 @@ static int internal_log(int argc, char **argv, struct command *cmd, struct plugi
if (err < 0)
fprintf(stderr, "%s: couldn't get fw log \n", __func__);
if (err > 0)
- fprintf(stderr, "%s: NVMe Status:%s(%x)\n", __func__,
- nvme_status_to_string(err), err);
+ nvme_show_status(err);
+
return err;
}
@@ -550,14 +547,27 @@ static int clear_correctable_errors(int argc, char **argv, struct command *cmd,
if (err)
goto end;
- err = nvme_set_feature(fd, namespace_id, feature_id, value, cdw12, save,
- 0, 0, NULL, &result);
+ struct nvme_set_features_args args = {
+ .args_size = sizeof(args),
+ .fd = fd,
+ .fid = feature_id,
+ .nsid = namespace_id,
+ .cdw11 = value,
+ .cdw12 = cdw12,
+ .save = save,
+ .uuidx = 0,
+ .cdw15 = 0,
+ .data_len = 0,
+ .data = NULL,
+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
+ .result = &result,
+ };
+ err = nvme_set_features(&args);
if (err)
fprintf(stderr, "%s: couldn't clear PCIe correctable errors \n",
__func__);
end:
if (err > 0)
- fprintf(stderr, "%s: NVMe Status:%s(%x)\n", __func__,
- nvme_status_to_string(err), err);
+ nvme_show_status(err);
return err;
}