mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
vfio: Introduce a helper function to initialize VFIODevice
Introduce a helper function to replace the common code to initialize VFIODevice in pci, platform, ap and ccw VFIO device. No functional change intended. Suggested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
c12b55ad6f
commit
6106a32914
6 changed files with 21 additions and 20 deletions
|
@ -652,3 +652,14 @@ void vfio_device_set_fd(VFIODevice *vbasedev, const char *str, Error **errp)
|
|||
}
|
||||
vbasedev->fd = fd;
|
||||
}
|
||||
|
||||
void vfio_device_init(VFIODevice *vbasedev, int type, VFIODeviceOps *ops,
|
||||
DeviceState *dev, bool ram_discard)
|
||||
{
|
||||
vbasedev->type = type;
|
||||
vbasedev->ops = ops;
|
||||
vbasedev->dev = dev;
|
||||
vbasedev->fd = -1;
|
||||
|
||||
vbasedev->ram_block_discard_allowed = ram_discard;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue