Support triple indirect on minix2 and minix3.

* grub-core/fs/minix.c (grub_minix_inode) [MODE_MINIX2 || MODE_MINIX3]:
	Declare triple_indir_zone.
	(grub_minix_get_file_block) [MODE_MINIX2 || MODE_MINIX3]: Handle triple
	indirect.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-10-24 16:16:28 +02:00
parent e0864e7ab7
commit 6e536dc8ad
2 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2011-10-24 Vladimir Serbinenko <phcoder@gmail.com>
Support triple indirect on minix2 and minix3.
* grub-core/fs/minix.c (grub_minix_inode) [MODE_MINIX2 || MODE_MINIX3]:
Declare triple_indir_zone.
(grub_minix_get_file_block) [MODE_MINIX2 || MODE_MINIX3]: Handle triple
indirect.
2011-10-24 Vladimir Serbinenko <phcoder@gmail.com>
Minix FS fixes.

View file

@ -132,7 +132,7 @@ struct grub_minix_inode
grub_uint32_t dir_zones[7];
grub_uint32_t indir_zone;
grub_uint32_t double_indir_zone;
grub_uint32_t unused;
grub_uint32_t triple_indir_zone;
};
#else
struct grub_minix_inode
@ -213,6 +213,20 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
return indir;
}
#if defined (MODE_MINIX3) || defined (MODE_MINIX2)
blk -= block_per_zone * block_per_zone;
if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone
* (grub_uint64_t) block_per_zone))
{
indir = grub_get_indir (grub_minix_le_to_cpu_n (data->inode.triple_indir_zone),
(blk / block_per_zone) / block_per_zone);
indir = grub_get_indir (indir, (blk / block_per_zone) % block_per_zone);
indir = grub_get_indir (indir, blk % block_per_zone);
return indir;
}
#endif
/* This should never happen. */
grub_error (GRUB_ERR_OUT_OF_RANGE, "file bigger than maximum size");