source: patches/grub-0.97-256byte_inode-1.patch@ 5f7daae

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5f7daae was ca9712f, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Add the 256-byte innode patch to grub.

  • Property mode set to 100644
File size: 4.8 KB
RevLine 
[ca9712f]1Submitted By: Jeremy Huntwork (jhuntwork at linuxfromscratch dot org)
2Date: 2008-04-03
3Initial Package Version: 0.97
4Upstream Status: Not sent. Development on 'GRUB legacy' abandoned for 'GRUB2'.
5Origin: http://bugs.debian.org/463123
6Description: Fixes GRUB to recognize ext2 filesystems created with 256-byte
7inodes.
8
9diff -Nrup a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c
10--- a/stage2/fsys_ext2fs.c 2004-08-08 20:19:18.000000000 +0200
11+++ b/stage2/fsys_ext2fs.c 2008-01-30 14:27:20.000000000 +0100
12@@ -79,7 +79,52 @@ struct ext2_super_block
13 __u32 s_rev_level; /* Revision level */
14 __u16 s_def_resuid; /* Default uid for reserved blocks */
15 __u16 s_def_resgid; /* Default gid for reserved blocks */
16- __u32 s_reserved[235]; /* Padding to the end of the block */
17+ /*
18+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
19+ *
20+ * Note: the difference between the compatible feature set and
21+ * the incompatible feature set is that if there is a bit set
22+ * in the incompatible feature set that the kernel doesn't
23+ * know about, it should refuse to mount the filesystem.
24+ *
25+ * e2fsck's requirements are more strict; if it doesn't know
26+ * about a feature in either the compatible or incompatible
27+ * feature set, it must abort and not try to meddle with
28+ * things it doesn't understand...
29+ */
30+ __u32 s_first_ino; /* First non-reserved inode */
31+ __u16 s_inode_size; /* size of inode structure */
32+ __u16 s_block_group_nr; /* block group # of this superblock */
33+ __u32 s_feature_compat; /* compatible feature set */
34+ __u32 s_feature_incompat; /* incompatible feature set */
35+ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
36+ __u8 s_uuid[16]; /* 128-bit uuid for volume */
37+ char s_volume_name[16]; /* volume name */
38+ char s_last_mounted[64]; /* directory where last mounted */
39+ __u32 s_algorithm_usage_bitmap; /* For compression */
40+ /*
41+ * Performance hints. Directory preallocation should only
42+ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
43+ */
44+ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
45+ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
46+ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
47+ /*
48+ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
49+ */
50+ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
51+ __u32 s_journal_inum; /* inode number of journal file */
52+ __u32 s_journal_dev; /* device number of journal file */
53+ __u32 s_last_orphan; /* start of list of inodes to delete */
54+ __u32 s_hash_seed[4]; /* HTREE hash seed */
55+ __u8 s_def_hash_version; /* Default hash version to use */
56+ __u8 s_jnl_backup_type; /* Default type of journal backup */
57+ __u16 s_reserved_word_pad;
58+ __u32 s_default_mount_opts;
59+ __u32 s_first_meta_bg; /* First metablock group */
60+ __u32 s_mkfs_time; /* When the filesystem was created */
61+ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
62+ __u32 s_reserved[172]; /* Padding to the end of the block */
63 };
64
65 struct ext2_group_desc
66@@ -218,6 +263,9 @@ struct ext2_dir_entry
67 #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
68 #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
69
70+#define EXT2_INODE_SIZE(s) (SUPERBLOCK->s_inode_size)
71+#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
72+
73 /* linux/ext2_fs.h */
74 #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
75 /* kind of from ext2/super.c */
76@@ -553,7 +601,7 @@ ext2fs_dir (char *dirname)
77 gdp = GROUP_DESC;
78 ino_blk = gdp[desc].bg_inode_table +
79 (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
80- >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
81+ >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
82 #ifdef E2DEBUG
83 printf ("inode table fsblock=%d\n", ino_blk);
84 #endif /* E2DEBUG */
85@@ -565,13 +613,12 @@ ext2fs_dir (char *dirname)
86 /* reset indirect blocks! */
87 mapblock2 = mapblock1 = -1;
88
89- raw_inode = INODE +
90- ((current_ino - 1)
91- & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
92+ raw_inode = (struct ext2_inode *)((char *)INODE +
93+ ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
94+ EXT2_INODE_SIZE (SUPERBLOCK));
95 #ifdef E2DEBUG
96 printf ("ipb=%d, sizeof(inode)=%d\n",
97- (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
98- sizeof (struct ext2_inode));
99+ EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
100 printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
101 printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
102 for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
Note: See TracBrowser for help on using the repository browser.