From nobody Mon Feb 9 11:34:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=trmm.net ARC-Seal: i=1; a=rsa-sha256; t=1601467251; cv=none; d=zohomail.com; s=zohoarc; b=NrdoChMxKql4UcUJbuTRhHVpjPBL7K6kqNKzmraR928+JBNWKN5JA3RrDBBhPuA4iC07VS4ZraPFI4A4UxYCHKlKE4Jw71i5HzRHac4al+J32hZYxx/xsOUbzsVwaR7noxqOdfNmi5n5UMS2As1Io6xX4w+m9AFILnIGetu3898= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601467251; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A6X4z/CEK+8iJd0N5ZKWan7465QO1HJEsGJ4v0baip4=; b=YYCOdOcZ/prz/KGiqdk/Y8pByaEzJRr45UUv5aNvGzlRilE8dnVpt+txudZQ3QRTW9x5nRivMDjRaflxLxd9Cm/kQlPggzlP1Jo/JIUvkpuxK27FsAu2/7N2imU8NJ2X+xL2kWFr/DHJTs3kKfMKOr2Y83B+vKLoyoMITieY7dg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1601467251869292.2807269022618; Wed, 30 Sep 2020 05:00:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.628.2101 (Exim 4.92) (envelope-from ) id 1kNami-0001jv-U2; Wed, 30 Sep 2020 12:00:36 +0000 Received: by outflank-mailman (output) from mailman id 628.2101; Wed, 30 Sep 2020 12:00:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNami-0001jn-Qo; Wed, 30 Sep 2020 12:00:36 +0000 Received: by outflank-mailman (input) for mailman id 628; Wed, 30 Sep 2020 12:00:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNamg-0001iP-P3 for xen-devel@lists.xenproject.org; Wed, 30 Sep 2020 12:00:34 +0000 Received: from mx1a.swcp.com (unknown [216.184.2.64]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 23989c6d-8ac6-42b3-8cb7-ddba8fb81831; Wed, 30 Sep 2020 12:00:33 +0000 (UTC) Received: from ame8.swcp.com (ame8.swcp.com [216.184.2.163]) by mx1a.swcp.com (8.14.4/8.14.4/Debian-4) with ESMTP id 08UC0VVc005378; Wed, 30 Sep 2020 06:00:31 -0600 Received: from diamond.fritz.box (62-251-112-184.ip.xs4all.nl [62.251.112.184]) by ame8.swcp.com (8.15.2/8.15.2) with ESMTP id 08UC0BdE003035; Wed, 30 Sep 2020 06:00:28 -0600 (MDT) (envelope-from hudson@trmm.net) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNamg-0001iP-P3 for xen-devel@lists.xenproject.org; Wed, 30 Sep 2020 12:00:34 +0000 Received: from mx1a.swcp.com (unknown [216.184.2.64]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 23989c6d-8ac6-42b3-8cb7-ddba8fb81831; Wed, 30 Sep 2020 12:00:33 +0000 (UTC) Received: from ame8.swcp.com (ame8.swcp.com [216.184.2.163]) by mx1a.swcp.com (8.14.4/8.14.4/Debian-4) with ESMTP id 08UC0VVc005378; Wed, 30 Sep 2020 06:00:31 -0600 Received: from diamond.fritz.box (62-251-112-184.ip.xs4all.nl [62.251.112.184]) by ame8.swcp.com (8.15.2/8.15.2) with ESMTP id 08UC0BdE003035; Wed, 30 Sep 2020 06:00:28 -0600 (MDT) (envelope-from hudson@trmm.net) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 23989c6d-8ac6-42b3-8cb7-ddba8fb81831 Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: neutral (ame8.swcp.com: 62.251.112.184 is neither permitted nor denied by domain of hudson@trmm.net) receiver=ame8.swcp.com; client-ip=62.251.112.184; helo=diamond.fritz.box; envelope-from=hudson@trmm.net; x-software=spfmilter 2.001 http://www.acme.com/software/spfmilter/ with libspf2-1.2.10; X-Authentication-Warning: ame8.swcp.com: Host 62-251-112-184.ip.xs4all.nl [62.251.112.184] claimed to be diamond.fritz.box From: Trammell Hudson To: xen-devel@lists.xenproject.org Cc: roger.pau@citrix.com, jbeulich@suse.com, andrew.cooper3@citrix.com, wl@xen.org Subject: [PATCH v8 3/5] efi/boot.c: wrap PrintStr/PrintErr to allow const CHAR16* arguments Date: Wed, 30 Sep 2020 08:00:09 -0400 Message-Id: <20200930120011.1622924-4-hudson@trmm.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200930120011.1622924-1-hudson@trmm.net> References: <20200930120011.1622924-1-hudson@trmm.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.6.2 (ame8.swcp.com [216.184.2.128]); Wed, 30 Sep 2020 06:00:30 -0600 (MDT) X-Virus-Scanned: clamav-milter 0.99.2 at ame8 X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ame8.swcp.com X-Spam-Status: No, hits=0.7 tests=NO_RECEIVED,NO_RELAYS,SPF_NEUTRAL version=3.4.1 X-Spam-Level: Content-Type: text/plain; charset="utf-8" This patch wraps the EFI OutputString() method so that they can be called with const arguments. The OutputString method does not modify its argument, although the prototype is missing const, so it is necssary to cast away the const when calling it. It also updates callers of PrintStr/PrintErr to remove unneeded un-const ca= sts. Signed-off-by: Trammell Hudson Reviewed-by: Jan Beulich --- xen/common/efi/boot.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 93cfeba7e1..bd629eb658 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -151,10 +151,17 @@ static struct file __initdata cfg; static struct file __initdata kernel; static struct file __initdata ramdisk; static struct file __initdata xsm; -static CHAR16 __initdata newline[] =3D L"\r\n"; +static const CHAR16 __initconst newline[] =3D L"\r\n"; =20 -#define PrintStr(s) StdOut->OutputString(StdOut, s) -#define PrintErr(s) StdErr->OutputString(StdErr, s) +static void __init PrintStr(const CHAR16 *s) +{ + StdOut->OutputString(StdOut, (CHAR16 *)s ); +} + +static void __init PrintErr(const CHAR16 *s) +{ + StdErr->OutputString(StdErr, (CHAR16 *)s ); +} =20 /* * Include architecture specific implementation here, which references the @@ -275,7 +282,7 @@ static bool __init match_guid(const EFI_GUID *guid1, co= nst EFI_GUID *guid2) void __init noreturn blexit(const CHAR16 *str) { if ( str ) - PrintStr((CHAR16 *)str); + PrintStr(str); PrintStr(newline); =20 if ( !efi_bs ) @@ -316,7 +323,7 @@ static void __init PrintErrMesg(const CHAR16 *mesg, EFI= _STATUS ErrCode) EFI_STATUS ErrIdx =3D ErrCode & ~EFI_ERROR_MASK; =20 StdOut =3D StdErr; - PrintErr((CHAR16 *)mesg); + PrintErr(mesg); PrintErr(L": "); =20 if( (ErrIdx < ARRAY_SIZE(ErrCodeToStr)) && ErrCodeToStr[ErrIdx] ) @@ -540,7 +547,7 @@ static char * __init split_string(char *s) return NULL; } =20 -static void __init handle_file_info(CHAR16 *name, +static void __init handle_file_info(const CHAR16 *name, const struct file *file, const char *o= ptions) { if ( file =3D=3D &cfg ) @@ -562,7 +569,7 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle= , CHAR16 *name, EFI_FILE_HANDLE FileHandle =3D NULL; UINT64 size; EFI_STATUS ret; - CHAR16 *what =3D NULL; + const CHAR16 *what =3D NULL; =20 if ( !name ) PrintErrMesg(L"No filename", EFI_OUT_OF_RESOURCES); --=20 2.25.1