Commit 80f7d030 authored by Greg Kurz's avatar Greg Kurz Committed by Michael S. Tsirkin

vhost: rename vhost_init_used()

Looking at how callers use this, maybe we should just rename init_used
to vhost_vq_init_access. The _used suffix was a hint that we
access the vq used ring. But maybe what callers care about is
that it must be called after access_ok.

Also, this function manipulates the vq->is_le field which isn't related
to the vq used ring.

This patch simply renames vhost_init_used() to vhost_vq_init_access() as
suggested by Michael.

No behaviour change.
Signed-off-by: default avatarGreg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent c5072037
...@@ -917,7 +917,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) ...@@ -917,7 +917,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
vhost_net_disable_vq(n, vq); vhost_net_disable_vq(n, vq);
vq->private_data = sock; vq->private_data = sock;
r = vhost_init_used(vq); r = vhost_vq_init_access(vq);
if (r) if (r)
goto err_used; goto err_used;
r = vhost_net_enable_vq(n, vq); r = vhost_net_enable_vq(n, vq);
......
...@@ -1274,7 +1274,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, ...@@ -1274,7 +1274,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
vq = &vs->vqs[i].vq; vq = &vs->vqs[i].vq;
mutex_lock(&vq->mutex); mutex_lock(&vq->mutex);
vq->private_data = vs_tpg; vq->private_data = vs_tpg;
vhost_init_used(vq); vhost_vq_init_access(vq);
mutex_unlock(&vq->mutex); mutex_unlock(&vq->mutex);
} }
ret = 0; ret = 0;
......
...@@ -196,7 +196,7 @@ static long vhost_test_run(struct vhost_test *n, int test) ...@@ -196,7 +196,7 @@ static long vhost_test_run(struct vhost_test *n, int test)
oldpriv = vq->private_data; oldpriv = vq->private_data;
vq->private_data = priv; vq->private_data = priv;
r = vhost_init_used(&n->vqs[index]); r = vhost_vq_init_access(&n->vqs[index]);
mutex_unlock(&vq->mutex); mutex_unlock(&vq->mutex);
......
...@@ -1170,7 +1170,7 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event) ...@@ -1170,7 +1170,7 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
return 0; return 0;
} }
int vhost_init_used(struct vhost_virtqueue *vq) int vhost_vq_init_access(struct vhost_virtqueue *vq)
{ {
__virtio16 last_used_idx; __virtio16 last_used_idx;
int r; int r;
...@@ -1200,7 +1200,7 @@ int vhost_init_used(struct vhost_virtqueue *vq) ...@@ -1200,7 +1200,7 @@ int vhost_init_used(struct vhost_virtqueue *vq)
vq->is_le = is_le; vq->is_le = is_le;
return r; return r;
} }
EXPORT_SYMBOL_GPL(vhost_init_used); EXPORT_SYMBOL_GPL(vhost_vq_init_access);
static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len,
struct iovec iov[], int iov_size) struct iovec iov[], int iov_size)
......
...@@ -148,7 +148,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *, ...@@ -148,7 +148,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *,
struct vhost_log *log, unsigned int *log_num); struct vhost_log *log, unsigned int *log_num);
void vhost_discard_vq_desc(struct vhost_virtqueue *, int n); void vhost_discard_vq_desc(struct vhost_virtqueue *, int n);
int vhost_init_used(struct vhost_virtqueue *); int vhost_vq_init_access(struct vhost_virtqueue *);
int vhost_add_used(struct vhost_virtqueue *, unsigned int head, int len); int vhost_add_used(struct vhost_virtqueue *, unsigned int head, int len);
int vhost_add_used_n(struct vhost_virtqueue *, struct vring_used_elem *heads, int vhost_add_used_n(struct vhost_virtqueue *, struct vring_used_elem *heads,
unsigned count); unsigned count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment