Merge tag 'for-linus-4.5-merge-window' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / tools / virtio / linux / virtio.h
1 #ifndef LINUX_VIRTIO_H
2 #define LINUX_VIRTIO_H
3 #include <linux/scatterlist.h>
4 #include <linux/kernel.h>
5
6 struct virtio_device {
7 void *dev;
8 u64 features;
9 };
10
11 struct virtqueue {
12 /* TODO: commented as list macros are empty stubs for now.
13 * Broken but enough for virtio_ring.c
14 * struct list_head list; */
15 void (*callback)(struct virtqueue *vq);
16 const char *name;
17 struct virtio_device *vdev;
18 unsigned int index;
19 unsigned int num_free;
20 void *priv;
21 };
22
23 /* Interfaces exported by virtio_ring. */
24 int virtqueue_add_sgs(struct virtqueue *vq,
25 struct scatterlist *sgs[],
26 unsigned int out_sgs,
27 unsigned int in_sgs,
28 void *data,
29 gfp_t gfp);
30
31 int virtqueue_add_outbuf(struct virtqueue *vq,
32 struct scatterlist sg[], unsigned int num,
33 void *data,
34 gfp_t gfp);
35
36 int virtqueue_add_inbuf(struct virtqueue *vq,
37 struct scatterlist sg[], unsigned int num,
38 void *data,
39 gfp_t gfp);
40
41 bool virtqueue_kick(struct virtqueue *vq);
42
43 void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
44
45 void virtqueue_disable_cb(struct virtqueue *vq);
46
47 bool virtqueue_enable_cb(struct virtqueue *vq);
48 bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
49
50 void *virtqueue_detach_unused_buf(struct virtqueue *vq);
51 struct virtqueue *vring_new_virtqueue(unsigned int index,
52 unsigned int num,
53 unsigned int vring_align,
54 struct virtio_device *vdev,
55 bool weak_barriers,
56 void *pages,
57 bool (*notify)(struct virtqueue *vq),
58 void (*callback)(struct virtqueue *vq),
59 const char *name);
60 void vring_del_virtqueue(struct virtqueue *vq);
61
62 #endif
This page took 0.042268 seconds and 5 git commands to generate.