From patchwork Tue Jul 22 00:43:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 34017 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CD6E520492 for ; Tue, 22 Jul 2014 00:46:23 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id 29sf26329808yhl.2 for ; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=kWE2nrvIKd+wAidHC65WFQIy2/xq4gP5AibbBaOR28o=; b=b09gXXyZkSn3ilV4iPkT8oKmD9pbcH/ZUg1lRkpXHp3Efql/2GuFT2ScZj5AlStmHP c7f+GuGFmDzIN/KN37EkjmUBsemivw2Gko+NR94crmzT0Z1+19mHJ3GQglZMrBl7oifm NwNMcHA3V/m8u4hOfB+0cRwuoPlzS1jmxhnDoR3PVrPfDJfTSc5oKzZquO79QDoKRKge N5sJEVOnBQ9IsdMIU7i1kCstABq8Utj7LnL2gQ2fk1kLOBMEPXpX5yqD0i99kYNcJkt9 gUDQNuV+c7d2mkp2ZClx74srDVjjSBRudbcIMF7BxIwg4JoZ13+bW5Ky+RtqN8bkkinp IHmA== X-Gm-Message-State: ALoCoQkEzWhvLfUWOPZ+2ieqoZNeqQYRCFkJIfYDug6xuq/DOzAWAw0gqCO3jpXqHHkHn3cYk52f X-Received: by 10.236.29.37 with SMTP id h25mr12439470yha.8.1405989983615; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.82 with SMTP id y76ls1301809qgy.75.gmail; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) X-Received: by 10.52.34.46 with SMTP id w14mr13024708vdi.64.1405989983518; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id d7si12867076vcy.33.2014.07.21.17.46.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 17:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so13548423vcb.29 for ; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) X-Received: by 10.52.120.38 with SMTP id kz6mr6324173vdb.86.1405989983441; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp154166vcb; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) X-Received: by 10.220.133.13 with SMTP id d13mr9305002vct.66.1405989983062; Mon, 21 Jul 2014 17:46:23 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ar7si12831979vdd.64.2014.07.21.17.46.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Jul 2014 17:46:23 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X9OBe-00007y-F7; Tue, 22 Jul 2014 00:44:10 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X9OBc-00007M-DP for xen-devel@lists.xen.org; Tue, 22 Jul 2014 00:44:08 +0000 Received: from [85.158.143.35:7210] by server-1.bemta-4.messagelabs.com id AC/21-30046-7D3BDC35; Tue, 22 Jul 2014 00:44:07 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1405989845!19164166!1 X-Originating-IP: [209.85.192.172] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31957 invoked from network); 22 Jul 2014 00:44:06 -0000 Received: from mail-pd0-f172.google.com (HELO mail-pd0-f172.google.com) (209.85.192.172) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jul 2014 00:44:06 -0000 Received: by mail-pd0-f172.google.com with SMTP id ft15so10142518pdb.31 for ; Mon, 21 Jul 2014 17:44:04 -0700 (PDT) X-Received: by 10.68.220.170 with SMTP id px10mr18573628pbc.33.1405989844762; Mon, 21 Jul 2014 17:44:04 -0700 (PDT) Received: from rfranz-t520.local (c-24-10-97-91.hsd1.ca.comcast.net. [24.10.97.91]) by mx.google.com with ESMTPSA id fl3sm15417298pbc.35.2014.07.21.17.44.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Jul 2014 17:44:04 -0700 (PDT) From: Roy Franz To: xen-devel@lists.xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com, tim@xen.org, jbeulich@suse.com, keir@xen.org Date: Mon, 21 Jul 2014 17:43:25 -0700 Message-Id: <1405989815-25236-3-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1405989815-25236-1-git-send-email-roy.franz@linaro.org> References: <1405989815-25236-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org, linaro-uefi@lists.linaro.org Subject: [Xen-devel] [PATCH V2 02/12] rename printErrMsg to PrintErrMesgExit X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: The function prints an error message, then exits the program. Add PrintErrMesg that doesn't exit. Signed-off-by: Roy Franz --- 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;