|
From: | Wenchao Xia |
Subject: | Re: [Qemu-devel] [PATCH V4 2/6] qcow2: add error message in qcow2_write_snapshots() |
Date: | Tue, 05 Nov 2013 10:19:04 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 |
δΊ 2013/11/5 3:46, Eric Blake ει:
On 11/03/2013 06:48 PM, Wenchao Xia wrote:On 14.10.2013 23:52, Wenchao Xia wrote:The function still returns int since qcow2_snapshot_delete() will return the number.@@ -227,24 +239,40 @@ static int qcow2_write_snapshots(BlockDriverState *bs) ret = bdrv_pwrite(bs->file, offset, &h, sizeof(h)); if (ret < 0) { + error_setg(errp, + "Failed in write of snapshot header at %" + PRIi64 " with size %" PRIu64 ": %d (%s)", + offset, sizeof(h), ret, strerror(-ret));Again, on 32 bit systems, sizeof(size_t) is generally 4 and not 8 (you may want to cast sizeof(h) to int and just use %d).Maybe caset as (int64_t)sizeof(h) to avoid possible incomplete value?If we have objects larger than 2G (such that sizeof(h) would require more than 31 bits), we have other issues to worry about. Casting to int and using %d is safe enough.
OK, will use %d.
[Prev in Thread] | Current Thread | [Next in Thread] |