On Fri, Mar 12, 2021 at 01:04:29PM +0000, Liu, Yi L wrote:
Hi Jason,
quoted
From: Jason Gunthorpe <jgg@nvidia.com>
Sent: Wednesday, March 10, 2021 5:39 AM
[...]
quoted
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index b7e18bde5aa8b3..ad8b579d67d34a 100644
+++ b/include/linux/vfio.h
@@ -15,6 +15,18 @@
#include <linux/poll.h>
#include <uapi/linux/vfio.h>
+struct vfio_device {
+ struct device *dev;
+ const struct vfio_device_ops *ops;
+ struct vfio_group *group;
+
+ /* Members below here are private, not for driver use */
+ refcount_t refcount;
+ struct completion comp;
+ struct list_head group_next;
+ void *device_data;
A dumb question. If these fields are not supposed to be used by
"external modules" like vfio_pci driver, how about defining a private
struct vfio_dev_prive within vfio.c and embed here?
This is rarely done, there should be a good reason to do it, as making
a private structure in a container_of system requires another memory
allocation.
'struct device' has this for instance, look at the 'p' member.
In this case I can't see much value
Jason