From: Haozhong Zhang <haozhong.zhang@intel.com>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <rth@twiddle.net>,
Haozhong Zhang <haozhong.zhang@intel.com>
Subject: [Qemu-devel] [PATCH 1/3] exec.c: add comment for errors of get_file_size()
Date: Mon, 7 Nov 2016 13:08:57 +0800 [thread overview]
Message-ID: <20161107050859.31058-2-haozhong.zhang@intel.com> (raw)
In-Reply-To: <20161107050859.31058-1-haozhong.zhang@intel.com>
Indicate that not stopping on get_file_size() errors in file_ram_alloc()
is on purpose and not a mistake.
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
exec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/exec.c b/exec.c
index 3d867f1..68b0c92 100644
--- a/exec.c
+++ b/exec.c
@@ -1314,6 +1314,9 @@ static void *file_ram_alloc(RAMBlock *block,
}
#endif
+ /* If QEMU fails to get the backend file size, i.e. file_size < 0,
+ * it will treat the file as non-empty and not truncate it.
+ */
file_size = get_file_size(fd);
if (memory < block->page_size) {
--
2.10.1
next prev parent reply other threads:[~2016-11-07 5:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 5:08 [Qemu-devel] [PATCH 0/3] hostmem-file: make option 'size' optional Haozhong Zhang
2016-11-07 5:08 ` Haozhong Zhang [this message]
2016-11-07 5:08 ` [Qemu-devel] [PATCH 2/3] exec.c: move file operations to qemu_ram_alloc_from_file() Haozhong Zhang
2016-11-07 5:08 ` [Qemu-devel] [PATCH 3/3] hostmem-file: make option 'size' optional Haozhong Zhang
2016-11-07 7:52 ` [Qemu-devel] [PATCH 0/3] " Markus Armbruster
2016-11-07 7:56 ` Haozhong Zhang
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=20161107050859.31058-2-haozhong.zhang@intel.com \
--to=haozhong.zhang@intel.com \
--cc=crosthwaite.peter@gmail.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).