nvmf/vfio-user: clarify endpoint fd meaning

Rename endpoint->fd to ->devmem_fd to better reflect its purpose.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: Ic73cb6684228d4ecb3d58c1865c80a3d7d07c223
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9402
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
John Levon 2021-08-12 14:20:10 +00:00 committed by Tomasz Zawadzki
parent b05d4a7d19
commit 89c4d059b7

View File

@ -183,7 +183,7 @@ struct nvmf_vfio_user_endpoint {
vfu_ctx_t *vfu_ctx; vfu_ctx_t *vfu_ctx;
struct msixcap *msix; struct msixcap *msix;
vfu_pci_config_space_t *pci_config_space; vfu_pci_config_space_t *pci_config_space;
int fd; int devmem_fd;
volatile uint32_t *doorbells; volatile uint32_t *doorbells;
struct spdk_nvme_transport_id trid; struct spdk_nvme_transport_id trid;
@ -499,8 +499,8 @@ nvmf_vfio_user_destroy_endpoint(struct nvmf_vfio_user_endpoint *endpoint)
munmap((void *)endpoint->doorbells, NVMF_VFIO_USER_DOORBELLS_SIZE); munmap((void *)endpoint->doorbells, NVMF_VFIO_USER_DOORBELLS_SIZE);
} }
if (endpoint->fd > 0) { if (endpoint->devmem_fd > 0) {
close(endpoint->fd); close(endpoint->devmem_fd);
} }
vfu_destroy_ctx(endpoint->vfu_ctx); vfu_destroy_ctx(endpoint->vfu_ctx);
@ -1875,7 +1875,7 @@ vfio_user_dev_info_fill(struct nvmf_vfio_user_transport *vu_transport,
} else { } else {
ret = vfu_setup_region(vfu_ctx, VFU_PCI_DEV_BAR0_REGION_IDX, NVME_REG_BAR0_SIZE, ret = vfu_setup_region(vfu_ctx, VFU_PCI_DEV_BAR0_REGION_IDX, NVME_REG_BAR0_SIZE,
access_bar0_fn, VFU_REGION_FLAG_RW | VFU_REGION_FLAG_MEM, access_bar0_fn, VFU_REGION_FLAG_RW | VFU_REGION_FLAG_MEM,
sparse_mmap, 1, endpoint->fd, 0); sparse_mmap, 1, endpoint->devmem_fd, 0);
} }
if (ret < 0) { if (ret < 0) {
@ -2022,7 +2022,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport,
return -ENOMEM; return -ENOMEM;
} }
endpoint->fd = -1; endpoint->devmem_fd = -1;
memcpy(&endpoint->trid, trid, sizeof(endpoint->trid)); memcpy(&endpoint->trid, trid, sizeof(endpoint->trid));
err = asprintf(&path, "%s/bar0", endpoint_id(endpoint)); err = asprintf(&path, "%s/bar0", endpoint_id(endpoint));
@ -2040,7 +2040,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport,
} }
free(path); free(path);
endpoint->fd = fd; endpoint->devmem_fd = fd;
err = ftruncate(fd, NVMF_VFIO_USER_DOORBELLS_OFFSET + NVMF_VFIO_USER_DOORBELLS_SIZE); err = ftruncate(fd, NVMF_VFIO_USER_DOORBELLS_OFFSET + NVMF_VFIO_USER_DOORBELLS_SIZE);
if (err != 0) { if (err != 0) {
goto out; goto out;