Skip to content

Commit

Permalink
virtio_ring: add new function virtqueue_is_broken()
Browse files Browse the repository at this point in the history
Add new function virtqueue_is_broken(). Callers of virtqueue_get_buf()
should check for a broken queue.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Heinz Graalfs authored and Rusty Russell committed Oct 29, 2013
1 parent 53c18c9 commit b3b32c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/virtio/virtio_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,4 +851,12 @@ unsigned int virtqueue_get_vring_size(struct virtqueue *_vq)
}
EXPORT_SYMBOL_GPL(virtqueue_get_vring_size);

bool virtqueue_is_broken(struct virtqueue *_vq)
{
struct vring_virtqueue *vq = to_vvq(_vq);

return vq->broken;
}
EXPORT_SYMBOL_GPL(virtqueue_is_broken);

MODULE_LICENSE("GPL");
2 changes: 2 additions & 0 deletions include/linux/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);

unsigned int virtqueue_get_vring_size(struct virtqueue *vq);

bool virtqueue_is_broken(struct virtqueue *vq);

/**
* virtio_device - representation of a device using virtio
* @index: unique position on the virtio bus
Expand Down

0 comments on commit b3b32c9

Please sign in to comment.