diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-04-12 09:18:25 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-05-19 08:45:41 -0400 |
commit | 316f25f5b3d547ce892d370f99f08a27276896ff (patch) | |
tree | 2e35e3351b62ab4af834a164d3dcca2cb23fa682 /include/linux/virtio.h | |
parent | bdb4a1305723f985249210a803105dbc48e86b64 (diff) |
virtio: add virtqueue_ vq_ops wrappers
Add inline functions that wrap vq->vq_ops-> calls
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/virtio.h')
-rw-r--r-- | include/linux/virtio.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 40d1709bdbf4..18ccc686a429 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -77,6 +77,40 @@ struct virtqueue_ops { | |||
77 | void *(*detach_unused_buf)(struct virtqueue *vq); | 77 | void *(*detach_unused_buf)(struct virtqueue *vq); |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static inline int virtqueue_add_buf(struct virtqueue *vq, | ||
81 | struct scatterlist sg[], | ||
82 | unsigned int out_num, | ||
83 | unsigned int in_num, | ||
84 | void *data) | ||
85 | { | ||
86 | return vq->vq_ops->add_buf(vq, sg, out_num, in_num, data); | ||
87 | } | ||
88 | |||
89 | static inline int void virtqueue_kick(struct virtqueue *vq) | ||
90 | { | ||
91 | return vq->vq_ops->kick(vq); | ||
92 | } | ||
93 | |||
94 | static inline void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len) | ||
95 | { | ||
96 | return vq->vq_ops->get_buf(vq, len); | ||
97 | } | ||
98 | |||
99 | static inline void virtqueue_disable_cb(struct virtqueue *vq) | ||
100 | { | ||
101 | vq->vq_ops->disable_cb(vq); | ||
102 | } | ||
103 | |||
104 | static inline bool virtqueue_enable_cb(struct virtqueue *vq) | ||
105 | { | ||
106 | return vq->vq_ops->enable_cb(vq); | ||
107 | } | ||
108 | |||
109 | static inline void *virtqueue_detach_unused_buf(struct virtqueue *vq) | ||
110 | { | ||
111 | return vq->vq_ops->detach_unused_buf(vq); | ||
112 | } | ||
113 | |||
80 | /** | 114 | /** |
81 | * virtio_device - representation of a device using virtio | 115 | * virtio_device - representation of a device using virtio |
82 | * @index: unique position on the virtio bus | 116 | * @index: unique position on the virtio bus |