Skip to content

Commit 59fc85f

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

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

plugins/lm/lm-nvme.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,16 @@ static int lm_migration_recv(int argc, char **argv, struct command *acmd, struct
412412
const char *output = "Controller State Data output file";
413413
const char *human_readable_info = "show info in readable format";
414414

415-
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
416415
_cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL;
417-
_cleanup_file_ FILE *fd = NULL;
416+
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
418417
_cleanup_huge_ struct nvme_mem_huge mh = { 0, };
418+
_cleanup_file_ FILE *fd = NULL;
419+
struct nvme_passthru_cmd cmd;
419420
nvme_print_flags_t flags;
420421
void *data = NULL;
422+
__u32 result = 0;
421423
int err = -1;
424+
__u16 mos;
422425

423426
struct config {
424427
__u8 sel;
@@ -490,21 +493,11 @@ static int lm_migration_recv(int argc, char **argv, struct command *acmd, struct
490493
if (!data)
491494
return -ENOMEM;
492495

493-
__u32 result = 0;
494-
struct nvme_lm_migration_recv_args args = {
495-
.args_size = sizeof(args),
496-
.sel = cfg.sel,
497-
.mos = NVME_SET(cfg.csvi, LM_GET_CONTROLLER_STATE_CSVI),
498-
.uidx = cfg.uidx,
499-
.csuuidi = cfg.csuuidi,
500-
.offset = cfg.offset,
501-
.cntlid = cfg.cntlid,
502-
.numd = cfg.numd,
503-
.data = data,
504-
.result = &result,
505-
};
506-
507-
err = nvme_lm_migration_recv(hdl, &args);
496+
mos = NVME_SET(cfg.csvi, LM_GET_CONTROLLER_STATE_CSVI);
497+
nvme_init_lm_migration_recv(&cmd, cfg.offset, mos, cfg.cntlid,
498+
cfg.csuuidi, cfg.sel, cfg.uidx, 0, data,
499+
(cfg.numd + 1) << 2);
500+
err = nvme_submit_admin_passthru(hdl, &cmd, &result);
508501
if (err < 0)
509502
nvme_show_error("ERROR: nvme_lm_migration_recv() failed %s", strerror(errno));
510503
else if (err)

0 commit comments

Comments
 (0)