diff mbox series

[03/13] tests/pflash-cfi02: Use IEC binary prefixes for size constants

Message ID 20190505221544.31568-4-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw/block/pflash_cfi02: Clean-up and fixes | expand

Commit Message

Philippe Mathieu-Daudé May 5, 2019, 10:15 p.m. UTC
Using IEC binary prefixes in order to make the code more readable.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/pflash-cfi02-test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tests/pflash-cfi02-test.c b/tests/pflash-cfi02-test.c
index ff775618c02..3c37465499a 100644
--- a/tests/pflash-cfi02-test.c
+++ b/tests/pflash-cfi02-test.c
@@ -8,6 +8,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "libqtest.h"
 
 /*
@@ -16,7 +17,7 @@ 
  * all. In particular, we're limited to a 16-bit wide flash device.
  */
 
-#define MP_FLASH_SIZE_MAX (32 * 1024 * 1024)
+#define MP_FLASH_SIZE_MAX (32 * MiB)
 #define BASE_ADDR (0x100000000ULL - MP_FLASH_SIZE_MAX)
 
 #define FLASH_WIDTH 2
@@ -205,7 +206,7 @@  int main(int argc, char **argv)
     char *image_path;
     int fd = g_file_open_tmp("pflash-cfi02-XXXXXX.raw", &image_path, &error);
     g_assert_no_error(error);
-    if (ftruncate(fd, 8 * 1024 * 1024) < 0) {
+    if (ftruncate(fd, 8 * MiB) < 0) {
         g_printerr("Failed to truncate file %s to 8 MB: %s\n", image_path,
                    strerror(errno));
         close(fd);