[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1832644023.52851886.1532091855557.JavaMail.zimbra@redhat.com>
Date: Fri, 20 Jul 2018 09:04:15 -0400 (EDT)
From: Pankaj Gupta <pagupta@...hat.com>
To: Luiz Capitulino <lcapitulino@...hat.com>
Cc: Stefan Hajnoczi <stefanha@...hat.com>, kwolf@...hat.com,
haozhong zhang <haozhong.zhang@...el.com>, jack@...e.cz,
xiaoguangrong eric <xiaoguangrong.eric@...il.com>,
kvm@...r.kernel.org, riel@...riel.com, linux-nvdimm@...1.01.org,
david@...hat.com, ross zwisler <ross.zwisler@...el.com>,
linux-kernel@...r.kernel.org, qemu-devel@...gnu.org,
hch@...radead.org, imammedo@...hat.com, mst@...hat.com,
niteshnarayanlal@...mail.com, pbonzini@...hat.com,
dan j williams <dan.j.williams@...el.com>, nilal@...hat.com
Subject: Re: [Qemu-devel] [RFC v3] qemu: Add virtio pmem device
> > > > > +
> > > > > +typedef struct VirtIOPMEMresp {
> > > > > + int ret;
> > > > > +} VirtIOPMEMResp;
> > > > > +
> > > > > +typedef struct VirtIODeviceRequest {
> > > > > + VirtQueueElement elem;
> > > > > + int fd;
> > > > > + VirtIOPMEM *pmem;
> > > > > + VirtIOPMEMResp resp;
> > > > > +} VirtIODeviceRequest;
> > > > > +
> > > > > +static int worker_cb(void *opaque)
> > > > > +{
> > > > > + VirtIODeviceRequest *req = opaque;
> > > > > + int err = 0;
> > > > > +
> > > > > + /* flush raw backing image */
> > > > > + err = fsync(req->fd);
> > > > > + if (err != 0) {
> > > > > + err = errno;
> > > > > + }
> > > > > + req->resp.ret = err;
> > > >
> > > > Host question: are you returning the guest errno code to the host?
> > >
> > > No. I am returning error code from the host in-case of host fsync
> > > failure, otherwise returning zero.
> >
> > I think that's what Luiz meant. errno constants are not portable
> > between operating systems and architectures. Therefore they cannot be
> > used in external interfaces in software that expects to communicate with
> > other systems.
>
> Oh, thanks. Only saw this email now.
>
> > It will be necessary to define specific constants for virtio-pmem
> > instead of passing errno from the host to guest.
>
> Yes, defining your own constants work. But I think the only fsync()
> error that will make sense for the guest is EIO. The other errors
> only make sense for the host.
Agree.
Thanks,
Pankaj
Powered by blists - more mailing lists