Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Mh0RA-00033t-9H for mharc-grub-devel@gnu.org; Fri, 28 Aug 2009 08:20:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mh0R7-00032Y-Ku for grub-devel@gnu.org; Fri, 28 Aug 2009 08:20:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mh0R2-00030C-Kj for grub-devel@gnu.org; Fri, 28 Aug 2009 08:20:08 -0400 Received: from [199.232.76.173] (port=41288 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh0R2-000309-IC for grub-devel@gnu.org; Fri, 28 Aug 2009 08:20:04 -0400 Received: from mail-pz0-f172.google.com ([209.85.222.172]:44676) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mh0R2-0006wy-8L for grub-devel@gnu.org; Fri, 28 Aug 2009 08:20:04 -0400 Received: by pzk2 with SMTP id 2so1938864pzk.28 for ; Fri, 28 Aug 2009 05:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=4w9OgxZc75o03CJ6w8XR/3mDH096nCdX+fbhibszHdc=; b=geBGRFBaGvb1BIWFboqknAIKlTF2ccJ5swVxIa8MgiZIAloDYgBUQ4SzZqesrjriE+ ZvLCF+yY//MsQ4niifrzn+/fM3zH7WWlQXyjnhXGgGd9f9LllZBq4/am1/MxRr8lVNnt lZUd++X+FWEigcFN/TjJPR5D0aP+gP3+8NKyw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=q9MLMnKE2qTHrkNRQlIQjbIOkI9hZfPNfAmCybh5UwYCoSMdzph71hTQR4BmZxIHLO YoKy+2Gvn/NVhJXNxwW6TgFyRp6+ZWuYEoGSTR4VRzQgLIcsUN9ieRKn43rEQqVBhNYr srq36+x/eihiNDxIm+vCX74M78wIQ04iF6PV0= MIME-Version: 1.0 Received: by 10.140.162.16 with SMTP id k16mr496060rve.107.1251462003416; Fri, 28 Aug 2009 05:20:03 -0700 (PDT) In-Reply-To: References: Date: Fri, 28 Aug 2009 20:20:03 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Detect endian in cpio fs X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2009 12:20:09 -0000 On Fri, Aug 28, 2009 at 8:03 PM, Vladimir 'phcoder' Serbinenko wrote: > On Thu, Aug 27, 2009 at 10:27 AM, Bean wrote: >> Hi, >> >> This patch allows to access big/little endian cpio archive from >> big/little endian machine. > Quick glance showed that you use swap_bytes. Could you use > grub_*_to_cpu* instead? This would simplify the future maintainability > if someone decides to port to a very special platform (e.g. > mixed-endian) since code would be uniform Hi, Actually it's not correct to use grub_*_to_cpu*. The code works by first assuming cpio uses the same endian of host cpu, if not, swap it and try the other endian. This method works for big/little endian cpio on big/little endian machine. It's possible to achieve the same result with a combination of #ifdef and grub_*_to_cpu*'s, but it's not as simple as this and generate more code than necessary. -- Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/