* grub-core/kern/emu/hostdisk.c: Add conditionals for OpenBSD.
* util/getroot.c: Likewise.
This commit is contained in:
parent
54ea2f4401
commit
0031b22993
3 changed files with 30 additions and 13 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-08-21 Ilya Bakulin <Ilya_Bakulin@genua.de>
|
||||
|
||||
* grub-core/kern/emu/hostdisk.c: Add conditionals for OpenBSD.
|
||||
* util/getroot.c: Likewise.
|
||||
|
||||
2013-08-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/disk/ahci.c: Add needed explicit cast.
|
||||
|
|
|
@ -98,7 +98,7 @@ struct hd_geometry
|
|||
# include <libdevmapper.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
# define HAVE_DIOCGDINFO
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/disklabel.h> /* struct disklabel */
|
||||
|
@ -107,11 +107,16 @@ struct hd_geometry
|
|||
# undef HAVE_DIOCGDINFO
|
||||
#endif /* defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
# ifdef HAVE_GETRAWPARTITION
|
||||
# include <util.h> /* getrawpartition */
|
||||
# endif /* HAVE_GETRAWPARTITION */
|
||||
# if defined(__NetBSD__)
|
||||
# include <sys/fdio.h>
|
||||
# endif
|
||||
# if defined(__OpenBSD__)
|
||||
# include <sys/dkio.h>
|
||||
# endif
|
||||
# ifndef RAW_FLOPPY_MAJOR
|
||||
# define RAW_FLOPPY_MAJOR 9
|
||||
# endif /* ! RAW_FLOPPY_MAJOR */
|
||||
|
@ -245,7 +250,7 @@ grub_uint64_t
|
|||
grub_util_get_fd_size (int fd, const char *name, unsigned *log_secsize)
|
||||
{
|
||||
#if !defined (__GNU__)
|
||||
# if defined(__NetBSD__)
|
||||
# if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
struct disklabel label;
|
||||
# elif defined (__sun__)
|
||||
struct dk_minfo minfo;
|
||||
|
@ -262,9 +267,9 @@ grub_util_get_fd_size (int fd, const char *name, unsigned *log_secsize)
|
|||
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) \
|
||||
|| defined (__sun__)
|
||||
|| defined (__sun__) || defined(__OpenBSD__)
|
||||
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) || defined (__sun__)
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) || defined (__sun__) || defined(__OpenBSD__)
|
||||
if (! S_ISCHR (st.st_mode))
|
||||
# else
|
||||
if (! S_ISBLK (st.st_mode))
|
||||
|
@ -275,8 +280,10 @@ grub_util_get_fd_size (int fd, const char *name, unsigned *log_secsize)
|
|||
if (ioctl (fd, DIOCGMEDIASIZE, &nr))
|
||||
# elif defined(__APPLE__)
|
||||
if (ioctl (fd, DKIOCGETBLOCKCOUNT, &nr))
|
||||
# elif defined(__NetBSD__)
|
||||
# elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
# if defined(__NetBSD__)
|
||||
configure_device_driver (fd);
|
||||
# endif
|
||||
if (ioctl (fd, DIOCGDINFO, &label) == -1)
|
||||
# elif defined (__sun__)
|
||||
if (!ioctl (fd, DKIOCGMEDIAINFO, &minfo))
|
||||
|
@ -293,7 +300,7 @@ grub_util_get_fd_size (int fd, const char *name, unsigned *log_secsize)
|
|||
goto fail;
|
||||
# elif defined(__sun__)
|
||||
sector_size = minfo.dki_lbsize;
|
||||
# elif defined(__NetBSD__)
|
||||
# elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
sector_size = label.d_secsize;
|
||||
# else
|
||||
if (ioctl (fd, BLKSSZGET, §or_size))
|
||||
|
@ -310,7 +317,7 @@ grub_util_get_fd_size (int fd, const char *name, unsigned *log_secsize)
|
|||
|
||||
# if defined (__APPLE__)
|
||||
return nr << log_sector_size;
|
||||
# elif defined(__NetBSD__)
|
||||
# elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
return (grub_uint64_t) label.d_secperunit << log_sector_size;
|
||||
# elif defined (__sun__)
|
||||
return minfo.dki_capacity << log_sector_size;
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
|
||||
# include <sys/param.h>
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
|
@ -121,7 +122,7 @@
|
|||
# include <libdevmapper.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
# define HAVE_DIOCGDINFO
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/disklabel.h> /* struct disklabel */
|
||||
|
@ -130,11 +131,13 @@
|
|||
# undef HAVE_DIOCGDINFO
|
||||
#endif /* defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
# ifdef HAVE_GETRAWPARTITION
|
||||
# include <util.h> /* getrawpartition */
|
||||
# endif /* HAVE_GETRAWPARTITION */
|
||||
#if defined(__NetBSD__)
|
||||
# include <sys/fdio.h>
|
||||
#endif
|
||||
# ifndef FLOPPY_MAJOR
|
||||
# define FLOPPY_MAJOR 2
|
||||
# endif /* ! FLOPPY_MAJOR */
|
||||
|
@ -2121,7 +2124,7 @@ devmapper_out:
|
|||
}
|
||||
return path;
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int rawpart = -1;
|
||||
# ifdef HAVE_GETRAWPARTITION
|
||||
rawpart = getrawpartition();
|
||||
|
@ -2129,6 +2132,7 @@ devmapper_out:
|
|||
if (rawpart < 0)
|
||||
return xstrdup (os_dev);
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
/* NetBSD disk wedges are of the form "/dev/rdk.*". */
|
||||
if (strncmp ("/dev/rdk", os_dev, sizeof("/dev/rdk") - 1) == 0)
|
||||
{
|
||||
|
@ -2155,6 +2159,7 @@ devmapper_out:
|
|||
close (fd);
|
||||
return xasprintf ("/dev/r%s%c", dkw.dkw_parent, 'a' + rawpart);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* NetBSD (disk label) partitions are of the form "/dev/r[a-z]+[0-9][a-z]". */
|
||||
if (strncmp ("/dev/r", os_dev, sizeof("/dev/r") - 1) == 0 &&
|
||||
|
@ -2357,7 +2362,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
#endif
|
||||
return make_device_name (drive, -1, -1);
|
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined (__sun__)
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined (__sun__) || defined(__OpenBSD__)
|
||||
|
||||
/* Linux counts partitions uniformly, whether a BSD partition or a DOS
|
||||
partition, so mapping them to GRUB devices is not trivial.
|
||||
|
|
Loading…
Reference in a new issue