wok-current rev 20224
grub: add ext4 patch (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Mar 01 11:38:49 2018 +0100 (2018-03-01) |
parents | 0c1ad897a405 |
children | df2e1b1bbac1 |
files | grub/stuff/ext3_256byte_inode+ext4.diff |
line diff
1.1 --- a/grub/stuff/ext3_256byte_inode+ext4.diff Thu Mar 01 10:11:27 2018 +0100 1.2 +++ b/grub/stuff/ext3_256byte_inode+ext4.diff Thu Mar 01 11:38:49 2018 +0100 1.3 @@ -40,7 +40,7 @@ 1.4 __u32 s_inodes_per_group; /* # Inodes per group */ 1.5 __u32 s_mtime; /* Mount time */ 1.6 __u32 s_wtime; /* Write time */ 1.7 -@@ -72,13 +86,14 @@ 1.8 +@@ -72,17 +86,63 @@ 1.9 __u16 s_magic; /* Magic signature */ 1.10 __u16 s_state; /* File system state */ 1.11 __u16 s_errors; /* Behaviour when detecting errors */ 1.12 @@ -52,50 +52,54 @@ 1.13 __u32 s_rev_level; /* Revision level */ 1.14 __u16 s_def_resuid; /* Default uid for reserved blocks */ 1.15 __u16 s_def_resgid; /* Default gid for reserved blocks */ 1.16 +- __u32 s_reserved[235]; /* Padding to the end of the block */ 1.17 + //__u32 s_reserved[235]; /* Padding to the end of the block */ 1.18 - /* 1.19 - * These fields are for EXT2_DYNAMIC_REV superblocks only. 1.20 - * 1.21 -@@ -98,16 +113,16 @@ 1.22 - __u32 s_feature_compat; /* compatible feature set */ 1.23 - __u32 s_feature_incompat; /* incompatible feature set */ 1.24 - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ 1.25 -- __u8 s_uuid[16]; /* 128-bit uuid for volume */ 1.26 -- char s_volume_name[16]; /* volume name */ 1.27 -- char s_last_mounted[64]; /* directory where last mounted */ 1.28 -- __u32 s_algorithm_usage_bitmap; /* For compression */ 1.29 ++ /* 1.30 ++ * These fields are for EXT2_DYNAMIC_REV superblocks only. 1.31 ++ * 1.32 ++ * Note: the difference between the compatible feature set and 1.33 ++ * the incompatible feature set is that if there is a bit set 1.34 ++ * in the incompatible feature set that the kernel doesn't 1.35 ++ * know about, it should refuse to mount the filesystem. 1.36 ++ * 1.37 ++ * e2fsck's requirements are more strict; if it doesn't know 1.38 ++ * about a feature in either the compatible or incompatible 1.39 ++ * feature set, it must abort and not try to meddle with 1.40 ++ * things it doesn't understand... 1.41 ++ */ 1.42 ++ __u32 s_first_ino; /* First non-reserved inode */ 1.43 ++ __u16 s_inode_size; /* size of inode structure */ 1.44 ++ __u16 s_block_group_nr; /* block group # of this superblock */ 1.45 ++ __u32 s_feature_compat; /* compatible feature set */ 1.46 ++ __u32 s_feature_incompat; /* incompatible feature set */ 1.47 ++ __u32 s_feature_ro_compat; /* readonly-compatible feature set */ 1.48 + __u8 s_uuid[16]; /* 128-bit uuid for volume */ 1.49 + char s_volume_name[16]; /* volume name */ 1.50 + char s_last_mounted[64]; /* directory where last mounted */ 1.51 + __u32 s_algorithm_usage_bitmap; /* For compression */ 1.52 - /* 1.53 -- * Performance hints. Directory preallocation should only 1.54 ++ /* 1.55 + * Performance hints. Directory preallocation should only 1.56 - * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. 1.57 - */ 1.58 -- __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 1.59 -- __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 1.60 ++ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. 1.61 ++ */ 1.62 + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 1.63 + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 1.64 - __u16 s_reserved_gdt_blocks;/* Per group table for online growth */ 1.65 - /* 1.66 - * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. 1.67 -@@ -117,17 +132,17 @@ 1.68 - __u32 s_journal_dev; /* device number of journal file */ 1.69 - __u32 s_last_orphan; /* start of list of inodes to delete */ 1.70 - __u32 s_hash_seed[4]; /* HTREE hash seed */ 1.71 -- __u8 s_def_hash_version; /* Default hash version to use */ 1.72 -- __u8 s_jnl_backup_type; /* Default type of journal backup */ 1.73 -- __u16 s_reserved_word_pad; 1.74 ++ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */ 1.75 ++ /* 1.76 ++ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. 1.77 ++ */ 1.78 ++ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ 1.79 ++ __u32 s_journal_inum; /* inode number of journal file */ 1.80 ++ __u32 s_journal_dev; /* device number of journal file */ 1.81 ++ __u32 s_last_orphan; /* start of list of inodes to delete */ 1.82 ++ __u32 s_hash_seed[4]; /* HTREE hash seed */ 1.83 + __u8 s_def_hash_version; /* Default hash version to use */ 1.84 + __u8 s_jnl_backup_type; /* Default type of journal backup */ 1.85 + __u16 s_desc_size; /* size of group descriptor */ 1.86 - __u32 s_default_mount_opts; 1.87 - __u32 s_first_meta_bg; /* First metablock group */ 1.88 - __u32 s_mkfs_time; /* When the filesystem was created */ 1.89 -- __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ 1.90 ++ __u32 s_default_mount_opts; 1.91 ++ __u32 s_first_meta_bg; /* First metablock group */ 1.92 ++ __u32 s_mkfs_time; /* When the filesystem was created */ 1.93 + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ 1.94 - __u32 s_reserved[172]; /* Padding to the end of the block */ 1.95 ++ __u32 s_reserved[172]; /* Padding to the end of the block */ 1.96 }; 1.97 1.98 -struct ext2_group_desc 1.99 @@ -103,7 +107,7 @@ 1.100 { 1.101 __u32 bg_block_bitmap; /* Blocks bitmap block */ 1.102 __u32 bg_inode_bitmap; /* Inodes bitmap block */ 1.103 -@@ -135,8 +150,18 @@ 1.104 +@@ -90,8 +150,18 @@ 1.105 __u16 bg_free_blocks_count; /* Free blocks count */ 1.106 __u16 bg_free_inodes_count; /* Free inodes count */ 1.107 __u16 bg_used_dirs_count; /* Directories count */ 1.108 @@ -124,7 +128,7 @@ 1.109 }; 1.110 1.111 struct ext2_inode 1.112 -@@ -174,22 +199,22 @@ 1.113 +@@ -129,22 +199,22 @@ 1.114 __u32 i_block[EXT2_N_BLOCKS]; /* 40: Pointers to blocks */ 1.115 __u32 i_version; /* File version (for NFS) */ 1.116 __u32 i_file_acl; /* File ACL */ 1.117 @@ -155,7 +159,7 @@ 1.118 __u16 h_i_mode_high; 1.119 __u16 h_i_uid_high; 1.120 __u16 h_i_gid_high; 1.121 -@@ -198,16 +223,36 @@ 1.122 +@@ -153,16 +223,36 @@ 1.123 hurd2; 1.124 struct 1.125 { 1.126 @@ -195,7 +199,7 @@ 1.127 /* linux/limits.h */ 1.128 #define NAME_MAX 255 /* # chars in a file name */ 1.129 1.130 -@@ -225,6 +270,57 @@ 1.131 +@@ -180,6 +270,57 @@ 1.132 char name[EXT2_NAME_LEN]; /* File name */ 1.133 }; 1.134 1.135 @@ -253,7 +257,7 @@ 1.136 /* linux/ext2fs.h */ 1.137 /* 1.138 * EXT2_DIR_PAD defines the directory entries boundaries 1.139 -@@ -238,7 +334,7 @@ 1.140 +@@ -193,7 +334,7 @@ 1.141 1.142 1.143 /* ext2/super.c */ 1.144 @@ -262,7 +266,7 @@ 1.145 1.146 #define EXT2_SUPER_MAGIC 0xEF53 /* include/linux/ext2_fs.h */ 1.147 #define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */ 1.148 -@@ -247,11 +343,12 @@ 1.149 +@@ -202,11 +343,12 @@ 1.150 1.151 /* made up, these are pointers into FSYS_BUF */ 1.152 /* read once, always stays there: */ 1.153 @@ -277,7 +281,7 @@ 1.154 #define INODE \ 1.155 ((struct ext2_inode *)((int)GROUP_DESC + EXT2_BLOCK_SIZE(SUPERBLOCK))) 1.156 #define DATABLOCK1 \ 1.157 -@@ -261,14 +358,19 @@ 1.158 +@@ -216,15 +358,37 @@ 1.159 1.160 /* linux/ext2_fs.h */ 1.161 #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) 1.162 @@ -285,12 +289,8 @@ 1.163 +#define EXT2_ADDR_PER_BLOCK_BITS(s) (log2_tmp(EXT2_ADDR_PER_BLOCK(s))) 1.164 1.165 +/* Revision levels */ 1.166 - #define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ 1.167 - #define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ 1.168 --#define EXT2_GOOD_OLD_INODE_SIZE 128 1.169 --#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ 1.170 -- EXT2_GOOD_OLD_INODE_SIZE : \ 1.171 -- (s)->s_inode_size) 1.172 ++#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ 1.173 ++#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ 1.174 + 1.175 +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV 1.176 +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV 1.177 @@ -299,10 +299,10 @@ 1.178 + 1.179 +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) 1.180 +//#define EXT2_INODE_SIZE(s) (SUPERBLOCK->s_inode_size) 1.181 - #define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) 1.182 - 1.183 ++#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) 1.184 ++ 1.185 /* linux/ext2_fs.h */ 1.186 -@@ -276,8 +378,17 @@ 1.187 + #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) 1.188 /* kind of from ext2/super.c */ 1.189 #define EXT2_BLOCK_SIZE(s) (1 << EXT2_BLOCK_SIZE_BITS(s)) 1.190 /* linux/ext2fs.h */ 1.191 @@ -321,7 +321,7 @@ 1.192 /* linux/stat.h */ 1.193 #define S_IFMT 00170000 1.194 #define S_IFLNK 0120000 1.195 -@@ -287,38 +398,82 @@ 1.196 +@@ -234,38 +398,82 @@ 1.197 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 1.198 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 1.199 1.200 @@ -424,7 +424,7 @@ 1.201 } 1.202 1.203 /* Takes a file system block number and reads it into BUFFER. */ 1.204 -@@ -329,7 +484,7 @@ 1.205 +@@ -276,7 +484,7 @@ 1.206 printf ("fsblock %d buffer %d\n", fsblock, buffer); 1.207 #endif /* E2DEBUG */ 1.208 return devread (fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), 0, 1.209 @@ -433,7 +433,7 @@ 1.210 } 1.211 1.212 /* from 1.213 -@@ -338,7 +493,7 @@ 1.214 +@@ -285,7 +493,7 @@ 1.215 /* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into 1.216 a physical block (the location in the file system) via an inode. */ 1.217 static int 1.218 @@ -442,7 +442,7 @@ 1.219 { 1.220 1.221 #ifdef E2DEBUG 1.222 -@@ -412,13 +567,16 @@ 1.223 +@@ -359,13 +567,16 @@ 1.224 /* else */ 1.225 mapblock2 = -1; 1.226 logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)); 1.227 @@ -459,7 +459,7 @@ 1.228 if (!ext2_rdfsb (((__u32 *) DATABLOCK1) 1.229 [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) 1.230 * 2)], 1.231 -@@ -427,7 +585,8 @@ 1.232 +@@ -374,7 +585,8 @@ 1.233 errnum = ERR_FSYS_CORRUPT; 1.234 return -1; 1.235 } 1.236 @@ -469,7 +469,7 @@ 1.237 [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)) 1.238 & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)], 1.239 DATABLOCK2)) 1.240 -@@ -435,30 +594,148 @@ 1.241 +@@ -382,30 +594,148 @@ 1.242 errnum = ERR_FSYS_CORRUPT; 1.243 return -1; 1.244 } 1.245 @@ -627,7 +627,7 @@ 1.246 { 1.247 printf ("\n"); 1.248 } 1.249 -@@ -469,41 +746,53 @@ 1.250 +@@ -416,41 +746,53 @@ 1.251 } 1.252 #endif /* E2DEBUG */ 1.253 while (len > 0) 1.254 @@ -694,7 +694,7 @@ 1.255 1.256 return ret; 1.257 } 1.258 -@@ -557,10 +846,10 @@ 1.259 +@@ -504,10 +846,10 @@ 1.260 int desc; /* index within that group */ 1.261 int ino_blk; /* fs pointer of the inode's information */ 1.262 int str_chk = 0; /* used to hold the results of a string compare */ 1.263 @@ -707,7 +707,7 @@ 1.264 int link_count = 0; 1.265 1.266 char *rest; 1.267 -@@ -590,7 +879,7 @@ 1.268 +@@ -537,7 +879,7 @@ 1.269 1.270 /* look up an inode */ 1.271 group_id = (current_ino - 1) / (SUPERBLOCK->s_inodes_per_group); 1.272 @@ -716,7 +716,7 @@ 1.273 desc = group_id & (EXT2_DESC_PER_BLOCK (SUPERBLOCK) - 1); 1.274 #ifdef E2DEBUG 1.275 printf ("ipg=%d, dpb=%d\n", SUPERBLOCK->s_inodes_per_group, 1.276 -@@ -603,10 +892,17 @@ 1.277 +@@ -550,10 +892,17 @@ 1.278 { 1.279 return 0; 1.280 } 1.281 @@ -732,25 +732,30 @@ 1.282 + } 1.283 + ino_blk = ext4_gdp->bg_inode_table + 1.284 (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group)) 1.285 -- >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK))); 1.286 +- >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode))); 1.287 + >> log2_tmp (EXT2_INODES_PER_BLOCK (SUPERBLOCK))); 1.288 #ifdef E2DEBUG 1.289 printf ("inode table fsblock=%d\n", ino_blk); 1.290 #endif /* E2DEBUG */ 1.291 -@@ -620,10 +916,10 @@ 1.292 +@@ -565,13 +914,12 @@ 1.293 + /* reset indirect blocks! */ 1.294 + mapblock2 = mapblock1 = -1; 1.295 1.296 - raw_inode = (struct ext2_inode *)((char *)INODE + 1.297 - ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * 1.298 -- EXT2_INODE_SIZE (SUPERBLOCK)); 1.299 +- raw_inode = INODE + 1.300 +- ((current_ino - 1) 1.301 +- & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1)); 1.302 ++ raw_inode = (struct ext2_inode *)((char *)INODE + 1.303 ++ ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * 1.304 + EXT2_INODE_SIZE (SUPERBLOCK)); 1.305 #ifdef E2DEBUG 1.306 printf ("ipb=%d, sizeof(inode)=%d\n", 1.307 -- EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK)); 1.308 +- (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)), 1.309 +- sizeof (struct ext2_inode)); 1.310 + EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK)); 1.311 printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode); 1.312 printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE); 1.313 for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode; 1.314 -@@ -661,13 +957,22 @@ 1.315 +@@ -609,13 +957,22 @@ 1.316 } 1.317 1.318 /* Find out how long our remaining name is. */ 1.319 @@ -777,7 +782,7 @@ 1.320 { 1.321 errnum = ERR_FILELENGTH; 1.322 return 0; 1.323 -@@ -681,18 +986,23 @@ 1.324 +@@ -629,18 +986,23 @@ 1.325 } 1.326 linkbuf[filemax + len] = '\0'; 1.327 1.328 @@ -804,7 +809,7 @@ 1.329 len = filemax; 1.330 memmove (linkbuf, (char *) INODE->i_block, len); 1.331 } 1.332 -@@ -726,6 +1036,13 @@ 1.333 +@@ -674,6 +1036,13 @@ 1.334 errnum = ERR_BAD_FILETYPE; 1.335 return 0; 1.336 } 1.337 @@ -818,7 +823,7 @@ 1.338 1.339 filemax = (INODE->i_size); 1.340 return 1; 1.341 -@@ -746,8 +1063,17 @@ 1.342 +@@ -694,8 +1063,17 @@ 1.343 } 1.344 1.345 /* skip to next slash or end of filename (space) */ 1.346 @@ -838,7 +843,7 @@ 1.347 1.348 /* look through this directory and find the next filename component */ 1.349 /* invariant: rest points to slash after the next filename component */ 1.350 -@@ -765,32 +1091,45 @@ 1.351 +@@ -713,32 +1091,45 @@ 1.352 give up */ 1.353 if (loc >= INODE->i_size) 1.354 { 1.355 @@ -891,7 +896,7 @@ 1.356 { 1.357 errnum = ERR_FSYS_CORRUPT; 1.358 *rest = ch; 1.359 -@@ -811,22 +1150,36 @@ 1.360 +@@ -759,22 +1150,36 @@ 1.361 1.362 if (dp->inode) 1.363 {