提交 98e8c6bc 编写于 作者: R Rusty Russell

virtio: make virtqueue_add_buf() returning 0 on success, not capacity.

Now noone relies on this behavior, we simplify virtqueue_add_buf() so it
return 0 or -errno.
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
Acked-by: NMichael S. Tsirkin <mst@redhat.com>
上级 49e86f16
...@@ -188,10 +188,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq, ...@@ -188,10 +188,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq,
* Caller must ensure we don't call this with other virtqueue operations * Caller must ensure we don't call this with other virtqueue operations
* at the same time (except where noted). * at the same time (except where noted).
* *
* Returns remaining capacity of queue or a negative error * Returns zero or a negative error (ie. ENOSPC, ENOMEM).
* (ie. ENOSPC). Note that it only really makes sense to treat all
* positive return values as "available": indirect buffers mean that
* we can put an entire sg[] array inside a single queue entry.
*/ */
int virtqueue_add_buf(struct virtqueue *_vq, int virtqueue_add_buf(struct virtqueue *_vq,
struct scatterlist sg[], struct scatterlist sg[],
...@@ -291,7 +288,7 @@ int virtqueue_add_buf(struct virtqueue *_vq, ...@@ -291,7 +288,7 @@ int virtqueue_add_buf(struct virtqueue *_vq,
pr_debug("Added buffer head %i to %p\n", head, vq); pr_debug("Added buffer head %i to %p\n", head, vq);
END_USE(vq); END_USE(vq);
return vq->vq.num_free; return 0;
} }
EXPORT_SYMBOL_GPL(virtqueue_add_buf); EXPORT_SYMBOL_GPL(virtqueue_add_buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册