FS#14363: revised inode patch, old one caused a division by zero

This commit is contained in:
Ronald van Haren 2009-07-28 10:32:47 +00:00
parent 3e247a8b4d
commit 4665e9d64f
2 changed files with 18 additions and 12 deletions

View File

@ -2,7 +2,7 @@
pkgname=grub
pkgver=0.97
pkgrel=15
pkgrel=16
pkgdesc="A GNU multiboot boot loader"
arch=('i686' 'x86_64')
license=('GPL')
@ -31,15 +31,15 @@ md5sums=('cd3f3eb54446be6003156158d51f4884'
'49f6d4bcced0bc8bbcff273f3254bbfa'
'f41f702014a064918d7afc6fc23baa6e'
'175dc6b9f4ab94e8056c3afb3e34460a'
'ada26cbc681907823cc4ff2a55b97866'
'69c648d2b8d0965df70a74014424f31c'
'39e0f9a05b7e04aceb24fc7bc4893e3d')
build() {
cd $srcdir/$pkgname-$pkgver
#set destination architecture here
#DESTARCH="i686"
DESTARCH="x86_64"
DESTARCH="i686"
#DESTARCH="x86_64"
# optimizations break the build -- disable them
# adding special devices to grub, patches are from fedora
patch -Np1 -i ../special-devices.patch || return 1

View File

@ -1,7 +1,7 @@
diff -Nrup a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c
--- a/stage2/fsys_ext2fs.c 2004-08-08 20:19:18.000000000 +0200
+++ b/stage2/fsys_ext2fs.c 2008-01-30 14:27:20.000000000 +0100
@@ -79,7 +79,52 @@ struct ext2_super_block
diff -Naur grub-0.97-800/stage2/fsys_ext2fs.c grub-0.97-810/stage2/fsys_ext2fs.c
--- grub-0.97-800/stage2/fsys_ext2fs.c 2008-07-21 00:40:21.668879475 -0600
+++ grub-0.97-810/stage2/fsys_ext2fs.c 2008-07-21 01:01:11.063953773 -0600
@@ -79,7 +79,52 @@
__u32 s_rev_level; /* Revision level */
__u16 s_def_resuid; /* Default uid for reserved blocks */
__u16 s_def_resgid; /* Default gid for reserved blocks */
@ -55,17 +55,22 @@ diff -Nrup a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c
};
struct ext2_group_desc
@@ -218,6 +263,9 @@ struct ext2_dir_entry
@@ -218,6 +263,14 @@
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
#define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
+#define EXT2_INODE_SIZE(s) (SUPERBLOCK->s_inode_size)
+#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
+#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
+#define EXT2_GOOD_OLD_INODE_SIZE 128
+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
+ EXT2_GOOD_OLD_INODE_SIZE : \
+ (s)->s_inode_size)
+#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
+
/* linux/ext2_fs.h */
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
/* kind of from ext2/super.c */
@@ -553,7 +601,7 @@ ext2fs_dir (char *dirname)
@@ -553,7 +606,7 @@
gdp = GROUP_DESC;
ino_blk = gdp[desc].bg_inode_table +
(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
@ -74,7 +79,7 @@ diff -Nrup a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c
#ifdef E2DEBUG
printf ("inode table fsblock=%d\n", ino_blk);
#endif /* E2DEBUG */
@@ -565,13 +613,12 @@ ext2fs_dir (char *dirname)
@@ -565,13 +618,12 @@
/* reset indirect blocks! */
mapblock2 = mapblock1 = -1;
@ -92,3 +97,4 @@ diff -Nrup a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c
printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;