lkml.org 
[lkml]   [2018]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2018-07-20 15:05    [W:0.158 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site