Re: [PATCH v2 4/6] vfio: selftests: Export more vfio_pci functions
From: David Matlack
Date: Wed Jan 07 2026 - 18:06:24 EST
On 2025-12-10 06:14 PM, Raghavendra Rao Ananta wrote:
> -static void vfio_device_bind_iommufd(int device_fd, int iommufd,
> - const char *vf_token)
> +int __vfio_device_bind_iommufd(int device_fd, int iommufd, const char *vf_token)
> {
> struct vfio_device_bind_iommufd args = {
> .argsz = sizeof(args),
> @@ -314,7 +322,15 @@ static void vfio_device_bind_iommufd(int device_fd, int iommufd,
> args.token_uuid_ptr = (u64)token_uuid;
> }
>
> - ioctl_assert(device_fd, VFIO_DEVICE_BIND_IOMMUFD, &args);
> + return ioctl(device_fd, VFIO_DEVICE_BIND_IOMMUFD, &args);
For ioctls that return 0 on success and -1 on error, let's follow the
precedent set in iommu.c and return -errno on error from our library
functions. i.e.
if (ioctl(device_fd, VFIO_DEVICE_BIND_IOMMUFD, &args))
return -errno;
return 0;