qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v2 09/12] Add vhost-input-pci


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [RFC v2 09/12] Add vhost-input-pci
Date: Mon, 4 Jun 2018 10:58:30 +0200
User-agent: NeoMutt/20180512

> +#define TYPE_VHOST_USER_INPUT_PCI "vhost-user-input-pci"

Patch $subject mismatch.

> +struct VHostUserInput {
> +    VirtIOInput                       parent_obj;
> +
> +    VhostUserBackend                  *vhost;
> +};

Nothing input specific here ...

> +static void vhost_input_change_active(VirtIOInput *vinput)
> +{
> +    VHostUserInput *vhi = VHOST_USER_INPUT(vinput);
> +
> +    if (!vhi->vhost) {
> +        return;
> +    }
> +
> +    if (vinput->active) {
> +        vhost_user_backend_start(vhi->vhost);
> +    } else {
> +        vhost_user_backend_stop(vhi->vhost);
> +    }
> +}

... and here ...

> +static const VMStateDescription vmstate_vhost_input = {
> +    .name = "vhost-user-input",
> +    .unmigratable = 1,
> +};

... and here ...

> +static void vhost_input_is_busy(const Object *obj, const char *name,
> +                                Object *val, Error **errp)
> +{
> +    VHostUserInput *vhi = VHOST_USER_INPUT(obj);
> +
> +    if (vhi->vhost) {
> +        error_setg(errp, "can't use already busy vhost-user");
> +    } else {
> +        qdev_prop_allow_set_link_before_realize(obj, name, val, errp);
> +    }
> +}

... likewise ...

So, maybe it makes sense to have a abstact base class for vhost-user
devices?  And possibly move the vhost-backend code to the base class
then?

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]