/* fs.c - filesystem manager */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
{
grub_fs_t p;
auto int dummy_func (const char *filename,
const struct grub_dirhook_info *info);
{
return 1;
}
{
/* Make it sure not to have an infinite recursive calls. */
static int count = 0;
for (p = grub_fs_list; p; p = p->next)
{
if (grub_errno == GRUB_ERR_NONE)
return p;
grub_error_push ();
grub_error_pop ();
if (grub_errno != GRUB_ERR_BAD_FS)
return 0;
}
/* Let's load modules automatically. */
if (grub_fs_autoload_hook && count == 0)
{
count++;
while (grub_fs_autoload_hook ())
{
p = grub_fs_list;
if (grub_errno == GRUB_ERR_NONE)
{
count--;
return p;
}
if (grub_errno != GRUB_ERR_BAD_FS)
{
count--;
return 0;
}
}
count--;
}
}
return 0;
}
/* Block list support routines. */
struct grub_fs_block
{
unsigned long length;
};
static grub_err_t
{
char *p = (char *) name;
unsigned num = 0;
unsigned i;
/* First, count the number of blocks. */
do
{
num++;
p = grub_strchr (p, ',');
if (p)
p++;
}
while (p);
/* Allocate a block list. */
if (! blocks)
return 0;
p = (char *) name;
for (i = 0; i < num; i++)
{
if (*p != '+')
{
{
"invalid file name `%s'", name);
goto fail;
}
}
p++;
if (grub_errno != GRUB_ERR_NONE
|| (*p && *p != ',' && ! grub_isspace (*p)))
{
"invalid file name `%s'", name);
goto fail;
}
{
goto fail;
}
p++;
}
return GRUB_ERR_NONE;
fail:
return grub_errno;
}
static grub_ssize_t
{
struct grub_fs_block *p;
{
{
return -1;
}
else
}
return ret;
}
{
.name = "blocklist",
.dir = 0,
.close = 0,
.next = 0
};