> > > > > + > > > > > +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