-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
patch-unified-0004-efi-boot-wrap-PrintStr-PrintErr-to-allow-const-CHAR1.patch
72 lines (62 loc) · 2.3 KB
/
patch-unified-0004-efi-boot-wrap-PrintStr-PrintErr-to-allow-const-CHAR1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From eddba9934a842dca7e60b84c116a065ea0ec4e70 Mon Sep 17 00:00:00 2001
From: Trammell Hudson <hudson@trmm.net>
Date: Wed, 30 Sep 2020 09:14:18 +0200
Subject: [PATCH 04/10] efi/boot: wrap PrintStr/PrintErr to allow const CHAR16*
arguments
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.
Signed-off-by: Trammell Hudson <hudson@trmm.net>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
xen/common/efi/boot.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 840387f80e..3ebe459651 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[] = L"\r\n";
+static const CHAR16 __initconst newline[] = L"\r\n";
-#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 );
+}
#ifdef CONFIG_ARM
/*
@@ -325,7 +332,7 @@ static bool __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2)
static void __init noreturn blexit(const CHAR16 *str)
{
if ( str )
- PrintStr((CHAR16 *)str);
+ PrintStr(str);
PrintStr(newline);
if ( !efi_bs )
@@ -366,7 +373,7 @@ static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
EFI_STATUS ErrIdx = ErrCode & ~EFI_ERROR_MASK;
StdOut = StdErr;
- PrintErr((CHAR16 *)mesg);
+ PrintErr(mesg);
PrintErr(L": ");
if( (ErrIdx < ARRAY_SIZE(ErrCodeToStr)) && ErrCodeToStr[ErrIdx] )
@@ -596,7 +603,7 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
EFI_FILE_HANDLE FileHandle = NULL;
UINT64 size;
EFI_STATUS ret;
- CHAR16 *what = NULL;
+ const CHAR16 *what = NULL;
if ( !name )
PrintErrMesg(L"No filename", EFI_OUT_OF_RESOURCES);
--
2.25.1