diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2023-10-31 19:02:06 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-11-01 16:31:16 +0300 |
commit | 3503895788d402d6a3814085ed582c364ec3e903 (patch) | |
tree | 7924cd651500b6a72ceca421d9fb2f025e43885e /drivers/virtio | |
parent | 86f6c224c97911b4392cb7b402e6a4ed323a449e (diff) | |
download | linux-3503895788d402d6a3814085ed582c364ec3e903.tar.xz |
virtio_pci: move structure to a header
These are guest/host interfaces, so they belong in the header where e.g.
qemu will know to find them.
Note: we added a new structure as opposed to extending existing one
because someone might be relying on the size of the existing structure
staying unchanged. Add a warning to avoid using sizeof.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_pci_modern_dev.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c index e2a1fe7bb66c..7de8b1ebabac 100644 --- a/drivers/virtio/virtio_pci_modern_dev.c +++ b/drivers/virtio/virtio_pci_modern_dev.c @@ -294,9 +294,10 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev) err = -EINVAL; mdev->common = vp_modern_map_capability(mdev, common, - sizeof(struct virtio_pci_common_cfg), 4, - 0, sizeof(struct virtio_pci_modern_common_cfg), - &mdev->common_len, NULL); + sizeof(struct virtio_pci_common_cfg), 4, 0, + offsetofend(struct virtio_pci_modern_common_cfg, + queue_reset), + &mdev->common_len, NULL); if (!mdev->common) goto err_map_common; mdev->isr = vp_modern_map_capability(mdev, isr, sizeof(u8), 1, |