From 4665e9d64f0aba6829729c572d3cabaed4551a04 Mon Sep 17 00:00:00 2001 From: Ronald van Haren Date: Tue, 28 Jul 2009 10:32:47 +0000 Subject: [PATCH] FS#14363: revised inode patch, old one caused a division by zero --- PKGBUILD | 8 ++++---- grub-inode-size.patch | 22 ++++++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 06f6c45..32d4062 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -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 diff --git a/grub-inode-size.patch b/grub-inode-size.patch index bef3bc1..f5ceb11 100644 --- a/grub-inode-size.patch +++ b/grub-inode-size.patch @@ -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; +