From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQS6Z-0000Yg-2P for qemu-devel@nongnu.org; Wed, 19 Mar 2014 21:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQS6R-00042r-Up for qemu-devel@nongnu.org; Wed, 19 Mar 2014 21:49:10 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 20 Mar 2014 02:48:50 +0100 Message-Id: <1395280135-10644-9-git-send-email-afaerber@suse.de> In-Reply-To: <1395280135-10644-1-git-send-email-afaerber@suse.de> References: <1395280135-10644-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.0 08/13] vl.c: Extend get_boot_devices_list() to ignore suffixes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori From: Alexey Kardashevskiy As suffixes do not make sense for sPAPR's device tree and there is no way to filter them out on the BusState::get_fw_dev_path() level, let's add an ability for the external caller to specify whether to apply suffixes or not. We could handle suffixes in SLOF (ignored for now) but this would require serious rework in the node opening code in SLOF, which has no obvious benefit for the currently emulated sPAPR machine. Signed-off-by: Alexey Kardashevskiy Signed-off-by: Andreas F=C3=A4rber --- hw/nvram/fw_cfg.c | 2 +- include/sysemu/sysemu.h | 2 +- vl.c | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index cb36dc2..282341a 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -504,7 +504,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, = void *data) { size_t len; FWCfgState *s =3D container_of(n, FWCfgState, machine_ready); - char *bootindex =3D get_boot_devices_list(&len); + char *bootindex =3D get_boot_devices_list(&len, false); =20 fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len); } diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index c01304d..3915ce3 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -186,7 +186,7 @@ void rtc_change_mon_event(struct tm *tm); =20 void add_boot_device_path(int32_t bootindex, DeviceState *dev, const char *suffix); -char *get_boot_devices_list(size_t *size); +char *get_boot_devices_list(size_t *size, bool ignore_suffixes); =20 DeviceState *get_boot_device(uint32_t position); =20 diff --git a/vl.c b/vl.c index f0fe48b..1adc8f4 100644 --- a/vl.c +++ b/vl.c @@ -1209,7 +1209,7 @@ DeviceState *get_boot_device(uint32_t position) * memory pointed by "size" is assigned total length of the array in byt= es * */ -char *get_boot_devices_list(size_t *size) +char *get_boot_devices_list(size_t *size, bool ignore_suffixes) { FWBootEntry *i; size_t total =3D 0; @@ -1224,7 +1224,7 @@ char *get_boot_devices_list(size_t *size) assert(devpath); } =20 - if (i->suffix && devpath) { + if (i->suffix && !ignore_suffixes && devpath) { size_t bootpathlen =3D strlen(devpath) + strlen(i->suffix) += 1; =20 bootpath =3D g_malloc(bootpathlen); @@ -1232,9 +1232,11 @@ char *get_boot_devices_list(size_t *size) g_free(devpath); } else if (devpath) { bootpath =3D devpath; - } else { + } else if (!ignore_suffixes) { assert(i->suffix); bootpath =3D g_strdup(i->suffix); + } else { + bootpath =3D g_strdup(""); } =20 if (total) { --=20 1.8.4.5