/* device.c - device manager */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2007,2008,2009 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/>.
*/
#include <grub/partition.h>
{
if (! name)
{
{
goto fail;
}
}
if (! dev)
goto fail;
/* Try to open a disk. */
return dev;
{
}
return dev;
fail:
if (disk)
return 0;
}
{
{
}
return grub_errno;
}
int
{
auto int iterate_disk (const char *disk_name);
const grub_partition_t partition);
struct part_ent
{
char *name;
} *ents;
{
return 1;
if (! dev)
{
return 0;
}
{
struct part_ent *p;
int ret = 0;
p = ents;
while (p != NULL)
{
if (!ret)
grub_free (p);
p = next;
}
return ret;
}
return 0;
}
{
struct part_ent *p;
char *part_name;
p = grub_malloc (sizeof (*p));
if (!p)
{
return 1;
}
if (!part_name)
{
grub_free (p);
return 1;
}
if (!p->name)
{
grub_free (p);
return 1;
}
ents = p;
return 0;
}
/* Only disk devices are supported at the moment. */
return grub_disk_dev_iterate (iterate_disk);
}