From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZHC5E-0004OS-RG for mharc-grub-devel@gnu.org; Mon, 20 Jul 2015 10:30:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHC5B-0004HF-Ox for grub-devel@gnu.org; Mon, 20 Jul 2015 10:30:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHC58-0000g7-7j for grub-devel@gnu.org; Mon, 20 Jul 2015 10:30:17 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:20401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHC57-0000fP-HX for grub-devel@gnu.org; Mon, 20 Jul 2015 10:30:14 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t6KEU3JR009917 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Jul 2015 14:30:04 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t6KEU3Nv004986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 20 Jul 2015 14:30:03 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t6KEU2bq031657; Mon, 20 Jul 2015 14:30:03 GMT Received: from olila.local.net-space.pl (/10.175.255.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 20 Jul 2015 07:30:02 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org, grub-devel@gnu.org Subject: [PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange code a bit Date: Mon, 20 Jul 2015 16:29:02 +0200 Message-Id: <1437402558-7313-8-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437402558-7313-1-git-send-email-daniel.kiper@oracle.com> References: <1437402558-7313-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 Cc: jgross@suse.com, keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, stefano.stabellini@eu.citrix.com, roy.franz@linaro.org, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, phcoder@gmail.com, wei.liu2@citrix.com, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2015 14:30:19 -0000 Rename mbi and mbi_old variables 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 --- 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 09fd540..feb1d72 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -86,41 +86,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; } -- 1.7.10.4