rev |
line source |
pascal@2599
|
1
|
pascal@2599
|
2 Patch from Red Hat. See #463236, #463123 (and #491076 for the reviewed version)
|
pascal@2599
|
3
|
pascal@2599
|
4 diff -ur grub-0.97/stage2/fsys_ext2fs.c grub-0.97.new/stage2/fsys_ext2fs.c
|
pascal@2599
|
5 --- grub-0.97/stage2/fsys_ext2fs.c 2008-07-23 01:18:18.000000000 +0200
|
pascal@2599
|
6 +++ grub-0.97.new/stage2/fsys_ext2fs.c 2008-07-25 14:33:29.000000000 +0200
|
pascal@2599
|
7 @@ -79,7 +79,52 @@
|
pascal@2599
|
8 __u32 s_rev_level; /* Revision level */
|
pascal@2599
|
9 __u16 s_def_resuid; /* Default uid for reserved blocks */
|
pascal@2599
|
10 __u16 s_def_resgid; /* Default gid for reserved blocks */
|
pascal@2599
|
11 - __u32 s_reserved[235]; /* Padding to the end of the block */
|
pascal@2599
|
12 + /*
|
pascal@2599
|
13 + * These fields are for EXT2_DYNAMIC_REV superblocks only.
|
pascal@2599
|
14 + *
|
pascal@2599
|
15 + * Note: the difference between the compatible feature set and
|
pascal@2599
|
16 + * the incompatible feature set is that if there is a bit set
|
pascal@2599
|
17 + * in the incompatible feature set that the kernel doesn't
|
pascal@2599
|
18 + * know about, it should refuse to mount the filesystem.
|
pascal@2599
|
19 + *
|
pascal@2599
|
20 + * e2fsck's requirements are more strict; if it doesn't know
|
pascal@2599
|
21 + * about a feature in either the compatible or incompatible
|
pascal@2599
|
22 + * feature set, it must abort and not try to meddle with
|
pascal@2599
|
23 + * things it doesn't understand...
|
pascal@2599
|
24 + */
|
pascal@2599
|
25 + __u32 s_first_ino; /* First non-reserved inode */
|
pascal@2599
|
26 + __u16 s_inode_size; /* size of inode structure */
|
pascal@2599
|
27 + __u16 s_block_group_nr; /* block group # of this superblock */
|
pascal@2599
|
28 + __u32 s_feature_compat; /* compatible feature set */
|
pascal@2599
|
29 + __u32 s_feature_incompat; /* incompatible feature set */
|
pascal@2599
|
30 + __u32 s_feature_ro_compat; /* readonly-compatible feature set */
|
pascal@2599
|
31 + __u8 s_uuid[16]; /* 128-bit uuid for volume */
|
pascal@2599
|
32 + char s_volume_name[16]; /* volume name */
|
pascal@2599
|
33 + char s_last_mounted[64]; /* directory where last mounted */
|
pascal@2599
|
34 + __u32 s_algorithm_usage_bitmap; /* For compression */
|
pascal@2599
|
35 + /*
|
pascal@2599
|
36 + * Performance hints. Directory preallocation should only
|
pascal@2599
|
37 + * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
|
pascal@2599
|
38 + */
|
pascal@2599
|
39 + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
|
pascal@2599
|
40 + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
|
pascal@2599
|
41 + __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
|
pascal@2599
|
42 + /*
|
pascal@2599
|
43 + * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
|
pascal@2599
|
44 + */
|
pascal@2599
|
45 + __u8 s_journal_uuid[16]; /* uuid of journal superblock */
|
pascal@2599
|
46 + __u32 s_journal_inum; /* inode number of journal file */
|
pascal@2599
|
47 + __u32 s_journal_dev; /* device number of journal file */
|
pascal@2599
|
48 + __u32 s_last_orphan; /* start of list of inodes to delete */
|
pascal@2599
|
49 + __u32 s_hash_seed[4]; /* HTREE hash seed */
|
pascal@2599
|
50 + __u8 s_def_hash_version; /* Default hash version to use */
|
pascal@2599
|
51 + __u8 s_jnl_backup_type; /* Default type of journal backup */
|
pascal@2599
|
52 + __u16 s_reserved_word_pad;
|
pascal@2599
|
53 + __u32 s_default_mount_opts;
|
pascal@2599
|
54 + __u32 s_first_meta_bg; /* First metablock group */
|
pascal@2599
|
55 + __u32 s_mkfs_time; /* When the filesystem was created */
|
pascal@2599
|
56 + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
|
pascal@2599
|
57 + __u32 s_reserved[172]; /* Padding to the end of the block */
|
pascal@2599
|
58 };
|
pascal@2599
|
59
|
pascal@2599
|
60 struct ext2_group_desc
|
pascal@2599
|
61 @@ -218,6 +263,14 @@
|
pascal@2599
|
62 #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
|
pascal@2599
|
63 #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
|
pascal@2599
|
64
|
pascal@2599
|
65 +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
|
pascal@2599
|
66 +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
|
pascal@2599
|
67 +#define EXT2_GOOD_OLD_INODE_SIZE 128
|
pascal@2599
|
68 +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
|
pascal@2599
|
69 + EXT2_GOOD_OLD_INODE_SIZE : \
|
pascal@2599
|
70 + (s)->s_inode_size)
|
pascal@2599
|
71 +#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
|
pascal@2599
|
72 +
|
pascal@2599
|
73 /* linux/ext2_fs.h */
|
pascal@2599
|
74 #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
|
pascal@2599
|
75 /* kind of from ext2/super.c */
|
pascal@2599
|
76 @@ -553,7 +606,7 @@
|
pascal@2599
|
77 gdp = GROUP_DESC;
|
pascal@2599
|
78 ino_blk = gdp[desc].bg_inode_table +
|
pascal@2599
|
79 (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
|
pascal@2599
|
80 - >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
|
pascal@2599
|
81 + >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
|
pascal@2599
|
82 #ifdef E2DEBUG
|
pascal@2599
|
83 printf ("inode table fsblock=%d\n", ino_blk);
|
pascal@2599
|
84 #endif /* E2DEBUG */
|
pascal@2599
|
85 @@ -565,13 +618,12 @@
|
pascal@2599
|
86 /* reset indirect blocks! */
|
pascal@2599
|
87 mapblock2 = mapblock1 = -1;
|
pascal@2599
|
88
|
pascal@2599
|
89 - raw_inode = INODE +
|
pascal@2599
|
90 - ((current_ino - 1)
|
pascal@2599
|
91 - & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
|
pascal@2599
|
92 + raw_inode = (struct ext2_inode *)((char *)INODE +
|
pascal@2599
|
93 + ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
|
pascal@2599
|
94 + EXT2_INODE_SIZE (SUPERBLOCK));
|
pascal@2599
|
95 #ifdef E2DEBUG
|
pascal@2599
|
96 printf ("ipb=%d, sizeof(inode)=%d\n",
|
pascal@2599
|
97 - (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
|
pascal@2599
|
98 - sizeof (struct ext2_inode));
|
pascal@2599
|
99 + EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
|
pascal@2599
|
100 printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
|
pascal@2599
|
101 printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
|
pascal@2599
|
102 for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
|