qemu-devel
[Top][All Lists]
Advanced

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

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


From: Stefan Hajnoczi
Subject: Re: [PATCH v10 08/19] multi-process: Associate fd of a PCIDevice with its object
Date: Wed, 7 Oct 2020 15:34:45 +0100

On Mon, Oct 05, 2020 at 11:50:56AM -0700, elena.ufimtseva@oracle.com wrote:
> +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);
> +    qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS);

This flag is already set by qio_channel_socket_set_fd() from
qio_channel_new_fd() so the call to qio_channel_set_feature() can be
dropped.

You may want to check the presence of the feature in case a non-AF_UNIX
fd was passed though.

Attachment: signature.asc
Description: PGP signature


reply via email to

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