From: Roy Franz <roy.franz@linaro.org>
To: xen-devel@lists.xen.org, ian.campbell@citrix.com,
stefano.stabellini@citrix.com, tim@xen.org, jbeulich@suse.com,
keir@xen.org
Cc: Roy Franz <roy.franz@linaro.org>,
fu.wei@linaro.org, linaro-uefi@lists.linaro.org
Subject: [PATCH V2 02/12] rename printErrMsg to PrintErrMesgExit
Date: Mon, 21 Jul 2014 17:43:25 -0700 [thread overview]
Message-ID: <1405989815-25236-3-git-send-email-roy.franz@linaro.org> (raw)
In-Reply-To: <1405989815-25236-1-git-send-email-roy.franz@linaro.org>
The function prints an error message, then exits the program.
Add PrintErrMesg that doesn't exit.
Signed-off-by: Roy Franz <roy.franz@linaro.org>
---
xen/arch/x86/efi/boot.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/xen/arch/x86/efi/boot.c b/xen/arch/x86/efi/boot.c
index 2b6bea3..849dc2d 100644
--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -92,7 +92,7 @@ static void __init noreturn blexit(const CHAR16 *str)
}
/* generic routine for printing error messages */
-static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
+void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
{
StdOut = StdErr;
PrintErr((CHAR16 *)mesg);
@@ -139,6 +139,12 @@ static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
mesg = NULL;
break;
}
+}
+
+/* generic routine for printing error messages */
+static void __init PrintErrMesgExit(const CHAR16 *mesg, EFI_STATUS ErrCode)
+{
+ PrintErrMesg(mesg, ErrCode);
blexit(mesg);
}
@@ -231,12 +237,12 @@ static EFI_FILE_HANDLE __init get_parent_handle(EFI_LOADED_IMAGE *loaded_image,
ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
&fs_protocol, (void **)&fio);
if ( EFI_ERROR(ret) )
- PrintErrMesg(L"Couldn't obtain the File System Protocol Interface",
+ PrintErrMesgExit(L"Couldn't obtain the File System Protocol Interface",
ret);
ret = fio->OpenVolume(fio, &dir_handle);
} while ( ret == EFI_MEDIA_CHANGED );
if ( ret != EFI_SUCCESS )
- PrintErrMesg(L"OpenVolume failure", ret);
+ PrintErrMesgExit(L"OpenVolume failure", ret);
#define buffer ((CHAR16 *)keyhandler_scratch)
#define BUFFERSIZE sizeof(keyhandler_scratch)
@@ -259,7 +265,7 @@ static EFI_FILE_HANDLE __init get_parent_handle(EFI_LOADED_IMAGE *loaded_image,
if ( ret != EFI_SUCCESS )
{
PrintErr(L"Open failed for ");
- PrintErrMesg(buffer, ret);
+ PrintErrMesgExit(buffer, ret);
}
dir_handle->Close(dir_handle);
dir_handle = new_handle;
@@ -286,7 +292,7 @@ static EFI_FILE_HANDLE __init get_parent_handle(EFI_LOADED_IMAGE *loaded_image,
EFI_FILE_MODE_READ, 0);
if ( ret != EFI_SUCCESS ) {
PrintErr(L"Open failed for ");
- PrintErrMesg(buffer, ret);
+ PrintErrMesgExit(buffer, ret);
}
dir_handle->Close(dir_handle);
dir_handle = new_handle;
@@ -326,7 +332,7 @@ static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
CHAR16 *what = NULL;
if ( !name )
- PrintErrMesg(L"No filename", EFI_OUT_OF_RESOURCES);
+ PrintErrMesgExit(L"No filename", EFI_OUT_OF_RESOURCES);
ret = dir_handle->Open(dir_handle, &FileHandle, name,
EFI_FILE_MODE_READ, 0);
if ( file == &cfg && ret == EFI_NOT_FOUND )
@@ -387,7 +393,7 @@ static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
{
PrintErr(what);
PrintErr(L" failed for ");
- PrintErrMesg(name, ret);
+ PrintErrMesgExit(name, ret);
}
return 1;
@@ -466,7 +472,7 @@ static void __init edd_put_string(u8 *dst, size_t n, const char *src)
while ( n-- && *src )
*dst++ = *src++;
if ( *src )
- PrintErrMesg(L"Internal error populating EDD info",
+ PrintErrMesgExit(L"Internal error populating EDD info",
EFI_BUFFER_TOO_SMALL);
while ( n-- )
*dst++ = ' ';
@@ -688,7 +694,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
status = efi_bs->HandleProtocol(ImageHandle, &loaded_image_guid,
(void **)&loaded_image);
if ( status != EFI_SUCCESS )
- PrintErrMesg(L"No Loaded Image Protocol", status);
+ PrintErrMesgExit(L"No Loaded Image Protocol", status);
xen_phys_start = (UINTN)loaded_image->ImageBase;
if ( (xen_phys_start + loaded_image->ImageSize - 1) >> 32 )
@@ -856,7 +862,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
(void **)&shim_lock)) &&
(status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
- PrintErrMesg(L"Dom0 kernel image could not be verified", status);
+ PrintErrMesgExit(L"Dom0 kernel image could not be verified", status);
name.s = get_value(&cfg, section.s, "ramdisk");
if ( name.s )
@@ -1277,7 +1283,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
&efi_mdesc_size, &mdesc_ver);
if ( EFI_ERROR(status) )
- PrintErrMesg(L"Cannot obtain memory map", status);
+ PrintErrMesgExit(L"Cannot obtain memory map", status);
/* Populate E820 table and check trampoline area availability. */
e = e820map - 1;
@@ -1337,7 +1343,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
status = efi_bs->ExitBootServices(ImageHandle, map_key);
if ( EFI_ERROR(status) )
- PrintErrMesg(L"Cannot exit boot services", status);
+ PrintErrMesgExit(L"Cannot exit boot services", status);
/* Adjust pointers into EFI. */
efi_ct = (void *)efi_ct + DIRECTMAP_VIRT_START;
--
2.0.0
next prev parent reply other threads:[~2014-07-22 0:43 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 0:43 [PATCH V2 00/12] arm64 EFI stub Roy Franz
2014-07-22 0:43 ` [PATCH V2 01/12] Create efi-shared.[ch], and move string functions Roy Franz
2014-07-23 16:31 ` Jan Beulich
2014-07-28 15:41 ` Ian Campbell
2014-07-28 15:52 ` Jan Beulich
2014-07-28 15:56 ` Ian Campbell
2014-07-28 16:00 ` Jan Beulich
2014-07-28 16:04 ` Ian Campbell
2014-07-28 16:10 ` Jan Beulich
2014-08-06 23:55 ` Roy Franz
2014-08-07 6:17 ` Jan Beulich
2014-08-09 0:27 ` Roy Franz
2014-08-06 23:42 ` Roy Franz
2014-07-22 0:43 ` Roy Franz [this message]
2014-07-23 16:33 ` [PATCH V2 02/12] rename printErrMsg to PrintErrMesgExit Jan Beulich
2014-07-22 0:43 ` [PATCH V2 03/12] Refactor get_parent_handle for sharing Roy Franz
2014-07-23 16:37 ` Jan Beulich
2014-07-22 0:43 ` [PATCH V2 04/12] Refactor read_file() so it can be shared Roy Franz
2014-07-24 7:09 ` Jan Beulich
2014-08-06 18:38 ` Roy Franz
2014-08-07 6:20 ` Jan Beulich
2014-08-07 17:26 ` Roy Franz
2014-07-22 0:43 ` [PATCH V2 05/12] replace split_value() with truncate_string() Roy Franz
2014-07-24 7:19 ` Jan Beulich
2014-08-06 22:37 ` Roy Franz
2014-08-07 6:24 ` Jan Beulich
2014-08-18 23:38 ` Roy Franz
2014-08-19 12:56 ` Jan Beulich
2014-07-22 0:43 ` [PATCH V2 06/12] add read_config_file() function for XEN EFI config file Roy Franz
2014-07-24 7:32 ` Jan Beulich
2014-08-06 22:42 ` Roy Franz
2014-07-22 0:43 ` [PATCH V2 07/12] create handle_cmdline() function Roy Franz
2014-07-24 7:36 ` Jan Beulich
2014-07-28 15:44 ` Ian Campbell
2014-07-28 15:57 ` Jan Beulich
2014-07-22 0:43 ` [PATCH V2 08/12] Refactor get_argv() for sharing Roy Franz
2014-07-24 7:38 ` Jan Beulich
2014-07-22 0:43 ` [PATCH V2 09/12] Move shared EFI functions to efi-shared.c Roy Franz
2014-07-22 0:43 ` [PATCH V2 10/12] add arm64 cache flushing code from linux Roy Franz
2014-07-28 15:53 ` Ian Campbell
2014-07-28 16:24 ` Ian Campbell
2014-07-22 0:43 ` [PATCH V2 11/12] Add fdt_create_empty_tree() function Roy Franz
2014-07-22 16:36 ` [Linaro-uefi] " Julien Grall
2014-07-22 17:12 ` Roy Franz
2014-07-22 17:15 ` Julien Grall
2014-07-23 9:58 ` Ian Campbell
2014-07-23 16:15 ` Roy Franz
2014-07-22 0:43 ` [PATCH V2 12/12] Add EFI stub for arm64 Roy Franz
2014-07-29 9:46 ` Ian Campbell
2014-07-28 15:30 ` [PATCH V2 00/12] arm64 EFI stub Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405989815-25236-3-git-send-email-roy.franz@linaro.org \
--to=roy.franz@linaro.org \
--cc=fu.wei@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=linaro-uefi@lists.linaro.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).