diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-03 07:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-03 07:59:35 +0000 |
commit | f42531334c05b7f49ae43c0a27e347a487fb2667 (patch) | |
tree | e7a40dd5265005869a4e85eb1e96fdc588b42ef0 /plugins/ocp/ocp-clear-fw-update-history.c | |
parent | Adding upstream version 2.3. (diff) | |
download | nvme-cli-42a7195111b7d5d9a18f377802940eacac91d680.tar.xz nvme-cli-42a7195111b7d5d9a18f377802940eacac91d680.zip |
Adding upstream version 2.4.upstream/2.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/ocp/ocp-clear-fw-update-history.c')
-rw-r--r-- | plugins/ocp/ocp-clear-fw-update-history.c | 56 |
1 files changed, 2 insertions, 54 deletions
diff --git a/plugins/ocp/ocp-clear-fw-update-history.c b/plugins/ocp/ocp-clear-fw-update-history.c index fef09cf..b9235b8 100644 --- a/plugins/ocp/ocp-clear-fw-update-history.c +++ b/plugins/ocp/ocp-clear-fw-update-history.c @@ -15,59 +15,7 @@ static const __u8 OCP_FID_CLEAR_FW_ACTIVATION_HISTORY = 0xC1; int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "OCP Clear Firmware Update History"; - __u32 result = 0; - __u32 clear_fw_history = 1 << 31; - struct nvme_dev *dev; - int uuid_index = 0; - bool no_uuid = false; - int err; - OPT_ARGS(opts) = { - OPT_FLAG("no-uuid", 'n', &no_uuid, - "Skip UUID index search (UUID index not required for OCP 1.0)"), - OPT_END() - }; - - err = parse_and_open(&dev, argc, argv, desc, opts); - if (err) - return err; - if (no_uuid == false) { - // OCP 2.0 requires UUID index support - err = ocp_get_uuid_index(dev, &uuid_index); - if (err || uuid_index == 0) { - fprintf(stderr, "ERROR: No OCP UUID index found\n"); - goto close_dev; - } - } - - struct nvme_set_features_args args = { - .result = &result, - .data = NULL, - .args_size = sizeof(args), - .fd = dev_fd(dev), - .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .nsid = 0, - .cdw11 = clear_fw_history, - .cdw12 = 0, - .cdw13 = 0, - .cdw15 = 0, - .data_len = 0, - .save = 0, - .uuidx = uuid_index, - .fid = OCP_FID_CLEAR_FW_ACTIVATION_HISTORY, - }; - - err = nvme_set_features(&args); - - if (err == 0) - printf("Success : %s\n", desc); - else if (err > 0) - nvme_show_status(err); - else - printf("Fail : %s\n", desc); -close_dev: - /* Redundant close() to make static code analysis happy */ - close(dev->direct.fd); - dev_close(dev); - return err; + return ocp_clear_feature(argc, argv, desc, + OCP_FID_CLEAR_FW_ACTIVATION_HISTORY); } |