Remove nested functions from filesystem directory iterators.
* include/grub/fs.h (grub_fs_dir_hook_t): New type. (struct grub_fs.dir): Add hook_data argument. Update all implementations and callers.
This commit is contained in:
parent
53d3e4e3df
commit
fc524edf65
35 changed files with 1723 additions and 1451 deletions
|
@ -105,7 +105,8 @@ grub_mini_print_devices (const char *name, void *data __attribute__ ((unused)))
|
|||
|
||||
static int
|
||||
grub_mini_print_files (const char *filename,
|
||||
const struct grub_dirhook_info *info)
|
||||
const struct grub_dirhook_info *info,
|
||||
void *data __attribute__ ((unused)))
|
||||
{
|
||||
grub_printf ("%s%s ", filename, info->dir ? "/" : "");
|
||||
|
||||
|
@ -160,7 +161,7 @@ grub_core_cmd_ls (struct grub_command *cmd __attribute__ ((unused)),
|
|||
}
|
||||
else if (fs)
|
||||
{
|
||||
(fs->dir) (dev, path, grub_mini_print_files);
|
||||
(fs->dir) (dev, path, grub_mini_print_files, NULL);
|
||||
grub_xputs ("\n");
|
||||
grub_refresh ();
|
||||
}
|
||||
|
|
|
@ -65,8 +65,7 @@ struct grub_hostfs_data
|
|||
|
||||
static grub_err_t
|
||||
grub_hostfs_dir (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename,
|
||||
const struct grub_dirhook_info *info))
|
||||
grub_fs_dir_hook_t hook, void *hook_data)
|
||||
{
|
||||
DIR *dir;
|
||||
|
||||
|
@ -91,7 +90,7 @@ grub_hostfs_dir (grub_device_t device, const char *path,
|
|||
break;
|
||||
|
||||
info.dir = !! is_dir (path, de->d_name);
|
||||
hook (de->d_name, &info);
|
||||
hook (de->d_name, &info, hook_data);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,11 @@ grub_fs_autoload_hook_t grub_fs_autoload_hook = 0;
|
|||
/* Helper for grub_fs_probe. */
|
||||
static int
|
||||
probe_dummy_iter (const char *filename __attribute__ ((unused)),
|
||||
const struct grub_dirhook_info *info __attribute__ ((unused)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
const struct grub_dirhook_info *info __attribute__ ((unused)),
|
||||
void *data __attribute__ ((unused)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_fs_t
|
||||
grub_fs_probe (grub_device_t device)
|
||||
|
@ -69,7 +70,7 @@ grub_fs_probe (grub_device_t device)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
(p->dir) (device, "/", probe_dummy_iter);
|
||||
(p->dir) (device, "/", probe_dummy_iter, NULL);
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
return p;
|
||||
|
||||
|
@ -93,7 +94,7 @@ grub_fs_probe (grub_device_t device)
|
|||
{
|
||||
p = grub_fs_list;
|
||||
|
||||
(p->dir) (device, "/", probe_dummy_iter);
|
||||
(p->dir) (device, "/", probe_dummy_iter, NULL);
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
{
|
||||
count--;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue