Skip to contentSkip to conversation

vfio/container: Rename vfio_init_container to vfio_set_iommu

PATCH Applied Zhenzhong Duan 2 participants 3 messages Dec 21, 2023 – Jan 2, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio/container: Rename vfio_init_container to vfio_set_iommu

vfio_container_init() and vfio_init_container() names are confusing especially when we see vfio_init_container() calls vfio_container_init().

vfio_container_init() operates on base container which is consistent with all routines handling 'VFIOContainerBase *' ops.

vfio_init_container() operates on legacy container and setup IOMMU context with ioctl(VFIO_SET_IOMMU).

So choose to rename vfio_init_container to vfio_set_iommu to avoid the confusion.

No functional change intended.

---
 hw/vfio/container.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/vfio/container.c +3 -3
index 8d334f52f2..bd25b9fbad 100644
@@ -392,8 +392,8 @@ static const VFIOIOMMUClass *vfio_get_iommu_class(int iommu_type, Error **errp)
     return VFIO_IOMMU_CLASS(klass);
 }
 
-static int vfio_init_container(VFIOContainer *container, int group_fd,
-                               VFIOAddressSpace *space, Error **errp)
+static int vfio_set_iommu(VFIOContainer *container, int group_fd,
+                          VFIOAddressSpace *space, Error **errp)
 {
     int iommu_type, ret;
     const VFIOIOMMUClass *vioc;
@@ -616,7 +616,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
     container->fd = fd;
     bcontainer = &container->bcontainer;
 
-    ret = vfio_init_container(container, group->fd, space, errp);
+    ret = vfio_set_iommu(container, group->fd, space, errp);
     if (ret) {
         goto free_container_exit;
     }
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Zhenzhong Duan

vfio_container_init() and vfio_init_container() names are confusing especially when we see vfio_init_container() calls vfio_container_init().

vfio_container_init() operates on base container which is consistent with all routines handling 'VFIOContainerBase *' ops.

vfio_init_container() operates on legacy container and setup IOMMU context with ioctl(VFIO_SET_IOMMU).

Quoted 7 lines

So choose to rename vfio_init_container to vfio_set_iommu to avoid the confusion.

No functional change intended.

Thanks,

C.

Quoted 28 lines
---
  hw/vfio/container.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
hw/vfio/container.c +3 -3
index 8d334f52f2..bd25b9fbad 100644
@@ -392,8 +392,8 @@ static const VFIOIOMMUClass *vfio_get_iommu_class(int iommu_type, Error **errp)
      return VFIO_IOMMU_CLASS(klass);
  }
 
-static int vfio_init_container(VFIOContainer *container, int group_fd,
-                               VFIOAddressSpace *space, Error **errp)
+static int vfio_set_iommu(VFIOContainer *container, int group_fd,
+                          VFIOAddressSpace *space, Error **errp)
  {
      int iommu_type, ret;
      const VFIOIOMMUClass *vioc;
@@ -616,7 +616,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
      container->fd = fd;
      bcontainer = &container->bcontainer;
 
-    ret = vfio_init_container(container, group->fd, space, errp);
+    ret = vfio_set_iommu(container, group->fd, space, errp);
      if (ret) {
          goto free_container_exit;
      }
#2 lore raw
In reply to Zhenzhong Duan
Quoted 9 lines · Zhenzhong Duan

vfio_container_init() and vfio_init_container() names are confusing especially when we see vfio_init_container() calls vfio_container_init().

vfio_container_init() operates on base container which is consistent with all routines handling 'VFIOContainerBase *' ops.

vfio_init_container() operates on legacy container and setup IOMMU context with ioctl(VFIO_SET_IOMMU).

Quoted 7 lines

So choose to rename vfio_init_container to vfio_set_iommu to avoid the confusion.

No functional change intended.

Applied to vfio-next.

Thanks,

C.