Re: [PATCH 4/7] vfio,vfio-pci: Add vma to pfn callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  static int vfio_pci_reflck_attach(struct vfio_pci_device *vdev);
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 1e4fc69fee7d..42ca93be152a 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -875,6 +875,22 @@ struct vfio_device *vfio_device_get_from_dev(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(vfio_device_get_from_dev);
>  
> +static const struct file_operations vfio_device_fops;

If we ned a forward declaration here it would be nice to keep it at the top
of the file.  Finding a way to not need it would be even better.

> +
> +int vfio_device_vma_to_pfn(struct vfio_device *device,
> +			   struct vm_area_struct *vma, unsigned long *pfn)
> +{
> +	if (WARN_ON(!vma->vm_file || vma->vm_file->f_op != &vfio_device_fops ||
> +		    vma->vm_file->private_data != device))
> +		return -EINVAL;

WARN_ON_ONCE?

> +
> +	if (unlikely(!device->ops->vma_to_pfn))
> +		return -EPERM;
> +
> +	return device->ops->vma_to_pfn(device, vma, pfn);
> +}
> +EXPORT_SYMBOL_GPL(vfio_device_vma_to_pfn);

This function is only used in vfio.c, so it can be marked static instead of
being exported.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux