* grub-core/fs/minix.c: Remove nested functions.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-02-28 10:50:01 +01:00
parent 99373ce472
commit be42d97a79
2 changed files with 24 additions and 21 deletions

View file

@ -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.

View file

@ -178,18 +178,10 @@ 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);
static grub_minix_uintn_t
grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
{
grub_minix_uintn_t indir;
const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ
/ 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. */ /* Read the block pointer in ZONE, on the offset NUM. */
grub_minix_uintn_t grub_get_indir (grub_minix_uintn_t zone, 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 num)
{ {
grub_minix_uintn_t indirn; grub_minix_uintn_t indirn;
@ -200,6 +192,13 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
return grub_minix_to_cpu_n (indirn); return grub_minix_to_cpu_n (indirn);
} }
static grub_minix_uintn_t
grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
{
grub_minix_uintn_t indir;
const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ
/ GRUB_MINIX_INODE_BLKSZ (data));
/* 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;
} }