Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions libnvme/src/nvme/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static int nvme_submit_passthru64(struct nvme_transport_handle *hdl,
int nvme_submit_io_passthru(struct nvme_transport_handle *hdl,
struct nvme_passthru_cmd *cmd)
{
if (hdl->ioctl64)
if (hdl->ioctl_io64)
return nvme_submit_passthru64(hdl, NVME_IOCTL_IO64_CMD, cmd);
return nvme_submit_passthru32(hdl, NVME_IOCTL_IO_CMD, cmd);
}
Expand All @@ -188,7 +188,7 @@ int nvme_submit_admin_passthru(struct nvme_transport_handle *hdl,
{
switch (hdl->type) {
case NVME_TRANSPORT_HANDLE_TYPE_DIRECT:
if (hdl->ioctl64)
if (hdl->ioctl_admin64)
return nvme_submit_passthru64(hdl,
NVME_IOCTL_ADMIN64_CMD, cmd);
if (cmd->opcode == nvme_admin_fabrics)
Expand Down
10 changes: 7 additions & 3 deletions libnvme/src/nvme/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,12 @@ static int __nvme_transport_handle_open_direct(

if (hdl->ctx->ioctl_probing) {
ret = ioctl(hdl->fd, NVME_IOCTL_ADMIN64_CMD, &dummy);
if (ret > 0)
hdl->ioctl64 = true;
if (ret > 0) {
hdl->ioctl_admin64 = true;
ret = ioctl(hdl->fd, NVME_IOCTL_IO64_CMD, &dummy);
if (ret != -1 || errno != ENOTTY)
hdl->ioctl_io64 = true;
}
}

return 0;
Expand Down Expand Up @@ -211,7 +215,7 @@ int nvme_open(struct nvme_global_ctx *ctx, const char *name,
hdl->fd = 0xFD;

if (!strcmp(name, "NVME_TEST_FD64"))
hdl->ioctl64 = true;
hdl->ioctl_admin64 = true;

*hdlp = hdl;
return 0;
Expand Down
3 changes: 2 additions & 1 deletion libnvme/src/nvme/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ struct nvme_transport_handle {
/* direct */
int fd;
struct stat stat;
bool ioctl64;
bool ioctl_admin64;
bool ioctl_io64;

/* mi */
struct nvme_mi_ep *ep;
Expand Down