qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Cc: qemu devel <qemu-devel@nongnu.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Juan Quintela <quintela@redhat.com>,
	Amit Shah <amit.shah@redhat.com>, Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Wen Congyang <wency@cn.fujitsu.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: Re: [Qemu-devel] [PATCH v5 1/1] Introduce "xen-load-devices-state"
Date: Thu, 2 Jun 2016 16:14:18 +0100	[thread overview]
Message-ID: <20160602151418.GJ1184@perard.uk.xensource.com> (raw)
In-Reply-To: <1464863806-1984-2-git-send-email-xiecl.fnst@cn.fujitsu.com>

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 already have been loaded by xc
> +     */
> +    if (runstate_is_running()) {
> +        error_setg(errp, "Cannot update device state while vm is running");
> +        return;
> +    }
> +    vm_stop(RUN_STATE_RESTORE_VM);
> +
> +    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 is needed. (and without O_WRONLY, mode can be 0 instead of
0660.)

> +    if (!ioc) {
> +        return;
> +    }
> +    f = qemu_fopen_channel_output(QIO_CHANNEL(ioc));

I'm not sure, but I guess here you want qemu_fopen_channel_input here.

Thanks,

-- 
Anthony PERARD

  reply	other threads:[~2016-06-02 15:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 10:36 [Qemu-devel] [PATCH v5 0/1] Introduce "xen-load-devices-state" Changlong Xie
2016-06-02 10:36 ` [Qemu-devel] [PATCH v5 1/1] " Changlong Xie
2016-06-02 15:14   ` Anthony PERARD [this message]
2016-06-03  1:26     ` Changlong Xie
2016-06-03  1:45       ` Eric Blake
2016-06-03  2:13         ` Changlong Xie
2016-06-03  3:07           ` Changlong Xie
2016-06-03  1:56     ` Changlong Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160602151418.GJ1184@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=sstabellini@kernel.org \
    --cc=wency@cn.fujitsu.com \
    --cc=xiecl.fnst@cn.fujitsu.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).