2009-04-11 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c [__FreeBSD_kernel__]: Include sys/disk.h. (grub_util_biosdisk_open) [__FreeBSD_kernel__]: Add support for GNU/kFreeBSD. Check if a device is a character device. Use DIOCGMEDIASIZE to get the size. (convert_system_partition_to_system_disk) [__FreeBSD_kernel__]: Add support for GNU/kFreeBSD. (grub_util_biosdisk_get_grub_dev) [__FreeBSD_kernel__]: Check if OS_DEV is a character device instead of a block device. Add support for FreeBSD device names. * util/getroot.c (find_root_device) [__FreeBSD_kernel__]: Check if ENT is a character device instead of a block device. * util/grub-probe.c (probe) [__FreeBSD_kernel__]: Check if DEVICE_NAME is a character device instead of a block device.
This commit is contained in:
parent
ed3d2bc23d
commit
c91e1793bf
4 changed files with 27 additions and 9 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2009-04-11 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/hostdisk.c [__FreeBSD_kernel__]: Include sys/disk.h.
|
||||
(grub_util_biosdisk_open) [__FreeBSD_kernel__]: Add support for
|
||||
GNU/kFreeBSD. Check if a device is a character device. Use
|
||||
DIOCGMEDIASIZE to get the size.
|
||||
(convert_system_partition_to_system_disk) [__FreeBSD_kernel__]: Add
|
||||
support for GNU/kFreeBSD.
|
||||
(grub_util_biosdisk_get_grub_dev) [__FreeBSD_kernel__]: Check if OS_DEV
|
||||
is a character device instead of a block device. Add support for
|
||||
FreeBSD device names.
|
||||
|
||||
* util/getroot.c (find_root_device) [__FreeBSD_kernel__]: Check if ENT
|
||||
is a character device instead of a block device.
|
||||
|
||||
* util/grub-probe.c (probe) [__FreeBSD_kernel__]: Check if DEVICE_NAME
|
||||
is a character device instead of a block device.
|
||||
|
||||
2009-04-11 Andrey Shuvikov <mr_hyro@yahoo.com>
|
||||
|
||||
* util/hostdisk.c [__FreeBSD__]: Include sys/disk.h.
|
||||
|
|
|
@ -238,7 +238,7 @@ find_root_device (const char *dir, dev_t dev)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (S_ISCHR (st.st_mode) && st.st_rdev == dev)
|
||||
#else
|
||||
if (S_ISBLK (st.st_mode) && st.st_rdev == dev)
|
||||
|
|
|
@ -112,7 +112,7 @@ probe (const char *path, char *device_name)
|
|||
|
||||
if (path == NULL)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (! grub_util_check_char_device (device_name))
|
||||
grub_util_error ("%s is not a character device.\n", device_name);
|
||||
#else
|
||||
|
|
|
@ -86,7 +86,7 @@ struct hd_geometry
|
|||
# define FLOPPY_MAJOR 2
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
# include <sys/disk.h> /* DIOCGMEDIASIZE */
|
||||
#endif
|
||||
|
||||
|
@ -183,7 +183,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#elif defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__)
|
||||
#elif defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
{
|
||||
unsigned long long nr;
|
||||
int fd;
|
||||
|
@ -192,7 +192,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
if (fd == -1)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk size", map[drive].device);
|
||||
|
||||
# if defined(__FreeBSD__)
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode))
|
||||
# else
|
||||
if (fstat (fd, &st) < 0 || ! S_ISBLK (st.st_mode))
|
||||
|
@ -202,7 +202,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
# if defined(__FreeBSD__)
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (ioctl (fd, DIOCGMEDIASIZE, &nr))
|
||||
# else
|
||||
if (ioctl (fd, BLKGETSIZE64, &nr))
|
||||
|
@ -758,7 +758,7 @@ convert_system_partition_to_system_disk (const char *os_dev)
|
|||
path[8] = 0;
|
||||
return path;
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
char *path = xstrdup (os_dev);
|
||||
if (strncmp ("/dev/", path, 5) == 0)
|
||||
{
|
||||
|
@ -821,7 +821,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (! S_ISCHR (st.st_mode))
|
||||
#else
|
||||
if (! S_ISBLK (st.st_mode))
|
||||
|
@ -970,7 +970,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
return make_device_name (drive, dos_part, bsd_part);
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* FreeBSD uses "/dev/[a-z]+[0-9]+(s[0-9]+[a-z]?)?". */
|
||||
{
|
||||
int dos_part = -1;
|
||||
|
|
Loading…
Reference in a new issue