call fstat to get a geometry on Hurd, don't include linux/cdrom.h any longer.

This commit is contained in:
okuji 2000-09-30 17:56:29 +00:00
parent 504e540242
commit 62eafe888b
4 changed files with 50 additions and 4 deletions

View file

@ -1,3 +1,15 @@
2000-10-01 OKUJI Yoshinori <okuji@gnu.org>
* lib/device.c [__linux__]: Don't include <linux/cdrom.h>.
[__linux__ && !CDROM_GET_CAPABILITY] (CDROM_GET_CAPABILITY):
Defined as 0x5331.
2000-10-01 OKUJI Yoshinori <okuji@gnu.org>
* lib/device.c (get_drive_geometry) [__GNU__]: Get the number of
total sectors by fstat. The rest are filled with arbitrary
values.
2000-09-30 OKUJI Yoshinori <okuji@gnu.org> 2000-09-30 OKUJI Yoshinori <okuji@gnu.org>
* util/grub-install.in (convert): The code for gnu* (i.e. * util/grub-install.in (convert): The code for gnu* (i.e.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020.
.TH GRUB "8" "September 2000" "grub (GNU GRUB 0.5.96)" FSF .TH GRUB "8" "October 2000" "grub (GNU GRUB 0.5.96)" FSF
.SH NAME .SH NAME
grub \- the grub shell grub \- the grub shell
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020.
.TH MBCHK "1" "September 2000" "mbchk (GNU GRUB 0.5.96)" FSF .TH MBCHK "1" "October 2000" "mbchk (GNU GRUB 0.5.96)" FSF
.SH NAME .SH NAME
mbchk \- check the format of a Multiboot kernel mbchk \- check the format of a Multiboot kernel
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -44,7 +44,9 @@
# include <linux/hdreg.h> /* HDIO_GETGEO */ # include <linux/hdreg.h> /* HDIO_GETGEO */
# include <linux/major.h> /* FLOPPY_MAJOR */ # include <linux/major.h> /* FLOPPY_MAJOR */
# include <linux/kdev_t.h> /* MAJOR */ # include <linux/kdev_t.h> /* MAJOR */
# include <linux/cdrom.h> /* CDROM_GET_CAPABILITY */ # ifndef CDROM_GET_CAPABILITY
# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
# endif /* ! CDROM_GET_CAPABILITY */
# ifndef BLKGETSIZE # ifndef BLKGETSIZE
# define BLKGETSIZE _IO(0x12,96) /* return device size */ # define BLKGETSIZE _IO(0x12,96) /* return device size */
# endif /* ! BLKGETSIZE */ # endif /* ! BLKGETSIZE */
@ -94,7 +96,39 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
close (fd); close (fd);
return; return;
} }
#elif defined(__GNU__)
# warning "Automatic detection of geometries will be performed only \
partially. This is not fatal."
/* Hurd */
{
/* For now, Hurd doesn't support the system call to get a geometry
from Mach, so get only the number of total sectors. */
struct stat st;
if (fstat (fd, &st) || ! st.st_blocks)
goto fail;
geom->total_sectors = st.st_blocks;
/* Set the rest arbitrarily. */
if (drive & 0x80)
{
geom->cylinders = DEFAULT_HD_CYLINDERS;
geom->heads = DEFAULT_HD_HEADS;
geom->sectors = DEFAULT_HD_SECTORS;
}
else
{
geom->cylinders = DEFAULT_FD_CYLINDERS;
geom->heads = DEFAULT_FD_HEADS;
geom->sectors = DEFAULT_FD_SECTORS;
}
close (fd);
return;
}
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
/* FreeBSD, NetBSD or OpenBSD */ /* FreeBSD, NetBSD or OpenBSD */
{ {