Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"

2016-06-02 Thread Changlong Xie
On 06/03/2016 10:13 AM, Changlong Xie wrote: On 06/03/2016 09:45 AM, Eric Blake wrote: On 06/02/2016 07:26 PM, Changlong Xie wrote: + +ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp); This does not look right, it looks like it's going to open the file to write t

Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"

2016-06-02 Thread Changlong Xie
On 06/03/2016 09:45 AM, Eric Blake wrote: On 06/02/2016 07:26 PM, Changlong Xie wrote: + +ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp); This does not look right, it looks like it's going to open the file to write to it. You probably want O_RDONLY, also I don't

Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"

2016-06-02 Thread Changlong Xie
On 06/02/2016 11:14 PM, Anthony PERARD wrote: On Thu, Jun 02, 2016 at 06:36:46PM +0800, Changlong Xie wrote: +void qmp_xen_load_devices_state(const char *filename, Error **errp) +{ +QEMUFile *f; +QIOChannelFile *ioc; +int ret; + +/* Guest must be paused before loading the device

Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"

2016-06-02 Thread Eric Blake
On 06/02/2016 07:26 PM, Changlong Xie wrote: >>> + >>> +ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, >>> 0660, errp); >> >> This does not look right, it looks like it's going to open the file >> to write to it. You probably want O_RDONLY, also I don't think the >> O_CREAT flag

Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"

2016-06-02 Thread Changlong Xie
On 06/02/2016 11:14 PM, Anthony PERARD wrote: On Thu, Jun 02, 2016 at 06:36:46PM +0800, Changlong Xie wrote: +void qmp_xen_load_devices_state(const char *filename, Error **errp) +{ +QEMUFile *f; +QIOChannelFile *ioc; +int ret; + +/* Guest must be paused before loading the device

Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"

2016-06-02 Thread Anthony PERARD
On Thu, Jun 02, 2016 at 06:36:46PM +0800, Changlong Xie wrote: > +void qmp_xen_load_devices_state(const char *filename, Error **errp) > +{ > +QEMUFile *f; > +QIOChannelFile *ioc; > +int ret; > + > +/* Guest must be paused before loading the device state; the RAM state > + * will