2011-06-16 Robert Millan <rmh@gnu.org>

Detect `ataraid' devices on GNU/kFreeBSD.  Fix for ATA devices using
        `ata' driver on kernel of FreeBSD 9.

        * util/deviceiter.c [__FreeBSD_kernel__] (get_ada_disk_name)
        (get_ataraid_disk_name): New functions.
        [__FreeBSD_kernel__] (grub_util_iterate_devices): Scan for ataraid
        (/dev/ar[0-9]+) and ada (/dev/ada[0-9]+) devices using
        get_ataraid_disk_name() and get_ada_disk_name().
This commit is contained in:
Robert Millan 2011-06-16 14:33:11 +02:00
parent 1e9aef7d96
commit 881ac815d0
2 changed files with 55 additions and 1 deletions

View file

@ -1,3 +1,14 @@
2011-06-16 Robert Millan <rmh@gnu.org>
Detect `ataraid' devices on GNU/kFreeBSD. Fix for ATA devices using
`ata' driver on kernel of FreeBSD 9.
* util/deviceiter.c [__FreeBSD_kernel__] (get_ada_disk_name)
(get_ataraid_disk_name): New functions.
[__FreeBSD_kernel__] (grub_util_iterate_devices): Scan for ataraid
(/dev/ar[0-9]+) and ada (/dev/ada[0-9]+) devices using
get_ataraid_disk_name() and get_ada_disk_name().
2011-06-13 Colin Watson <cjwatson@ubuntu.com>
* docs/man/grub-mklayout.h2m (DESCRIPTION): Add a reference to the

View file

@ -1,7 +1,7 @@
/* deviceiter.c - iterate over system devices */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2011 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
@ -286,6 +286,20 @@ get_scsi_disk_name (char *name, int unit)
#endif
}
#ifdef __FreeBSD_kernel__
static void
get_ada_disk_name (char *name, int unit)
{
sprintf (name, "/dev/ada%d", unit);
}
static void
get_ataraid_disk_name (char *name, int unit)
{
sprintf (name, "/dev/ar%d", unit);
}
#endif
#ifdef __linux__
static void
get_virtio_disk_name (char *name, int unit)
@ -620,6 +634,35 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
}
}
#ifdef __FreeBSD_kernel__
/* IDE disks using ATA Direct Access driver. */
if (get_kfreebsd_version () >= 800000)
for (i = 0; i < 96; i++)
{
char name[16];
get_ada_disk_name (name, i);
if (check_device_readable_unique (name))
{
if (hook (name, 0))
goto out;
}
}
/* ATARAID disks. */
for (i = 0; i < 8; i++)
{
char name[20];
get_ataraid_disk_name (name, i);
if (check_device_readable_unique (name))
{
if (hook (name, 0))
goto out;
}
}
#endif
#ifdef __linux__
/* Virtio disks. */
for (i = 0; i < 26; i++)