grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH] Re: [PATCH] biosdisk / open_device() messing up offsets


From: Pavel Roskin
Subject: [RFC PATCH] Re: [PATCH] biosdisk / open_device() messing up offsets
Date: Tue, 10 Jun 2008 19:18:14 -0400

Hello!

Here's the patch with some cleanups and nice wrapped lines.  I leaving
out other fixes from e3.diff, they should be applied separately and
don't appear to be critical for my setup.

Changelog:

        * fs/ext2.c (grub_ext2_blockgroup): Call grub_fshelp_map_block()
        for the block that contains data for the requested group.

diff --git a/fs/ext2.c b/fs/ext2.c
index ffe9e33..f8642bb 100644
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -257,12 +257,18 @@ inline static grub_err_t
 grub_ext2_blockgroup (struct grub_ext2_data *data, int group, 
                      struct grub_ext2_block_group *blkgrp)
 {
+  int blkno, blkoff;
+
+  blkoff = group * sizeof (struct grub_ext2_block_group);
+  blkno = blkoff >> (LOG2_EXT2_BLOCK_SIZE (data) + 9);
+  blkoff -= (blkno << (LOG2_EXT2_BLOCK_SIZE (data) + 9));
+  blkno += grub_le_to_cpu32 (data->sblock.first_data_block) + 1;
+
   return grub_disk_read (data->disk,
-                        (grub_fshelp_map_block (data->journal,
-                                                 grub_le_to_cpu32 
(data->sblock.first_data_block) + 1)
+                        (grub_fshelp_map_block (data->journal, blkno)
                          << LOG2_EXT2_BLOCK_SIZE (data)),
-                        group * sizeof (struct grub_ext2_block_group), 
-                        sizeof (struct grub_ext2_block_group), (char *) 
blkgrp);
+                        blkoff, sizeof (struct grub_ext2_block_group),
+                        (char *) blkgrp);
 }
 
 

-- 
Regards,
Pavel Roskin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]