vhost: add vhost_set_log_base op

Split VHOST_SET_LOG_BASE call in a seperate function callback, so that
type safety works and more arguments can be added in the next patches.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
This commit is contained in:
Marc-André Lureau 2015-10-09 17:17:23 +02:00 committed by Michael S. Tsirkin
parent 636f4dddfe
commit c2bea314f6
4 changed files with 27 additions and 4 deletions

View file

@ -242,7 +242,6 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
break;
case VHOST_USER_SET_FEATURES:
case VHOST_USER_SET_LOG_BASE:
case VHOST_USER_SET_PROTOCOL_FEATURES:
msg.u64 = *((__u64 *) arg);
msg.size = sizeof(m.u64);
@ -367,6 +366,20 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
return 0;
}
static int vhost_set_log_base(struct vhost_dev *dev, uint64_t base)
{
VhostUserMsg msg = {
.request = VHOST_USER_SET_LOG_BASE,
.flags = VHOST_USER_VERSION,
.u64 = base,
.size = sizeof(m.u64),
};
vhost_user_write(dev, &msg, NULL, 0);
return 0;
}
static int vhost_user_init(struct vhost_dev *dev, void *opaque)
{
unsigned long long features;
@ -453,4 +466,5 @@ const VhostOps user_ops = {
.vhost_backend_get_vq_index = vhost_user_get_vq_index,
.vhost_backend_set_vring_enable = vhost_user_set_vring_enable,
.vhost_backend_memslots_limit = vhost_user_memslots_limit,
.vhost_set_log_base = vhost_set_log_base,
};