qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] [PATCH 03/13] tests/pflash-cfi02: Use IEC binary prefixes f


From: Philippe Mathieu-Daudé
Subject: [Qemu-block] [PATCH 03/13] tests/pflash-cfi02: Use IEC binary prefixes for size constants
Date: Mon, 6 May 2019 00:15:34 +0200

Using IEC binary prefixes in order to make the code more readable.

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

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);
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]