From 89c4d059b73ea7b4847b16d348ece595fed3f90c Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 12 Aug 2021 14:20:10 +0000 Subject: [PATCH] nvmf/vfio-user: clarify endpoint fd meaning Rename endpoint->fd to ->devmem_fd to better reflect its purpose. Signed-off-by: John Levon Change-Id: Ic73cb6684228d4ecb3d58c1865c80a3d7d07c223 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9402 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki --- lib/nvmf/vfio_user.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/nvmf/vfio_user.c b/lib/nvmf/vfio_user.c index 613f4c483b..a7382fb32b 100644 --- a/lib/nvmf/vfio_user.c +++ b/lib/nvmf/vfio_user.c @@ -183,7 +183,7 @@ struct nvmf_vfio_user_endpoint { vfu_ctx_t *vfu_ctx; struct msixcap *msix; vfu_pci_config_space_t *pci_config_space; - int fd; + int devmem_fd; volatile uint32_t *doorbells; 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); } - if (endpoint->fd > 0) { - close(endpoint->fd); + if (endpoint->devmem_fd > 0) { + close(endpoint->devmem_fd); } vfu_destroy_ctx(endpoint->vfu_ctx); @@ -1875,7 +1875,7 @@ vfio_user_dev_info_fill(struct nvmf_vfio_user_transport *vu_transport, } else { 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, - sparse_mmap, 1, endpoint->fd, 0); + sparse_mmap, 1, endpoint->devmem_fd, 0); } if (ret < 0) { @@ -2022,7 +2022,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport, return -ENOMEM; } - endpoint->fd = -1; + endpoint->devmem_fd = -1; memcpy(&endpoint->trid, trid, sizeof(endpoint->trid)); err = asprintf(&path, "%s/bar0", endpoint_id(endpoint)); @@ -2040,7 +2040,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport, } free(path); - endpoint->fd = fd; + endpoint->devmem_fd = fd; err = ftruncate(fd, NVMF_VFIO_USER_DOORBELLS_OFFSET + NVMF_VFIO_USER_DOORBELLS_SIZE); if (err != 0) { goto out;