[PATCH] vfio/container: Rename vfio_init_container to vfio_set_iommu

Zhenzhong Duan posted 1 patch 11 months, 1 week ago
Failed in applying to current master (apply log)
hw/vfio/container.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] vfio/container: Rename vfio_init_container to vfio_set_iommu
Posted by Zhenzhong Duan 11 months, 1 week ago
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.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 hw/vfio/container.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 8d334f52f2..bd25b9fbad 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -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.34.1


Re: [PATCH] vfio/container: Rename vfio_init_container to vfio_set_iommu
Posted by Cédric Le Goater 10 months, 4 weeks ago
On 12/21/23 03:45, Zhenzhong Duan wrote:
> 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.
> 
> Suggested-by: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>


Applied to vfio-next.

Thanks,

C.


Re: [PATCH] vfio/container: Rename vfio_init_container to vfio_set_iommu
Posted by Cédric Le Goater 11 months, 1 week ago
On 12/21/23 03:45, Zhenzhong Duan wrote:
> 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.
> 
> Suggested-by: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/vfio/container.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/vfio/container.c b/hw/vfio/container.c
> index 8d334f52f2..bd25b9fbad 100644
> --- a/hw/vfio/container.c
> +++ b/hw/vfio/container.c
> @@ -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;
>       }