diff mbox series

[v4,02/40] vdi: Use definitions from "qemu/units.h"

Message ID 20180611011501.10235-3-f4bug@amsat.org
State New
Headers show
Series Use the IEC binary prefix definitions | expand

Commit Message

Philippe Mathieu-Daudé June 11, 2018, 1:14 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 block/vdi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Stefan Weil June 11, 2018, 7:27 p.m. UTC | #1
Am 11.06.2018 um 03:14 schrieb Philippe Mathieu-Daudé:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  block/vdi.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/block/vdi.c b/block/vdi.c
> index 668af0a828..35b51dc5c5 100644
> --- a/block/vdi.c
> +++ b/block/vdi.c
> @@ -50,6 +50,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/units.h"
>  #include "qapi/error.h"
>  #include "qapi/qmp/qdict.h"
>  #include "qapi/qobject-input-visitor.h"
> @@ -83,9 +84,6 @@
>  /* Command line option for static images. */
>  #define BLOCK_OPT_STATIC "static"
>  
> -#define KiB     1024
> -#define MiB     (KiB * KiB)
> -
>  #define SECTOR_SIZE 512
>  #define DEFAULT_CLUSTER_SIZE (1 * MiB)
>  
> @@ -250,7 +248,7 @@ static void vdi_header_print(VdiHeader *header)
>      logout("heads       0x%04x\n", header->heads);
>      logout("sectors     0x%04x\n", header->sectors);
>      logout("sector size 0x%04x\n", header->sector_size);
> -    logout("image size  0x%" PRIx64 " B (%" PRIu64 " MiB)\n",
> +    logout("image size  0x%" PRIx64 " B (%llu MiB)\n",
>             header->disk_size, header->disk_size / MiB);
>      logout("block size  0x%04x\n", header->block_size);
>      logout("block extra 0x%04x\n", header->block_extra);
> @@ -434,7 +432,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
>          goto fail;
>      } else if (header.block_size != DEFAULT_CLUSTER_SIZE) {
>          error_setg(errp, "unsupported VDI image (block size %" PRIu32
> -                   " is not %u)", header.block_size, DEFAULT_CLUSTER_SIZE);
> +                   " is not %llu)", header.block_size, DEFAULT_CLUSTER_SIZE);
>          ret = -ENOTSUP;
>          goto fail;
>      } else if (header.disk_size >
> 

Reviewed-by: Stefan Weil <sw@weilnetz.de>
diff mbox series

Patch

diff --git a/block/vdi.c b/block/vdi.c
index 668af0a828..35b51dc5c5 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -50,6 +50,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qobject-input-visitor.h"
@@ -83,9 +84,6 @@ 
 /* Command line option for static images. */
 #define BLOCK_OPT_STATIC "static"
 
-#define KiB     1024
-#define MiB     (KiB * KiB)
-
 #define SECTOR_SIZE 512
 #define DEFAULT_CLUSTER_SIZE (1 * MiB)
 
@@ -250,7 +248,7 @@  static void vdi_header_print(VdiHeader *header)
     logout("heads       0x%04x\n", header->heads);
     logout("sectors     0x%04x\n", header->sectors);
     logout("sector size 0x%04x\n", header->sector_size);
-    logout("image size  0x%" PRIx64 " B (%" PRIu64 " MiB)\n",
+    logout("image size  0x%" PRIx64 " B (%llu MiB)\n",
            header->disk_size, header->disk_size / MiB);
     logout("block size  0x%04x\n", header->block_size);
     logout("block extra 0x%04x\n", header->block_extra);
@@ -434,7 +432,7 @@  static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     } else if (header.block_size != DEFAULT_CLUSTER_SIZE) {
         error_setg(errp, "unsupported VDI image (block size %" PRIu32
-                   " is not %u)", header.block_size, DEFAULT_CLUSTER_SIZE);
+                   " is not %llu)", header.block_size, DEFAULT_CLUSTER_SIZE);
         ret = -ENOTSUP;
         goto fail;
     } else if (header.disk_size >