> +static void vhost_input_get_config(VirtIODevice *vdev, uint8_t *config_data)
> +{
> + VirtIOInput *vinput = VIRTIO_INPUT(vdev);
> + VHostUserInput *vhi = VHOST_USER_INPUT(vdev);
> + int ret;
> +
> + memset(config_data, 0, vinput->cfg_size);
> +
> + ret = vhost_dev_get_config(&vhi->vhost->dev, config_data,
> vinput->cfg_size);
> + if (ret) {
> + error_report("vhost-user-input: get device config space failed");
> + return;
> + }
> +}
> +
> +static void vhost_input_set_config(VirtIODevice *vdev,
> + const uint8_t *config_data)
> +{
> + VHostUserInput *vhi = VHOST_USER_INPUT(vdev);
> + int ret;
> +
> + ret = vhost_dev_set_config(&vhi->vhost->dev, config_data,
> + 0, sizeof(virtio_input_config),
> + VHOST_SET_CONFIG_TYPE_MASTER);
> + if (ret) {
> + error_report("vhost-user-input: set device config space failed");
> + return;
> + }
> +
> + virtio_notify_config(vdev);
> +}
These two look rather generic, the only virtio-input specific thing is
the config space size. Can we store the size somewhere, then move the
functions to common vhost-user code?
cheers,
Gerd