From patchwork Fri Apr 15 12:33:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 8850681 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6844B9F71A for ; Fri, 15 Apr 2016 12:36:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A33E20382 for ; Fri, 15 Apr 2016 12:36:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3309C202DD for ; Fri, 15 Apr 2016 12:36:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ar2wr-0005Ce-Un; Fri, 15 Apr 2016 12:34:09 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ar2wq-0005Ba-7k for xen-devel@lists.xenproject.org; Fri, 15 Apr 2016 12:34:08 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 72/E1-03651-FBFD0175; Fri, 15 Apr 2016 12:34:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsUyZ7p8oO7++wL hBp9+s1h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlzd51gLFgrUfHgymX2BsZ+oS5GTg4hgQ4m iTWbJboYuYDsb4wSe98vZoRIbGCU+PU1GyIxkVHi2O4eZpAEm4COxMUvD9lBbBEBJYl7qyYzg RQxC5xnkpjWeZkFJCEsECExc9dlsEksAqoSfZ+aweK8Au4S7f+ug9kSAooS3c8msIHYnAIeEq s7m4DiHEDb3CX+TRWBKDGW6JvVxzKBkW8BI8MqRvXi1KKy1CJdS72kosz0jJLcxMwcXUMDY73 c1OLixPTUnMSkYr3k/NxNjMAwqWdgYNzB+Pqn0yFGSQ4mJVHeuXsFwoX4kvJTKjMSizPii0pz UosPMcpwcChJ8D65B5QTLEpNT61Iy8wBBixMWoKDR0mEdx1Imre4IDG3ODMdInWKUVFKnJcdJ CEAksgozYNrg0XJJUZZKWFeRgYGBiGegtSi3MwSVPlXjOIcjErCvOtBpvBk5pXATX8FtJgJaH HZO16QxSWJCCmpBsZCW71MqUUGdyX6tBnVFs3c4S/1jkfYTirF7npfoIPx9x2uCy6HnVZuEAm cmuHJamuYnGz9yfzTs+3xHSc2zFWyfqCmMiOul6lSed6XH8o//4jK3zolIbW5PUambSJPvX/I 8cSj2aVC8Y8ZuNSs/f/79Md8lC/97yx91XbVo73nmecLntwiqcRSnJFoqMVcVJwIAOFrwxaNA gAA X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1460723645!27514028!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56135 invoked from network); 15 Apr 2016 12:34:06 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-7.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Apr 2016 12:34:06 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u3FCXvGu022850 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Apr 2016 12:33:58 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u3FCXv2J027517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Apr 2016 12:33:57 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u3FCXtOE018523; Fri, 15 Apr 2016 12:33:56 GMT Received: from olila.local.net-space.pl (/10.175.160.106) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 15 Apr 2016 05:33:54 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Fri, 15 Apr 2016 14:33:06 +0200 Message-Id: <1460723596-13261-7-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1460723596-13261-1-git-send-email-daniel.kiper@oracle.com> References: <1460723596-13261-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: jgross@suse.com, andrew.cooper3@citrix.com, stefano.stabellini@eu.citrix.com, cardoe@cardoe.com, pgnet.dev@gmail.com, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v3 06/16] x86/boot/reloc: Rename some variables and rearrange code a bit X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace mbi with mbi_out and mbi_old with mbi_in and rearrange code a bit to make it more readable. Additionally, this way multiboot (v1) protocol implementation and future multiboot2 protocol implementation will use the same variable naming convention. Signed-off-by: Daniel Kiper Reviewed-by: Konrad Rzeszutek Wilk Acked-by: Jan Beulich --- v3 - suggestions/fixes: - improve commit message (suggested by Konrad Rzeszutek Wilk). v2 - suggestions/fixes: - extract this change from main mutliboot2 protocol implementation (suggested by Jan Beulich). --- xen/arch/x86/boot/reloc.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index d60a078..93b3845 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -84,41 +84,44 @@ static u32 copy_string(u32 src) return copy_mem(src, p - src + 1); } -multiboot_info_t *reloc(u32 mbi_old) +multiboot_info_t *reloc(u32 mbi_in) { - multiboot_info_t *mbi = (multiboot_info_t *)copy_mem(mbi_old, sizeof(*mbi)); int i; + multiboot_info_t *mbi_out; - if ( mbi->flags & MBI_CMDLINE ) - mbi->cmdline = copy_string(mbi->cmdline); + mbi_out = (multiboot_info_t *)copy_mem(mbi_in, sizeof(*mbi_out)); - if ( mbi->flags & MBI_MODULES ) + if ( mbi_out->flags & MBI_CMDLINE ) + mbi_out->cmdline = copy_string(mbi_out->cmdline); + + if ( mbi_out->flags & MBI_MODULES ) { module_t *mods; - mbi->mods_addr = copy_mem(mbi->mods_addr, mbi->mods_count * sizeof(module_t)); + mbi_out->mods_addr = copy_mem(mbi_out->mods_addr, + mbi_out->mods_count * sizeof(module_t)); - mods = (module_t *)mbi->mods_addr; + mods = (module_t *)mbi_out->mods_addr; - for ( i = 0; i < mbi->mods_count; i++ ) + for ( i = 0; i < mbi_out->mods_count; i++ ) { if ( mods[i].string ) mods[i].string = copy_string(mods[i].string); } } - if ( mbi->flags & MBI_MEMMAP ) - mbi->mmap_addr = copy_mem(mbi->mmap_addr, mbi->mmap_length); + if ( mbi_out->flags & MBI_MEMMAP ) + mbi_out->mmap_addr = copy_mem(mbi_out->mmap_addr, mbi_out->mmap_length); - if ( mbi->flags & MBI_LOADERNAME ) - mbi->boot_loader_name = copy_string(mbi->boot_loader_name); + if ( mbi_out->flags & MBI_LOADERNAME ) + mbi_out->boot_loader_name = copy_string(mbi_out->boot_loader_name); /* Mask features we don't understand or don't relocate. */ - mbi->flags &= (MBI_MEMLIMITS | - MBI_CMDLINE | - MBI_MODULES | - MBI_MEMMAP | - MBI_LOADERNAME); + mbi_out->flags &= (MBI_MEMLIMITS | + MBI_CMDLINE | + MBI_MODULES | + MBI_MEMMAP | + MBI_LOADERNAME); - return mbi; + return mbi_out; }