2005-07-03 Yoshinori Okuji <okuji@enbug.org>

* DISTLIST: Added genfslist.sh.

	* normal/main.c (fs_module_list): New variable.
	(autoload_fs_module): New function.
	(read_fs_list): Likewise.
	(grub_normal_execute): Call read_fs_list.

	* kern/fs.c (grub_fs_autoload_hook): New variable.
	(grub_fs_probe): Added support for auto-loading.

	* include/grub/normal.h (struct grub_fs_module_list): New struct.
	(grub_fs_module_list_t): New type.

	* include/grub/fs.h (grub_fs_autoload_hook_t): New type.
	(grub_fs_autoload_hook): New prototype.

	* genfslist.sh: New file.

	* genmk.rb: Added a rule to generate a filesystem list.
This commit is contained in:
okuji 2005-07-03 18:06:56 +00:00
parent 121c1d832e
commit 39c9d41d2a
10 changed files with 663 additions and 84 deletions

View file

@ -1,7 +1,7 @@
/* fs.c - filesystem manager */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
* Copyright (C) 2002,2005 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,8 @@
static grub_fs_t grub_fs_list;
grub_fs_autoload_hook_t grub_fs_autoload_hook = 0;
void
grub_fs_register (grub_fs_t fs)
{
@ -74,6 +76,9 @@ grub_fs_probe (grub_device_t device)
if (device->disk)
{
/* Make it sure not to have an infinite recursive calls. */
static int count = 0;
for (p = grub_fs_list; p; p = p->next)
{
(p->dir) (device, "/", dummy_func);
@ -85,6 +90,34 @@ grub_fs_probe (grub_device_t device)
grub_errno = GRUB_ERR_NONE;
}
/* Let's load modules automatically. */
if (grub_fs_autoload_hook && count == 0)
{
count++;
while (grub_fs_autoload_hook ())
{
p = grub_fs_list;
(p->dir) (device, "/", dummy_func);
if (grub_errno == GRUB_ERR_NONE)
{
count--;
return p;
}
if (grub_errno != GRUB_ERR_BAD_FS)
{
count--;
return 0;
}
grub_errno = GRUB_ERR_NONE;
}
count--;
}
}
else if (device->net->fs)
return device->net->fs;