Re: [Qemu-devel] [PATCH v9 00/12] Adding VMDK monolithic flat support
On Tue, Jul 12, 2011 at 07:56:27PM +0800, Fam Zheng wrote: Changes from v8: 09/12: remove duplicated sscanf 10/12: change option name to 'subformat', change commit message typo, factor common parts of creating, and other small improvements Fam Zheng (12): VMDK: introduce VmdkExtent VMDK: bugfix, align offset to cluster in get_whole_cluster VMDK: probe for monolithicFlat images VMDK: separate vmdk_open by format version VMDK: add field BDRVVmdkState.desc_offset VMDK: flush multiple extents VMDK: move 'static' cid_update flag to bs field VMDK: change get_cluster_offset return type VMDK: open/read/write for monolithicFlat image VMDK: create different subformats VMDK: fix coding style block: add bdrv_get_allocated_file_size() operation block.c | 19 + block.h |1 + block/raw-posix.c | 21 + block/raw-win32.c | 29 ++ block/vmdk.c | 1296 - block_int.h |2 + qemu-img.c| 31 +-- 7 files changed, 964 insertions(+), 435 deletions(-) Reviewed-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
Re: [Qemu-devel] [PATCH v9 00/12] Adding VMDK monolithic flat support
Am 12.07.2011 13:56, schrieb Fam Zheng: Changes from v8: 09/12: remove duplicated sscanf 10/12: change option name to 'subformat', change commit message typo, factor common parts of creating, and other small improvements Fam Zheng (12): VMDK: introduce VmdkExtent VMDK: bugfix, align offset to cluster in get_whole_cluster VMDK: probe for monolithicFlat images VMDK: separate vmdk_open by format version VMDK: add field BDRVVmdkState.desc_offset VMDK: flush multiple extents VMDK: move 'static' cid_update flag to bs field VMDK: change get_cluster_offset return type VMDK: open/read/write for monolithicFlat image VMDK: create different subformats VMDK: fix coding style block: add bdrv_get_allocated_file_size() operation block.c | 19 + block.h |1 + block/raw-posix.c | 21 + block/raw-win32.c | 29 ++ block/vmdk.c | 1296 - block_int.h |2 + qemu-img.c| 31 +-- 7 files changed, 964 insertions(+), 435 deletions(-) This doesn't build for me: cc1: warnings being treated as errors block/vmdk.c: In function 'vmdk_parse_extents': block/vmdk.c:482: error: format '%lld' expects type 'long long int *', but argument 4 has type 'int64_t *' block/vmdk.c:482: error: format '%lld' expects type 'long long int *', but argument 7 has type 'int64_t *' block/vmdk.c: In function 'vmdk_create_extent': block/vmdk.c:1024: error: invalid storage class for function 'filename_decompose' [...] The following patch makes it compile. I haven't tried figuring out which patches need to be fixed, but should be easy enough for you. Please resend only those patches that need to be changed, I have already merged everything (plus my fixup) and will only update it in the block branch. Kevin diff --git a/block/vmdk.c b/block/vmdk.c index 63d7605..37478d2 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -478,7 +478,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, * RW [size in sectors] SPARSE file-name.vmdk */ flat_offset = -1; -ret = sscanf(p, %10s %lld %10s %511s %lld, +ret = sscanf(p, %10s % SCNd64 %10s %511s % SCNd64, access, sectors, type, fname, flat_offset); if (ret 4 || strcmp(access, RW)) { goto next_line; @@ -927,6 +927,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, bool flat) 0644); if (fd 0) { return -errno; +} if (flat) { ret = ftruncate(fd, filesize); if (ret 0) {
Re: [Qemu-devel] [PATCH v9 00/12] Adding VMDK monolithic flat support
Hi, Resent [09/12] and [10/12]. On Mon, Jul 18, 2011 at 10:52 PM, Kevin Wolf kw...@redhat.com wrote: Am 12.07.2011 13:56, schrieb Fam Zheng: Changes from v8: 09/12: remove duplicated sscanf 10/12: change option name to 'subformat', change commit message typo, factor common parts of creating, and other small improvements Fam Zheng (12): VMDK: introduce VmdkExtent VMDK: bugfix, align offset to cluster in get_whole_cluster VMDK: probe for monolithicFlat images VMDK: separate vmdk_open by format version VMDK: add field BDRVVmdkState.desc_offset VMDK: flush multiple extents VMDK: move 'static' cid_update flag to bs field VMDK: change get_cluster_offset return type VMDK: open/read/write for monolithicFlat image VMDK: create different subformats VMDK: fix coding style block: add bdrv_get_allocated_file_size() operation block.c | 19 + block.h | 1 + block/raw-posix.c | 21 + block/raw-win32.c | 29 ++ block/vmdk.c | 1296 - block_int.h | 2 + qemu-img.c | 31 +-- 7 files changed, 964 insertions(+), 435 deletions(-) This doesn't build for me: cc1: warnings being treated as errors block/vmdk.c: In function 'vmdk_parse_extents': block/vmdk.c:482: error: format '%lld' expects type 'long long int *', but argument 4 has type 'int64_t *' block/vmdk.c:482: error: format '%lld' expects type 'long long int *', but argument 7 has type 'int64_t *' block/vmdk.c: In function 'vmdk_create_extent': block/vmdk.c:1024: error: invalid storage class for function 'filename_decompose' [...] The following patch makes it compile. I haven't tried figuring out which patches need to be fixed, but should be easy enough for you. Please resend only those patches that need to be changed, I have already merged everything (plus my fixup) and will only update it in the block branch. Kevin diff --git a/block/vmdk.c b/block/vmdk.c index 63d7605..37478d2 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -478,7 +478,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, * RW [size in sectors] SPARSE file-name.vmdk */ flat_offset = -1; - ret = sscanf(p, %10s %lld %10s %511s %lld, + ret = sscanf(p, %10s % SCNd64 %10s %511s % SCNd64, access, sectors, type, fname, flat_offset); if (ret 4 || strcmp(access, RW)) { goto next_line; @@ -927,6 +927,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, bool flat) 0644); if (fd 0) { return -errno; + } if (flat) { ret = ftruncate(fd, filesize); if (ret 0) { -- Best regards! Fam Zheng
[Qemu-devel] [PATCH v9 00/12] Adding VMDK monolithic flat support
Changes from v8: 09/12: remove duplicated sscanf 10/12: change option name to 'subformat', change commit message typo, factor common parts of creating, and other small improvements Fam Zheng (12): VMDK: introduce VmdkExtent VMDK: bugfix, align offset to cluster in get_whole_cluster VMDK: probe for monolithicFlat images VMDK: separate vmdk_open by format version VMDK: add field BDRVVmdkState.desc_offset VMDK: flush multiple extents VMDK: move 'static' cid_update flag to bs field VMDK: change get_cluster_offset return type VMDK: open/read/write for monolithicFlat image VMDK: create different subformats VMDK: fix coding style block: add bdrv_get_allocated_file_size() operation block.c | 19 + block.h |1 + block/raw-posix.c | 21 + block/raw-win32.c | 29 ++ block/vmdk.c | 1296 - block_int.h |2 + qemu-img.c| 31 +-- 7 files changed, 964 insertions(+), 435 deletions(-)