From 076b35b5a56bca57c4aa41044ed304fe9c45d6c5 Mon Sep 17 00:00:00 2001 From: Nikunj A Dadhania Date: Thu, 7 May 2015 15:33:57 +1000 Subject: machine: add default_ram_size to machine class Machines types can have different requirement for default ram size. Introduce a member in the machine class and set the current default_ram_size to 128MB. For QEMUMachine types override the value during the registration of the machine and for MachineClass introduce the generic class init setting the default_ram_size. Add helpers [K,M,G,T,P,E]_BYTE for better readability and easy usage Signed-off-by: Nikunj A Dadhania Reviewed-by: Thomas Huth Reviewed-by: David Gibson Acked-by: Paolo Bonzini Signed-off-by: David Gibson Signed-off-by: Alexander Graf --- include/hw/boards.h | 1 + include/qemu-common.h | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'include') diff --git a/include/hw/boards.h b/include/hw/boards.h index ff79797..6379901 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -106,6 +106,7 @@ struct MachineClass { const char *default_display; GlobalProperty *compat_props; const char *hw_version; + ram_addr_t default_ram_size; HotplugHandler *(*get_hotplug_handler)(MachineState *machine, DeviceState *dev); diff --git a/include/qemu-common.h b/include/qemu-common.h index 6b373ff..d52d09c 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -186,6 +186,12 @@ int64_t strtosz(const char *nptr, char **end); int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix); int64_t strtosz_suffix_unit(const char *nptr, char **end, const char default_suffix, int64_t unit); +#define K_BYTE (1ULL << 10) +#define M_BYTE (1ULL << 20) +#define G_BYTE (1ULL << 30) +#define T_BYTE (1ULL << 40) +#define P_BYTE (1ULL << 50) +#define E_BYTE (1ULL << 60) /* used to print char* safely */ #define STR_OR_NULL(str) ((str) ? (str) : "null") -- cgit v1.1