Patchwork [v9,00/12] Adding VMDK monolithic flat support

login
register
mail settings
Submitter Kevin Wolf
Date July 18, 2011, 2:52 p.m.
Message ID <4E2448C3.4030101@redhat.com>
Download mbox | patch
Permalink /patch/105292/
State New
Headers show

Comments

Kevin Wolf - July 18, 2011, 2:52 p.m.
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


             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) {
Feiran Zheng - July 19, 2011, 12:47 a.m.
Hi,

Resent [09/12] and [10/12].

On Mon, Jul 18, 2011 at 10:52 PM, Kevin Wolf <kwolf@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) {
>

Patch

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")) {