Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -7757,10 +7757,12 @@ static int resv_register(int argc, char **argv, struct command *acmd, struct plu
const char *rrega = "reservation registration action";
const char *cptpl = "change persistence through power loss setting";

_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;
Expand Down Expand Up @@ -7814,21 +7816,13 @@ static int resv_register(int argc, char **argv, struct command *acmd, struct plu
return -EINVAL;
}

struct nvme_resv_register_args args = {
.args_size = sizeof(args),
.nsid = cfg.namespace_id,
.rrega = cfg.rrega,
.cptpl = cfg.cptpl,
.iekey = !!cfg.iekey,
.crkey = cfg.crkey,
.nrkey = cfg.nrkey,
.timeout = nvme_cfg.timeout,
.result = NULL,
};
err = nvme_resv_register(hdl, &args);
nvme_init_resv_register(&cmd, cfg.namespace_id, cfg.rrega, !!cfg.iekey,
false, cfg.cptpl, cfg.crkey, cfg.nrkey,
payload);
err = nvme_submit_admin_passthru(hdl, &cmd, NULL);
if (err < 0)
nvme_show_error("reservation register: %s", nvme_strerror(-err));
else if (err != 0)
else if (err > 0)
nvme_show_status(err);
else
printf("NVME Reservation success\n");
Expand Down