* grub-core/fs/jfs.c: Remove nested functions.
This commit is contained in:
parent
be42d97a79
commit
4fc40ff8f3
2 changed files with 65 additions and 60 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/fs/jfs.c: Remove nested functions.
|
||||||
|
|
||||||
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/fs/minix.c: Remove nested functions.
|
* grub-core/fs/minix.c: Remove nested functions.
|
||||||
|
|
|
@ -255,18 +255,12 @@ static grub_dl_t my_mod;
|
||||||
|
|
||||||
static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino);
|
static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino);
|
||||||
|
|
||||||
/* Get the block number for the block BLK in the node INODE in the
|
|
||||||
mounted filesystem DATA. */
|
|
||||||
static grub_int64_t
|
static grub_int64_t
|
||||||
grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
|
getblk (struct grub_jfs_treehead *treehead,
|
||||||
|
struct grub_jfs_tree_extent *extents,
|
||||||
|
struct grub_jfs_data *data,
|
||||||
grub_uint64_t blk)
|
grub_uint64_t blk)
|
||||||
{
|
{
|
||||||
auto grub_int64_t getblk (struct grub_jfs_treehead *treehead,
|
|
||||||
struct grub_jfs_tree_extent *extents);
|
|
||||||
|
|
||||||
grub_int64_t getblk (struct grub_jfs_treehead *treehead,
|
|
||||||
struct grub_jfs_tree_extent *extents)
|
|
||||||
{
|
|
||||||
int found = -1;
|
int found = -1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -302,13 +296,19 @@ grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
|
||||||
sizeof (tree), (char *) &tree))
|
sizeof (tree), (char *) &tree))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return getblk (&tree.treehead, &tree.extents[0]);
|
return getblk (&tree.treehead, &tree.extents[0], data, blk);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getblk (&inode->file.tree, &inode->file.extents[0]);
|
/* Get the block number for the block BLK in the node INODE in the
|
||||||
|
mounted filesystem DATA. */
|
||||||
|
static grub_int64_t
|
||||||
|
grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
|
||||||
|
grub_uint64_t blk)
|
||||||
|
{
|
||||||
|
return getblk (&inode->file.tree, &inode->file.extents[0], data, blk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -489,6 +489,13 @@ grub_jfs_closedir (struct grub_jfs_diropen *diro)
|
||||||
grub_free (diro);
|
grub_free (diro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
le_to_cpu16_copy (grub_uint16_t *out, grub_uint16_t *in, grub_size_t len)
|
||||||
|
{
|
||||||
|
while (len--)
|
||||||
|
*out++ = grub_le_to_cpu16 (*in++);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Read in the next dirent from the directory described by DIRO. */
|
/* Read in the next dirent from the directory described by DIRO. */
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
@ -501,15 +508,6 @@ grub_jfs_getent (struct grub_jfs_diropen *diro)
|
||||||
int nextent;
|
int nextent;
|
||||||
grub_uint16_t filename[256];
|
grub_uint16_t filename[256];
|
||||||
|
|
||||||
auto void addstr (grub_uint16_t *uname, int ulen);
|
|
||||||
|
|
||||||
/* Add the unicode string to the utf16 filename buffer. */
|
|
||||||
void addstr (grub_uint16_t *name, int ulen)
|
|
||||||
{
|
|
||||||
while (ulen--)
|
|
||||||
filename[strpos++] = grub_le_to_cpu16 (*(name++));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The last node, read in more. */
|
/* The last node, read in more. */
|
||||||
if (diro->index == diro->count)
|
if (diro->index == diro->count)
|
||||||
{
|
{
|
||||||
|
@ -547,8 +545,10 @@ grub_jfs_getent (struct grub_jfs_diropen *diro)
|
||||||
return grub_jfs_getent (diro);
|
return grub_jfs_getent (diro);
|
||||||
}
|
}
|
||||||
|
|
||||||
addstr (leaf->namepart, len < diro->data->namecomponentlen ? len
|
le_to_cpu16_copy (filename + strpos, leaf->namepart, len < diro->data->namecomponentlen ? len
|
||||||
: diro->data->namecomponentlen);
|
: diro->data->namecomponentlen);
|
||||||
|
strpos += len < diro->data->namecomponentlen ? len
|
||||||
|
: diro->data->namecomponentlen;
|
||||||
diro->ino = grub_le_to_cpu32 (leaf->inode);
|
diro->ino = grub_le_to_cpu32 (leaf->inode);
|
||||||
len -= diro->data->namecomponentlen;
|
len -= diro->data->namecomponentlen;
|
||||||
|
|
||||||
|
@ -558,7 +558,8 @@ grub_jfs_getent (struct grub_jfs_diropen *diro)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
next_leaf = &diro->next_leaf[nextent];
|
next_leaf = &diro->next_leaf[nextent];
|
||||||
addstr (next_leaf->namepart, len < 15 ? len : 15 );
|
le_to_cpu16_copy (filename + strpos, next_leaf->namepart, len < 15 ? len : 15);
|
||||||
|
strpos += len < 15 ? len : 15;
|
||||||
|
|
||||||
len -= 15;
|
len -= 15;
|
||||||
nextent = next_leaf->next;
|
nextent = next_leaf->next;
|
||||||
|
|
Loading…
Reference in a new issue