lkml.org 
[lkml]   [2020]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v2 1/9] vfio/pci: split vfio_pci_device into public and private parts
On Thu, 30 Jan 2020 21:09:56 -0500
Yan Zhao <yan.y.zhao@intel.com> wrote:

> split vfio_pci_device into two parts:
> (1) a public part,
> including pdev, num_region, irq_type which are accessible from
> outside of vfio.
> (2) a private part,
> a pointer to vfio_pci_device_private, only accessible within vfio
>
> Cc: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
> ---
> drivers/vfio/pci/vfio_pci.c | 209 +++++++++++++++-------------
> drivers/vfio/pci/vfio_pci_config.c | 157 +++++++++++----------
> drivers/vfio/pci/vfio_pci_igd.c | 16 +--
> drivers/vfio/pci/vfio_pci_intrs.c | 171 ++++++++++++-----------
> drivers/vfio/pci/vfio_pci_nvlink2.c | 16 +--
> drivers/vfio/pci/vfio_pci_private.h | 5 +-
> drivers/vfio/pci/vfio_pci_rdwr.c | 36 ++---
> include/linux/vfio.h | 7 +
> 8 files changed, 321 insertions(+), 296 deletions(-)

I think the typical solution to something like this would be...

struct vfio_pci_device {
...
};

struct vfio_pci_device_private {
struct vfio_pci_device vdev;
...
};

External code would be able to work with the vfio_pci_device and
internal code would do a container_of() to get access to the private
fields. What's done here is pretty ugly and not very cache friendly.
Thanks,

Alex

\
 
 \ /
  Last update: 2020-02-07 20:48    [W:0.102 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site