From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqHop-00068H-Bx for qemu-devel@nongnu.org; Tue, 10 Dec 2013 02:33:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqHof-0000bw-K5 for qemu-devel@nongnu.org; Tue, 10 Dec 2013 02:33:23 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:42205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqHoe-0000bI-SO for qemu-devel@nongnu.org; Tue, 10 Dec 2013 02:33:13 -0500 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Dec 2013 17:32:51 +1000 From: Alexey Kardashevskiy Date: Tue, 10 Dec 2013 18:32:33 +1100 Message-Id: <1386660757-7505-2-git-send-email-aik@ozlabs.ru> In-Reply-To: <1386660757-7505-1-git-send-email-aik@ozlabs.ru> References: <1386660757-7505-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH v3 1/5] boot: 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 , Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , =?UTF-8?q?Andreas=20F=C3=A4rber?= 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. Signed-off-by: Alexey Kardashevskiy --- hw/nvram/fw_cfg.c | 2 +- include/sysemu/sysemu.h | 2 +- vl.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index f5dc3ea..4d0c76f 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 = container_of(n, FWCfgState, machine_ready); - char *bootindex = get_boot_devices_list(&len); + char *bootindex = get_boot_devices_list(&len, false); fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len); } diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 495dae8..2b71a4a 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -185,7 +185,7 @@ void rtc_change_mon_event(struct tm *tm); 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); DeviceState *get_boot_device(uint32_t position); diff --git a/vl.c b/vl.c index 8d5d874..aefc11a 100644 --- a/vl.c +++ b/vl.c @@ -1211,7 +1211,7 @@ DeviceState *get_boot_device(uint32_t position) * memory pointed by "size" is assigned total length of the array in bytes * */ -char *get_boot_devices_list(size_t *size) +char *get_boot_devices_list(size_t *size, bool ignore_suffixes) { FWBootEntry *i; size_t total = 0; @@ -1226,7 +1226,7 @@ char *get_boot_devices_list(size_t *size) assert(devpath); } - if (i->suffix && devpath) { + if (i->suffix && !ignore_suffixes && devpath) { size_t bootpathlen = strlen(devpath) + strlen(i->suffix) + 1; bootpath = g_malloc(bootpathlen); @@ -1234,7 +1234,7 @@ char *get_boot_devices_list(size_t *size) g_free(devpath); } else if (devpath) { bootpath = devpath; - } else { + } else if (!ignore_suffixes) { assert(i->suffix); bootpath = g_strdup(i->suffix); } -- 1.8.4.rc4