Remove nested functions from disk and file read hooks.

* include/grub/disk.h (grub_disk_read_hook_t): New type.
	(struct grub_disk): Add read_hook_data member.
	* include/grub/file.h (struct grub_file): Likewise.
	* include/grub/fshelp.h (grub_fshelp_read_file): Add read_hook_data
	argument.

	Update all callers.
This commit is contained in:
Colin Watson 2013-02-27 17:19:15 +01:00 committed by Vladimir 'phcoder' Serbinenko
parent df6da5a52d
commit 4eb8b75659
29 changed files with 409 additions and 345 deletions

View file

@ -379,11 +379,11 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
POS. Return the amount of read bytes in READ. */
static grub_ssize_t
grub_xfs_read_file (grub_fshelp_node_t node,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset, unsigned length),
grub_disk_read_hook_t read_hook, void *read_hook_data,
grub_off_t pos, grub_size_t len, char *buf)
{
return grub_fshelp_read_file (node->data->disk, node, read_hook,
return grub_fshelp_read_file (node->data->disk, node,
read_hook, read_hook_data,
pos, len, buf, grub_xfs_read_block,
grub_be_to_cpu64 (node->inode.size),
node->data->sblock.log2_bsize
@ -410,7 +410,7 @@ grub_xfs_read_symlink (grub_fshelp_node_t node)
if (!symlink)
return 0;
numread = grub_xfs_read_file (node, 0, 0, size, symlink);
numread = grub_xfs_read_file (node, 0, 0, 0, size, symlink);
if (numread != size)
{
grub_free (symlink);
@ -592,7 +592,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
struct grub_xfs_dirblock_tail *tail;
tail = (struct grub_xfs_dirblock_tail *) &dirblock[tail_start];
numread = grub_xfs_read_file (dir, 0,
numread = grub_xfs_read_file (dir, 0, 0,
blk << dirblk_log2,
dirblk_size, dirblock);
if (numread != dirblk_size)
@ -829,8 +829,9 @@ grub_xfs_read (grub_file_t file, char *buf, grub_size_t len)
struct grub_xfs_data *data =
(struct grub_xfs_data *) file->data;
return grub_xfs_read_file (&data->diropen, file->read_hook,
file->offset, len, buf);
return grub_xfs_read_file (&data->diropen,
file->read_hook, file->read_hook_data,
file->offset, len, buf);
}