3 #include <linux/scatterlist.h>
4 #include <linux/kernel.h>
10 struct virtio_device {
16 /* TODO: commented as list macros are empty stubs for now.
17 * Broken but enough for virtio_ring.c
18 * struct list_head list; */
19 void (*callback)(struct virtqueue *vq);
21 struct virtio_device *vdev;
23 unsigned int num_free;
27 /* Interfaces exported by virtio_ring. */
28 int virtqueue_add_sgs(struct virtqueue *vq,
29 struct scatterlist *sgs[],
35 int virtqueue_add_outbuf(struct virtqueue *vq,
36 struct scatterlist sg[], unsigned int num,
40 int virtqueue_add_inbuf(struct virtqueue *vq,
41 struct scatterlist sg[], unsigned int num,
45 bool virtqueue_kick(struct virtqueue *vq);
47 void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
49 void virtqueue_disable_cb(struct virtqueue *vq);
51 bool virtqueue_enable_cb(struct virtqueue *vq);
52 bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
54 void *virtqueue_detach_unused_buf(struct virtqueue *vq);
55 struct virtqueue *vring_new_virtqueue(unsigned int index,
57 unsigned int vring_align,
58 struct virtio_device *vdev,
61 bool (*notify)(struct virtqueue *vq),
62 void (*callback)(struct virtqueue *vq),
64 void vring_del_virtqueue(struct virtqueue *vq);