Skip to content

Commit 64a5691

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

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

nvme.c

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7729,10 +7729,12 @@ static int resv_register(int argc, char **argv, struct command *acmd, struct plu
77297729
const char *rrega = "reservation registration action";
77307730
const char *cptpl = "change persistence through power loss setting";
77317731

7732-
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
77337732
_cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL;
7734-
int err;
7733+
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
7734+
struct nvme_passthru_cmd cmd;
77357735
nvme_print_flags_t flags;
7736+
__le64 payload[2];
7737+
int err;
77367738

77377739
struct config {
77387740
__u32 namespace_id;
@@ -7786,21 +7788,13 @@ static int resv_register(int argc, char **argv, struct command *acmd, struct plu
77867788
return -EINVAL;
77877789
}
77887790

7789-
struct nvme_resv_register_args args = {
7790-
.args_size = sizeof(args),
7791-
.nsid = cfg.namespace_id,
7792-
.rrega = cfg.rrega,
7793-
.cptpl = cfg.cptpl,
7794-
.iekey = !!cfg.iekey,
7795-
.crkey = cfg.crkey,
7796-
.nrkey = cfg.nrkey,
7797-
.timeout = nvme_cfg.timeout,
7798-
.result = NULL,
7799-
};
7800-
err = nvme_resv_register(hdl, &args);
7791+
nvme_init_resv_register(&cmd, cfg.namespace_id, cfg.rrega, cfg.iekey,
7792+
false, cfg.cptpl, cfg.crkey, cfg.nrkey,
7793+
payload);
7794+
err = nvme_submit_admin_passthru(hdl, &cmd, NULL);
78017795
if (err < 0)
78027796
nvme_show_error("reservation register: %s", nvme_strerror(-err));
7803-
else if (err != 0)
7797+
else if (err > 0)
78047798
nvme_show_status(err);
78057799
else
78067800
printf("NVME Reservation success\n");

0 commit comments

Comments
 (0)