[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH v3 11/41] hw/xen: Use the BYTE-based definitions
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-trivial] [PATCH v3 11/41] hw/xen: Use the BYTE-based definitions |
Date: |
Sun, 15 Apr 2018 20:42:37 -0300 |
It eases code review, unit is explicit.
Patch generated using:
$ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/
and modified manually.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alan Robinson <address@hidden>
---
hw/block/xen_disk.c | 5 +++--
hw/i386/xen/xen-mapcache.c | 3 ++-
hw/xenpv/xen_domainbuild.c | 13 +++++++------
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index f74fcd42d1..c342106fd5 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -20,6 +20,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include <sys/ioctl.h>
#include <sys/uio.h>
@@ -1153,9 +1154,9 @@ static int blk_connect(struct XenDevice *xendev)
}
xen_pv_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\","
- " size %" PRId64 " (%" PRId64 " MB)\n",
+ " size %" PRId64 " (%llu MB)\n",
blkdev->type, blkdev->fileproto, blkdev->filename,
- blkdev->file_size, blkdev->file_size >> 20);
+ blkdev->file_size, blkdev->file_size / M_BYTE);
/* Fill in number of sector size and number of sectors */
xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk);
diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c
index efa35dc6e0..068347495c 100644
--- a/hw/i386/xen/xen-mapcache.c
+++ b/hw/i386/xen/xen-mapcache.c
@@ -9,6 +9,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "qemu/error-report.h"
#include <sys/resource.h>
@@ -47,7 +48,7 @@
* From empirical tests I observed that qemu use 75MB more than the
* max_mcache_size.
*/
-#define NON_MCACHE_MEMORY_SIZE (80 * 1024 * 1024)
+#define NON_MCACHE_MEMORY_SIZE (80 * M_BYTE)
typedef struct MapCacheEntry {
hwaddr paddr_index;
diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c
index 027f76fad1..4c77bb70a7 100644
--- a/hw/xenpv/xen_domainbuild.c
+++ b/hw/xenpv/xen_domainbuild.c
@@ -1,4 +1,5 @@
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "hw/xen/xen_backend.h"
#include "xen_domainbuild.h"
#include "qemu/timer.h"
@@ -75,9 +76,9 @@ int xenstore_domain_init1(const char *kernel, const char
*ramdisk,
xenstore_write_str(dom, "vm", vm);
/* memory */
- xenstore_write_int(dom, "memory/target", ram_size >> 10); // kB
- xenstore_write_int(vm, "memory", ram_size >> 20); // MB
- xenstore_write_int(vm, "maxmem", ram_size >> 20); // MB
+ xenstore_write_int(dom, "memory/target", ram_size / K_BYTE);
+ xenstore_write_int(vm, "memory", ram_size / M_BYTE);
+ xenstore_write_int(vm, "maxmem", ram_size / M_BYTE);
/* cpus */
for (i = 0; i < smp_cpus; i++) {
@@ -113,7 +114,7 @@ int xenstore_domain_init2(int xenstore_port, int
xenstore_mfn,
/* console */
xenstore_write_str(dom, "console/type", "ioemu");
- xenstore_write_int(dom, "console/limit", 128 * 1024);
+ xenstore_write_int(dom, "console/limit", 128 * K_BYTE);
xenstore_write_int(dom, "console/ring-ref", console_mfn);
xenstore_write_int(dom, "console/port", console_port);
xen_config_dev_console(0);
@@ -260,7 +261,7 @@ int xen_domain_build_pv(const char *kernel, const char
*ramdisk,
}
#endif
- rc = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size >> 10);
+ rc = xc_domain_setmaxmem(xen_xc, xen_domid, ram_size / K_BYTE);
if (rc < 0) {
fprintf(stderr, "xen: xc_domain_setmaxmem() failed\n");
goto err;
@@ -269,7 +270,7 @@ int xen_domain_build_pv(const char *kernel, const char
*ramdisk,
xenstore_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
console_port = xc_evtchn_alloc_unbound(xen_xc, xen_domid, 0);
- rc = xc_linux_build(xen_xc, xen_domid, ram_size >> 20,
+ rc = xc_linux_build(xen_xc, xen_domid, ram_size / M_BYTE,
kernel, ramdisk, cmdline,
0, flags,
xenstore_port, &xenstore_mfn,
--
2.17.0
- Re: [Qemu-trivial] [PATCH v3 01/41] hw: Clean "hw/devices.h" includes, (continued)
- [Qemu-trivial] [PATCH v3 02/41] hw: Do not include "sysemu/block-backend.h" if it is not necessary, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 03/41] hw/block/nvme: Include the "qemu/cutils.h" in the source file, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 04/41] hw/misc/mips_itu: Sort includes, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 05/41] hw/mips/r4k: Constify params_size, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 06/41] cutils: Extract byte-based definitions into a new header: "qemu/units.h", Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 07/41] hw/ivshmem: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 08/41] hw/ipack: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 09/41] hw/scsi: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 10/41] hw/smbios: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 11/41] hw/xen: Use the BYTE-based definitions,
Philippe Mathieu-Daudé <=
- [Qemu-trivial] [PATCH v3 12/41] hw/tpm: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 13/41] hw/block: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 15/41] hw/misc: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 16/41] hw/riscv: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 17/41] hw/m68k: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 18/41] hw/sparc: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 19/41] hw/s390x: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 21/41] hw/xtensa: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15
- [Qemu-trivial] [PATCH v3 22/41] hw/alpha: Use the BYTE-based definitions, Philippe Mathieu-Daudé, 2018/04/15