wok-6.x view grub/stuff/ext3_256byte_inode.diff @ rev 7439

busybox: display command line in usage output
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Nov 29 16:23:32 2010 +0100 (2010-11-29)
parents
children
line source
2 Patch from Red Hat. See #463236, #463123 (and #491076 for the reviewed version)
4 diff -ur grub-0.97/stage2/fsys_ext2fs.c grub-0.97.new/stage2/fsys_ext2fs.c
5 --- grub-0.97/stage2/fsys_ext2fs.c 2008-07-23 01:18:18.000000000 +0200
6 +++ grub-0.97.new/stage2/fsys_ext2fs.c 2008-07-25 14:33:29.000000000 +0200
7 @@ -79,7 +79,52 @@
8 __u32 s_rev_level; /* Revision level */
9 __u16 s_def_resuid; /* Default uid for reserved blocks */
10 __u16 s_def_resgid; /* Default gid for reserved blocks */
11 - __u32 s_reserved[235]; /* Padding to the end of the block */
12 + /*
13 + * These fields are for EXT2_DYNAMIC_REV superblocks only.
14 + *
15 + * Note: the difference between the compatible feature set and
16 + * the incompatible feature set is that if there is a bit set
17 + * in the incompatible feature set that the kernel doesn't
18 + * know about, it should refuse to mount the filesystem.
19 + *
20 + * e2fsck's requirements are more strict; if it doesn't know
21 + * about a feature in either the compatible or incompatible
22 + * feature set, it must abort and not try to meddle with
23 + * things it doesn't understand...
24 + */
25 + __u32 s_first_ino; /* First non-reserved inode */
26 + __u16 s_inode_size; /* size of inode structure */
27 + __u16 s_block_group_nr; /* block group # of this superblock */
28 + __u32 s_feature_compat; /* compatible feature set */
29 + __u32 s_feature_incompat; /* incompatible feature set */
30 + __u32 s_feature_ro_compat; /* readonly-compatible feature set */
31 + __u8 s_uuid[16]; /* 128-bit uuid for volume */
32 + char s_volume_name[16]; /* volume name */
33 + char s_last_mounted[64]; /* directory where last mounted */
34 + __u32 s_algorithm_usage_bitmap; /* For compression */
35 + /*
36 + * Performance hints. Directory preallocation should only
37 + * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
38 + */
39 + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
40 + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
41 + __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
42 + /*
43 + * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
44 + */
45 + __u8 s_journal_uuid[16]; /* uuid of journal superblock */
46 + __u32 s_journal_inum; /* inode number of journal file */
47 + __u32 s_journal_dev; /* device number of journal file */
48 + __u32 s_last_orphan; /* start of list of inodes to delete */
49 + __u32 s_hash_seed[4]; /* HTREE hash seed */
50 + __u8 s_def_hash_version; /* Default hash version to use */
51 + __u8 s_jnl_backup_type; /* Default type of journal backup */
52 + __u16 s_reserved_word_pad;
53 + __u32 s_default_mount_opts;
54 + __u32 s_first_meta_bg; /* First metablock group */
55 + __u32 s_mkfs_time; /* When the filesystem was created */
56 + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
57 + __u32 s_reserved[172]; /* Padding to the end of the block */
58 };
60 struct ext2_group_desc
61 @@ -218,6 +263,14 @@
62 #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
63 #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
65 +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
66 +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
67 +#define EXT2_GOOD_OLD_INODE_SIZE 128
68 +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
69 + EXT2_GOOD_OLD_INODE_SIZE : \
70 + (s)->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 +606,7 @@
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 +618,12 @@
86 /* reset indirect blocks! */
87 mapblock2 = mapblock1 = -1;
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;