Skip to content

Commit 7308234

Browse files
committed
nvme: move non-nvme_init_* helper functions to nvme-cli
These helper functions wrap nvme_init_* and nvme_submit_*, which makes it hard to keep the API stable. Move them to nvme-cli, where they are used extensively. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 87e352d commit 7308234

40 files changed

Lines changed: 1820 additions & 1746 deletions

libnvme/src/nvme/cmds.h

Lines changed: 8 additions & 1690 deletions
Large diffs are not rendered by default.

libnvme/src/nvme/tree.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2294,13 +2294,15 @@ int nvme_ns_compare(nvme_ns_t n, void *buf, off_t offset, size_t count)
22942294
int nvme_ns_flush(nvme_ns_t n)
22952295
{
22962296
struct nvme_transport_handle *hdl;
2297+
struct nvme_passthru_cmd cmd;
22972298
int err;
22982299

22992300
err = nvme_ns_get_transport_handle(n, &hdl);
23002301
if (err)
23012302
return err;
23022303

2303-
return nvme_flush(hdl, nvme_ns_get_nsid(n));
2304+
nvme_init_flush(&cmd, nvme_ns_get_nsid(n));
2305+
return nvme_submit_io_passthru(hdl, &cmd);
23042306
}
23052307

23062308
static int nvme_strtou64(const char *str, void *res)

libnvme/test/ioctl/misc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,11 +742,12 @@ static void test_flush(void)
742742
.opcode = nvme_cmd_flush,
743743
.nsid = TEST_NSID,
744744
};
745-
745+
struct nvme_passthru_cmd cmd;
746746
int err;
747747

748748
set_mock_io_cmds(&mock_io_cmd, 1);
749-
err = nvme_flush(test_hdl, TEST_NSID);
749+
nvme_init_flush(&cmd, TEST_NSID);
750+
err = nvme_submit_io_passthru(test_hdl, &cmd);
750751
end_mock_cmds();
751752
check(err == 0, "returned error %d", err);
752753
}

0 commit comments

Comments
 (0)