qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v13 10/19] multi-process: Associate fd of a PCIDevice with it


From: Stefan Hajnoczi
Subject: Re: [PATCH v13 10/19] multi-process: Associate fd of a PCIDevice with its object
Date: Mon, 14 Dec 2020 21:23:46 +0000

On Mon, Dec 14, 2020 at 12:14:50AM -0500, Jagannathan Raman wrote:
> +static void remote_object_release(DeviceListener *listener, DeviceState *dev)
> +{
> +    RemoteObject *o = container_of(listener, RemoteObject, listener);
> +
> +    if (o->dev == dev) {
> +        object_unref(OBJECT(o));
> +    }
> +}
> +
> +static void remote_object_machine_done(Notifier *notifier, void *data)
> +{
> +    RemoteObject *o = container_of(notifier, RemoteObject, machine_done);
> +    DeviceState *dev = NULL;
> +    QIOChannel *ioc = NULL;
> +    Coroutine *co = NULL;
> +    RemoteCommDev *comdev = NULL;
> +    Error *err = NULL;
> +
> +    dev = qdev_find_recursive(sysbus_get_default(), o->devid);
> +    if (!dev || !object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
> +        error_report("%s is not a PCI device", o->devid);
> +        return;
> +    }
> +
> +    ioc = qio_channel_new_fd(o->fd, &err);
> +    if (!ioc) {
> +        error_report_err(err);
> +        return;
> +    }
> +    qio_channel_set_blocking(ioc, false, NULL);
> +
> +    o->dev = dev;
> +
> +    o->listener.unrealize = remote_object_release;
> +    device_listener_register(&o->listener);

The remote_object_release() name is outdated. How about
remote_object_unrealize_listener()?

Attachment: signature.asc
Description: PGP signature


reply via email to

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