virtio: add ability to iterate over vqs

commit 24a7e4d20783c0514850f24a5c41ede46ab058f0 upstream.

For cleanup it's helpful to be able to simply scan all vqs and discard
all data. Add an iterator to do that.

Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Michael S. Tsirkin 2018-04-20 20:22:40 +03:00 committed by Greg Kroah-Hartman
parent 311a886f34
commit a4fc9c518e

View File

@ -124,6 +124,9 @@ int virtio_device_freeze(struct virtio_device *dev);
int virtio_device_restore(struct virtio_device *dev); int virtio_device_restore(struct virtio_device *dev);
#endif #endif
#define virtio_device_for_each_vq(vdev, vq) \
list_for_each_entry(vq, &vdev->vqs, list)
/** /**
* virtio_driver - operations for a virtio I/O driver * virtio_driver - operations for a virtio I/O driver
* @driver: underlying device driver (populate name and owner). * @driver: underlying device driver (populate name and owner).