From patchwork Mon Mar 5 19:24:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10259569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 56F5D60134 for ; Mon, 5 Mar 2018 19:25:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4749C1FF65 for ; Mon, 5 Mar 2018 19:25:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C0D1204C3; Mon, 5 Mar 2018 19:25:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8FDD1FFB2 for ; Mon, 5 Mar 2018 19:25:21 +0000 (UTC) Received: from localhost ([::1]:51158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esvjc-0001i6-3l for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Mar 2018 14:25:20 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 { static ResetInfo save; +const uint8_t el_torito_magic[] = "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[] = "\x02\x00\x00\x18\x60\x00\x00\x50\x02\x00" + "\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40" + "\x40\x40\x40\x40"; + +static const uint8_t vol_desc_magic[] = "CD001"; + +static inline bool is_iso_vd_valid(IsoVolDesc *vd) +{ + const uint8_t vol_desc_magic[] = "CD001"; + + return !memcmp(&vd->ident[0], vol_desc_magic, 5) && + vd->version == 0x1 && + vd->type <= VOL_DESC_TYPE_PARTITION; +} + static void jump_to_IPL_2(void) { ResetInfo *current = 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_offset, void *load_addr, "Failed to read boot image!"); } -const uint8_t el_torito_magic[] = "EL TORITO SPECIFICATION" - "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - #define ISO9660_MAX_DIR_DEPTH 8 typedef struct IsoDirHdr { @@ -430,20 +427,12 @@ typedef struct IsoVolDesc { } vd; } __attribute__((packed)) IsoVolDesc; -const uint8_t vol_desc_magic[] = "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 -static inline bool is_iso_vd_valid(IsoVolDesc *vd) -{ - return !memcmp(&vd->ident[0], vol_desc_magic, 5) && - vd->version == 0x1 && - vd->type <= 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; -/* - * Match two CCWs located after PSW and eight filler bytes. - * From libmagic and arch/s390/kernel/head.S. - */ -const uint8_t linux_s390_magic[] = "\x02\x00\x00\x18\x60\x00\x00\x50\x02\x00" - "\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40" - "\x40\x40\x40\x40"; - typedef struct IsoBcEntry { uint8_t id; union {