Skip to content

Commit f3e27bb

Browse files
kurz-migaw
authored andcommitted
src: rework nvme_resv_acquire command
libnvme changed the API for the nvme_resv_acquire command. Update the callsite accordingly. Signed-off-by: Markus Kurz <[email protected]>
1 parent 94a3ba3 commit f3e27bb

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

nvme.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7652,10 +7652,12 @@ static int resv_acquire(int argc, char **argv, struct command *acmd, struct plug
76527652
const char *prkey = "pre-empt reservation key";
76537653
const char *racqa = "reservation acquire action";
76547654

7655-
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
76567655
_cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL;
7657-
int err;
7656+
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
7657+
struct nvme_passthru_cmd cmd;
76587658
nvme_print_flags_t flags;
7659+
__le64 payload[2];
7660+
int err;
76597661

76607662
struct config {
76617663
__u32 namespace_id;
@@ -7705,21 +7707,12 @@ static int resv_acquire(int argc, char **argv, struct command *acmd, struct plug
77057707
return -EINVAL;
77067708
}
77077709

7708-
struct nvme_resv_acquire_args args = {
7709-
.args_size = sizeof(args),
7710-
.nsid = cfg.namespace_id,
7711-
.rtype = cfg.rtype,
7712-
.racqa = cfg.racqa,
7713-
.iekey = !!cfg.iekey,
7714-
.crkey = cfg.crkey,
7715-
.nrkey = cfg.prkey,
7716-
.timeout = nvme_cfg.timeout,
7717-
.result = NULL,
7718-
};
7719-
err = nvme_resv_acquire(hdl, &args);
7710+
nvme_init_resv_acquire(&cmd, cfg.namespace_id, cfg.racqa, cfg.iekey,
7711+
false, cfg.rtype, cfg.crkey, cfg.prkey, payload);
7712+
err = nvme_submit_admin_passthru(hdl, &cmd, NULL);
77207713
if (err < 0)
77217714
nvme_show_error("reservation acquire: %s", nvme_strerror(-err));
7722-
else if (err != 0)
7715+
else if (err > 0)
77237716
nvme_show_status(err);
77247717
else
77257718
printf("NVME Reservation Acquire success\n");

0 commit comments

Comments
 (0)