* grub-core/fs/minix.c: Remove nested functions.
This commit is contained in:
parent
99373ce472
commit
be42d97a79
2 changed files with 24 additions and 21 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/fs/minix.c: Remove nested functions.
|
||||||
|
|
||||||
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/fs/iso9660.c: Remove nested functions.
|
* grub-core/fs/iso9660.c: Remove nested functions.
|
||||||
|
|
|
@ -178,6 +178,20 @@ static grub_dl_t my_mod;
|
||||||
static grub_err_t grub_minix_find_file (struct grub_minix_data *data,
|
static grub_err_t grub_minix_find_file (struct grub_minix_data *data,
|
||||||
const char *path);
|
const char *path);
|
||||||
|
|
||||||
|
/* Read the block pointer in ZONE, on the offset NUM. */
|
||||||
|
static grub_minix_uintn_t
|
||||||
|
grub_get_indir (struct grub_minix_data *data,
|
||||||
|
grub_minix_uintn_t zone,
|
||||||
|
grub_minix_uintn_t num)
|
||||||
|
{
|
||||||
|
grub_minix_uintn_t indirn;
|
||||||
|
grub_disk_read (data->disk,
|
||||||
|
GRUB_MINIX_ZONE2SECT(zone),
|
||||||
|
sizeof (grub_minix_uintn_t) * num,
|
||||||
|
sizeof (grub_minix_uintn_t), (char *) &indirn);
|
||||||
|
return grub_minix_to_cpu_n (indirn);
|
||||||
|
}
|
||||||
|
|
||||||
static grub_minix_uintn_t
|
static grub_minix_uintn_t
|
||||||
grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
||||||
{
|
{
|
||||||
|
@ -185,21 +199,6 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
||||||
const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ
|
const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ
|
||||||
/ GRUB_MINIX_INODE_BLKSZ (data));
|
/ GRUB_MINIX_INODE_BLKSZ (data));
|
||||||
|
|
||||||
auto grub_minix_uintn_t grub_get_indir (grub_minix_uintn_t,
|
|
||||||
grub_minix_uintn_t);
|
|
||||||
|
|
||||||
/* Read the block pointer in ZONE, on the offset NUM. */
|
|
||||||
grub_minix_uintn_t grub_get_indir (grub_minix_uintn_t zone,
|
|
||||||
grub_minix_uintn_t num)
|
|
||||||
{
|
|
||||||
grub_minix_uintn_t indirn;
|
|
||||||
grub_disk_read (data->disk,
|
|
||||||
GRUB_MINIX_ZONE2SECT(zone),
|
|
||||||
sizeof (grub_minix_uintn_t) * num,
|
|
||||||
sizeof (grub_minix_uintn_t), (char *) &indirn);
|
|
||||||
return grub_minix_to_cpu_n (indirn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Direct block. */
|
/* Direct block. */
|
||||||
if (blk < GRUB_MINIX_INODE_DIR_BLOCKS)
|
if (blk < GRUB_MINIX_INODE_DIR_BLOCKS)
|
||||||
return GRUB_MINIX_INODE_DIR_ZONES (data, blk);
|
return GRUB_MINIX_INODE_DIR_ZONES (data, blk);
|
||||||
|
@ -208,7 +207,7 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
||||||
blk -= GRUB_MINIX_INODE_DIR_BLOCKS;
|
blk -= GRUB_MINIX_INODE_DIR_BLOCKS;
|
||||||
if (blk < block_per_zone)
|
if (blk < block_per_zone)
|
||||||
{
|
{
|
||||||
indir = grub_get_indir (GRUB_MINIX_INODE_INDIR_ZONE (data), blk);
|
indir = grub_get_indir (data, GRUB_MINIX_INODE_INDIR_ZONE (data), blk);
|
||||||
return indir;
|
return indir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,10 +215,10 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
||||||
blk -= block_per_zone;
|
blk -= block_per_zone;
|
||||||
if (blk < block_per_zone * block_per_zone)
|
if (blk < block_per_zone * block_per_zone)
|
||||||
{
|
{
|
||||||
indir = grub_get_indir (GRUB_MINIX_INODE_DINDIR_ZONE (data),
|
indir = grub_get_indir (data, GRUB_MINIX_INODE_DINDIR_ZONE (data),
|
||||||
blk / block_per_zone);
|
blk / block_per_zone);
|
||||||
|
|
||||||
indir = grub_get_indir (indir, blk % block_per_zone);
|
indir = grub_get_indir (data, indir, blk % block_per_zone);
|
||||||
|
|
||||||
return indir;
|
return indir;
|
||||||
}
|
}
|
||||||
|
@ -229,10 +228,10 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
||||||
if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone
|
if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone
|
||||||
* (grub_uint64_t) block_per_zone))
|
* (grub_uint64_t) block_per_zone))
|
||||||
{
|
{
|
||||||
indir = grub_get_indir (grub_minix_to_cpu_n (data->inode.triple_indir_zone),
|
indir = grub_get_indir (data, grub_minix_to_cpu_n (data->inode.triple_indir_zone),
|
||||||
(blk / block_per_zone) / block_per_zone);
|
(blk / block_per_zone) / block_per_zone);
|
||||||
indir = grub_get_indir (indir, (blk / block_per_zone) % block_per_zone);
|
indir = grub_get_indir (data, indir, (blk / block_per_zone) % block_per_zone);
|
||||||
indir = grub_get_indir (indir, blk % block_per_zone);
|
indir = grub_get_indir (data, indir, blk % block_per_zone);
|
||||||
|
|
||||||
return indir;
|
return indir;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue