Skip to content

Commit 3551e45

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

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

nvme.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ static int get_effects_log(int argc, char **argv, struct command *acmd, struct p
10131013

10141014
_cleanup_nvme_global_ctx_ struct nvme_global_ctx *ctx = NULL;
10151015
_cleanup_nvme_transport_handle_ struct nvme_transport_handle *hdl = NULL;
1016+
struct nvme_passthru_cmd64 cmd;
10161017
struct list_head log_pages;
10171018
nvme_effects_log_node_t *node;
10181019

@@ -1069,13 +1070,8 @@ static int get_effects_log(int argc, char **argv, struct command *acmd, struct p
10691070
cap = mmio_read64(bar + NVME_REG_CAP);
10701071
munmap(bar, getpagesize());
10711072
} else {
1072-
struct nvme_get_property_args args = {
1073-
.args_size = sizeof(args),
1074-
.offset = NVME_REG_CAP,
1075-
.value = &cap,
1076-
.timeout = nvme_cfg.timeout,
1077-
};
1078-
err = nvme_get_property(hdl, &args);
1073+
nvme_init_get_property(&cmd, NVME_REG_CAP);
1074+
err = nvme_submit_admin_passthru64(hdl, &cmd, &cap);
10791075
if (err)
10801076
goto cleanup_list;
10811077
}
@@ -5546,15 +5542,11 @@ static int sanitize_cmd(int argc, char **argv, struct command *acmd, struct plug
55465542

55475543
static int nvme_get_single_property(struct nvme_transport_handle *hdl, struct get_reg_config *cfg, __u64 *value)
55485544
{
5545+
struct nvme_passthru_cmd64 cmd;
55495546
int err;
5550-
struct nvme_get_property_args args = {
5551-
.args_size = sizeof(args),
5552-
.offset = cfg->offset,
5553-
.value = value,
5554-
.timeout = nvme_cfg.timeout,
5555-
};
55565547

5557-
err = nvme_get_property(hdl, &args);
5548+
nvme_init_get_property(&cmd, cfg->offset);
5549+
err = nvme_submit_admin_passthru64(hdl, &cmd, value);
55585550
if (!err)
55595551
return 0;
55605552

@@ -5779,16 +5771,12 @@ static bool is_reg_selected(struct get_reg_config *cfg, int offset)
57795771

57805772
static int get_register_properties(struct nvme_transport_handle *hdl, void **pbar, struct get_reg_config *cfg)
57815773
{
5774+
struct nvme_passthru_cmd64 cmd;
57825775
int offset = NVME_REG_CRTO;
57835776
__u64 value;
57845777
int size;
57855778
int err;
57865779
void *bar;
5787-
struct nvme_get_property_args args = {
5788-
.args_size = sizeof(args),
5789-
.value = &value,
5790-
.timeout = nvme_cfg.timeout,
5791-
};
57925780

57935781
size = offset + get_reg_size(offset);
57945782
bar = malloc(size);
@@ -5800,8 +5788,8 @@ static int get_register_properties(struct nvme_transport_handle *hdl, void **pba
58005788
!nvme_is_fabrics_reg(offset))
58015789
continue;
58025790

5803-
args.offset = offset;
5804-
err = nvme_get_property(hdl, &args);
5791+
nvme_init_get_property(&cmd, offset);
5792+
err = nvme_submit_admin_passthru64(hdl, &cmd, &value);
58055793
if (nvme_status_equals(err, NVME_STATUS_TYPE_NVME, NVME_SC_INVALID_FIELD)) {
58065794
value = -1;
58075795
} else if (err) {

0 commit comments

Comments
 (0)