From nobody Fri Oct 24 21:49:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152027794254273.61272443558732; Mon, 5 Mar 2018 11:25:42 -0800 (PST) Received: from localhost ([::1]:51158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esvjw-0001i6-RK for importer@patchew.org; Mon, 05 Mar 2018 14:25:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esvj1-0001Cy-Ae for qemu-devel@nongnu.org; Mon, 05 Mar 2018 14:24:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esviy-0002l6-Mg for qemu-devel@nongnu.org; Mon, 05 Mar 2018 14:24:43 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52576 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1esviy-0002kl-H8; Mon, 05 Mar 2018 14:24:40 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BF3BEAE91; Mon, 5 Mar 2018 19:24:39 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0F3910FFE71; Mon, 5 Mar 2018 19:24:33 +0000 (UTC) From: Thomas Huth To: qemu-s390x@nongnu.org, Christian Borntraeger Date: Mon, 5 Mar 2018 20:24:26 +0100 Message-Id: <1520277866-4360-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 05 Mar 2018 19:24:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 05 Mar 2018 19:24:39 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] pc-bios/s390-ccw: Move string arrays from bootmap header to .c file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" bootmap.h currently can only be included once - otherwise the linker complains about multiple definitions of the "magic" strings. It's a bad style to define string arrays in header files, so let's better move these to the bootmap.c file instead where they are used. Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/bootmap.c | 22 ++++++++++++++++++++++ pc-bios/s390-ccw/bootmap.h | 19 ------------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 29bfd8c..5e0be54 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -37,6 +37,28 @@ typedef struct ResetInfo { =20 static ResetInfo save; =20 +const uint8_t el_torito_magic[] =3D "EL TORITO SPECIFICATION" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + +/* + * Match two CCWs located after PSW and eight filler bytes. + * From libmagic and arch/s390/kernel/head.S. + */ +const uint8_t linux_s390_magic[] =3D "\x02\x00\x00\x18\x60\x00\x00\x50\x02= \x00" + "\x00\x68\x60\x00\x00\x50\x40\x40\x40\x= 40" + "\x40\x40\x40\x40"; + +static const uint8_t vol_desc_magic[] =3D "CD001"; + +static inline bool is_iso_vd_valid(IsoVolDesc *vd) +{ + const uint8_t vol_desc_magic[] =3D "CD001"; + + return !memcmp(&vd->ident[0], vol_desc_magic, 5) && + vd->version =3D=3D 0x1 && + vd->type <=3D VOL_DESC_TYPE_PARTITION; +} + static void jump_to_IPL_2(void) { ResetInfo *current =3D 0; diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h index c636626..07eb600 100644 --- a/pc-bios/s390-ccw/bootmap.h +++ b/pc-bios/s390-ccw/bootmap.h @@ -375,9 +375,6 @@ static inline void read_iso_boot_image(uint32_t block_o= ffset, void *load_addr, "Failed to read boot image!"); } =20 -const uint8_t el_torito_magic[] =3D "EL TORITO SPECIFICATION" - "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - #define ISO9660_MAX_DIR_DEPTH 8 =20 typedef struct IsoDirHdr { @@ -430,20 +427,12 @@ typedef struct IsoVolDesc { } vd; } __attribute__((packed)) IsoVolDesc; =20 -const uint8_t vol_desc_magic[] =3D "CD001"; #define VOL_DESC_TYPE_BOOT 0 #define VOL_DESC_TYPE_PRIMARY 1 #define VOL_DESC_TYPE_SUPPLEMENT 2 #define VOL_DESC_TYPE_PARTITION 3 #define VOL_DESC_TERMINATOR 255 =20 -static inline bool is_iso_vd_valid(IsoVolDesc *vd) -{ - return !memcmp(&vd->ident[0], vol_desc_magic, 5) && - vd->version =3D=3D 0x1 && - vd->type <=3D VOL_DESC_TYPE_PARTITION; -} - typedef struct IsoBcValid { uint8_t platform_id; uint16_t reserved; @@ -468,14 +457,6 @@ typedef struct IsoBcHdr { uint8_t id[28]; } __attribute__((packed)) IsoBcHdr; =20 -/* - * Match two CCWs located after PSW and eight filler bytes. - * From libmagic and arch/s390/kernel/head.S. - */ -const uint8_t linux_s390_magic[] =3D "\x02\x00\x00\x18\x60\x00\x00\x50\x02= \x00" - "\x00\x68\x60\x00\x00\x50\x40\x40\x40\x= 40" - "\x40\x40\x40\x40"; - typedef struct IsoBcEntry { uint8_t id; union { --=20 1.8.3.1