diff --git a/nvme.c b/nvme.c index 648d7daa71..082abffa8e 100644 --- a/nvme.c +++ b/nvme.c @@ -7673,10 +7673,12 @@ static int resv_acquire(int argc, char **argv, struct command *acmd, struct plug const char *prkey = "pre-empt reservation key"; const char *racqa = "reservation acquire action"; - _cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL; _cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL; - int err; + _cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL; + struct nvme_passthru_cmd cmd; nvme_print_flags_t flags; + __le64 payload[2]; + int err; struct config { __u32 namespace_id; @@ -7726,21 +7728,12 @@ static int resv_acquire(int argc, char **argv, struct command *acmd, struct plug return -EINVAL; } - struct nvme_resv_acquire_args args = { - .args_size = sizeof(args), - .nsid = cfg.namespace_id, - .rtype = cfg.rtype, - .racqa = cfg.racqa, - .iekey = !!cfg.iekey, - .crkey = cfg.crkey, - .nrkey = cfg.prkey, - .timeout = nvme_cfg.timeout, - .result = NULL, - }; - err = nvme_resv_acquire(hdl, &args); + nvme_init_resv_acquire(&cmd, cfg.namespace_id, cfg.racqa, !!cfg.iekey, + false, cfg.rtype, cfg.crkey, cfg.prkey, payload); + err = nvme_submit_admin_passthru(hdl, &cmd, NULL); if (err < 0) nvme_show_error("reservation acquire: %s", nvme_strerror(-err)); - else if (err != 0) + else if (err > 0) nvme_show_status(err); else printf("NVME Reservation Acquire success\n");