Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K7uwU-0004vS-Jy for mharc-grub-devel@gnu.org; Sun, 15 Jun 2008 12:18:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7uwR-0004tG-Tb for grub-devel@gnu.org; Sun, 15 Jun 2008 12:18:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7uwN-0004po-3X for grub-devel@gnu.org; Sun, 15 Jun 2008 12:18:55 -0400 Received: from [199.232.76.173] (port=59184 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7uwM-0004pf-UB for grub-devel@gnu.org; Sun, 15 Jun 2008 12:18:50 -0400 Received: from wx-out-0506.google.com ([66.249.82.239]:6179) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7uwM-0000WJ-Q3 for grub-devel@gnu.org; Sun, 15 Jun 2008 12:18:51 -0400 Received: by wx-out-0506.google.com with SMTP id h28so2092902wxd.24 for ; Sun, 15 Jun 2008 09:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=UY877mkYtw4AR4/D3m4RWnKeNQTv83t5d9zdgkVzkX4=; b=s5G0ACCz0ZHd6KxRSD0hZBvps3G1Upuh/eSkGsugZQDFjWXCseYRdRbwal8jPr4s36 WMcp8vbFhYgo6vFFgaCbN8pYQ3ZKiNWFN8C2UNdwmxmbW9wZCVa2Tm+ESywUIrUFXlmj HDkhhcXcm+yxMncybdUsCjnFE24aShERzUPLo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=j6hPIUgzAZ9tjlFBcOy4/3sDY0Y0wG4DP2DAE9UivlEIy/wVdz+mR5wwW7LMimzdIz IYF9InTlg5LO0kF/Q0WpokjP96rTr3i327rmBJJDgYkCFFzOVevZMgX8nEJf3Rf/7YVL h1JBCG8pQHzmYUC0A8Vs2P8r2KY03scGcJLHY= Received: by 10.70.111.20 with SMTP id j20mr6393717wxc.8.1213546729488; Sun, 15 Jun 2008 09:18:49 -0700 (PDT) Received: by 10.70.117.1 with HTTP; Sun, 15 Jun 2008 09:18:49 -0700 (PDT) Message-ID: <5cc84b460806150918r1d24fd43p80853567127faf26@mail.gmail.com> Date: Sun, 15 Jun 2008 17:18:49 +0100 From: Kalamatee To: grub-devel@gnu.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7712_14268254.1213546729549" X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Allow AFFS on mbr style partitions 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: Sun, 15 Jun 2008 16:18:56 -0000 ------=_Part_7712_14268254.1213546729549 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Im resubmitting an individual patch by Alain Greppin which was originaly provided as part of a much larger patch (and declined for that reason). This patch is required for support of the AROS operating system (www.aros.org). 2008-03-08 Alain Greppin * fs/affs.c (grub_sfs_read_extent ): Allow AFFS to be used on MBR style partitions. Index: fs/affs.c =================================================================== --- fs/affs.c (revision 27991) +++ fs/affs.c (working copy) @@ -25,6 +25,7 @@ #include #include #include +#include /* The affs bootblock. */ struct grub_affs_bblock @@ -166,6 +167,8 @@ struct grub_affs_data *data; grub_uint32_t *rootblock = 0; struct grub_affs_rblock *rblock; + grub_uint64_t rdb_blockcount, rdb_reserved; + grub_disk_addr_t rblknum; int checksum = 0; int checksumr = 0; @@ -210,8 +213,16 @@ rblock = (struct grub_affs_rblock *) rootblock; /* Read the rootblock. */ - grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0, - GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock); + rdb_blockcount = disk->total_sectors; + rdb_reserved = 2; + + if (disk->partition) + rdb_blockcount = disk->partition->len; + + rblknum = (rdb_blockcount - 1 + rdb_reserved) >> 1; + + grub_disk_read (disk, rblknum, 0, + GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock); if (grub_errno) goto fail; @@ -242,7 +253,7 @@ data->disk = disk; data->htsize = grub_be_to_cpu32 (rblock->htsize); data->diropen.data = data; - data->diropen.block = (disk->total_sectors >> 1); + data->diropen.block = rblknum; grub_free (rootblock); ------=_Part_7712_14268254.1213546729549 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Im resubmitting an individual patch by Alain Greppin which was originaly
provided as part of a much larger patch (and declined for that reason). This
patch is required for support of the AROS operating system (www.aros.org).
 
2008-03-08  Alain Greppin  <al@chilibi.org>
 * fs/affs.c (grub_sfs_read_extent ): Allow AFFS to be used on MBR style partitions.
Index: fs/affs.c
===================================================================
--- fs/affs.c    (revision 27991)
+++ fs/affs.c    (working copy)
@@ -25,6 +25,7 @@
 #include <grub/dl.h>
 #include <grub/types.h>
 #include <grub/fshelp.h>
+#include <grub/partition.h>
 
 /* The affs bootblock.  */
 struct grub_affs_bblock
@@ -166,6 +167,8 @@
   struct grub_affs_data *data;
   grub_uint32_t *rootblock = 0;
   struct grub_affs_rblock *rblock;
+  grub_uint64_t rdb_blockcount, rdb_reserved;
+  grub_disk_addr_t rblknum;
 
   int checksum = 0;
   int checksumr = 0;
@@ -210,8 +213,16 @@
   rblock = (struct grub_affs_rblock *) rootblock;
 
   /* Read the rootblock.  */
-  grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0,
-    GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
+  rdb_blockcount = disk->total_sectors;
+  rdb_reserved = 2;
+
+  if (disk->partition)
+    rdb_blockcount = disk->partition->len;
+
+  rblknum = (rdb_blockcount - 1 + rdb_reserved) >> 1;
+
+  grub_disk_read (disk, rblknum, 0,
+                 GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
   if (grub_errno)
     goto fail;
 
@@ -242,7 +253,7 @@
   data->disk = disk;
   data->htsize = grub_be_to_cpu32 (rblock->htsize);
   data->diropen.data = data;
-  data->diropen.block = (disk->total_sectors >> 1);
+  data->diropen.block = rblknum;
 
   grub_free (rootblock);
 
------=_Part_7712_14268254.1213546729549--