From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3cBj-000650-11 for qemu-devel@nongnu.org; Mon, 07 Nov 2016 00:09:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3cBf-0001Ww-T4 for qemu-devel@nongnu.org; Mon, 07 Nov 2016 00:09:42 -0500 Received: from mga02.intel.com ([134.134.136.20]:6606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c3cBf-0001Ul-L2 for qemu-devel@nongnu.org; Mon, 07 Nov 2016 00:09:39 -0500 From: Haozhong Zhang Date: Mon, 7 Nov 2016 13:08:57 +0800 Message-Id: <20161107050859.31058-2-haozhong.zhang@intel.com> In-Reply-To: <20161107050859.31058-1-haozhong.zhang@intel.com> References: <20161107050859.31058-1-haozhong.zhang@intel.com> Subject: [Qemu-devel] [PATCH 1/3] exec.c: add comment for errors of get_file_size() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Igor Mammedov , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Haozhong Zhang 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 --- 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