2004-03-12 Yoshinori K. Okuji <okuji@enbug.org>
From Sergey Matveychuk <sem@ciam.ru>: * lib/device.c (get_drive_geometry): Do not open the same device more than once unnecessarily. (get_drive_geometry) [__FreeBSD_version >= 500040]: Use new ioctl methods. (get_floppy_disk_name) [__FreeBSD__ >= 4]: Use /dev/fd%d rather than /dev/rfd%d. (get_ide_disk_name) [__FreeBSD__ >= 4]: Use /dev/ad%d rather than /dev/rad%d. (get_scsi_disk_name) [__FreeBSD__ >= 4]: Use /dev/da%d rather than /dev/rda%d. * grub/asmstub.c (get_diskinfo): Check if ERRNO is EPERM as well.
This commit is contained in:
parent
8f31d2ff88
commit
9b1392428c
7 changed files with 87 additions and 12 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2004-03-12 Yoshinori K. Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
|
From Sergey Matveychuk <sem@ciam.ru>:
|
||||||
|
* lib/device.c (get_drive_geometry): Do not open the same device
|
||||||
|
more than once unnecessarily.
|
||||||
|
(get_drive_geometry) [__FreeBSD_version >= 500040]: Use new
|
||||||
|
ioctl methods.
|
||||||
|
(get_floppy_disk_name) [__FreeBSD__ >= 4]: Use /dev/fd%d rather
|
||||||
|
than /dev/rfd%d.
|
||||||
|
(get_ide_disk_name) [__FreeBSD__ >= 4]: Use /dev/ad%d rather
|
||||||
|
than /dev/rad%d.
|
||||||
|
(get_scsi_disk_name) [__FreeBSD__ >= 4]: Use /dev/da%d rather
|
||||||
|
than /dev/rda%d.
|
||||||
|
* grub/asmstub.c (get_diskinfo): Check if ERRNO is EPERM as
|
||||||
|
well.
|
||||||
|
|
||||||
2004-02-28 Jeroen Dekkers <jeroen@dekkers.cx>
|
2004-02-28 Jeroen Dekkers <jeroen@dekkers.cx>
|
||||||
|
|
||||||
* docs/grub.texi (partnew): Change @var{to} to @var{len}.
|
* docs/grub.texi (partnew): Change @var{to} to @var{len}.
|
||||||
|
|
4
NEWS
4
NEWS
|
@ -1,5 +1,9 @@
|
||||||
NEWS - list of user-visible changes between releases of GRUB
|
NEWS - list of user-visible changes between releases of GRUB
|
||||||
|
|
||||||
|
New:
|
||||||
|
* Add support for ReiserFS 3.
|
||||||
|
* Fix support for FreeBSD 5.
|
||||||
|
|
||||||
New in 0.94 - 2004-01-25:
|
New in 0.94 - 2004-01-25:
|
||||||
* Support building on x86-64 with gcc -m32.
|
* Support building on x86-64 with gcc -m32.
|
||||||
* Use a BIOS call to turn on/off Gate A20. This should solve various
|
* Use a BIOS call to turn on/off Gate A20. This should solve various
|
||||||
|
|
1
THANKS
1
THANKS
|
@ -92,6 +92,7 @@ Ramon van Handel <vhandel@chem.vu.nl>
|
||||||
Robert Millan <robertmh@gnu.org>
|
Robert Millan <robertmh@gnu.org>
|
||||||
Roderich Schupp <rsch@ExperTeam.de>
|
Roderich Schupp <rsch@ExperTeam.de>
|
||||||
Rogelio M. Serrano Jr. <rogelio@victorio.com>
|
Rogelio M. Serrano Jr. <rogelio@victorio.com>
|
||||||
|
Sergey Matveychuk <sem@ciam.ru>
|
||||||
Serguei Tzukanov <tzukanov@narod.ru>
|
Serguei Tzukanov <tzukanov@narod.ru>
|
||||||
Stefan Ondrejicka <ondrej@idata.sk>
|
Stefan Ondrejicka <ondrej@idata.sk>
|
||||||
Stephen Early <steve@greenend.org.uk>
|
Stephen Early <steve@greenend.org.uk>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
|
||||||
.TH GRUB "8" "February 2004" "grub (GNU GRUB 0.94)" FSF
|
.TH GRUB "8" "March 2004" "grub (GNU GRUB 0.94)" FSF
|
||||||
.SH NAME
|
.SH NAME
|
||||||
grub \- the grub shell
|
grub \- the grub shell
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
|
||||||
.TH MBCHK "1" "January 2004" "mbchk (GNU GRUB 0.94)" FSF
|
.TH MBCHK "1" "March 2004" "mbchk (GNU GRUB 0.94)" 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
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* asmstub.c - a version of shared_src/asm.S that works under Unix */
|
/* asmstub.c - a version of shared_src/asm.S that works under Unix */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
|
* Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -779,7 +779,7 @@ get_diskinfo (int drive, struct geometry *geometry)
|
||||||
|
|
||||||
if (disks[drive].flags == -1)
|
if (disks[drive].flags == -1)
|
||||||
{
|
{
|
||||||
if (read_only || errno == EACCES || errno == EROFS)
|
if (read_only || errno == EACCES || errno == EROFS || errno == EPERM)
|
||||||
{
|
{
|
||||||
disks[drive].flags = open (devname, O_RDONLY);
|
disks[drive].flags = open (devname, O_RDONLY);
|
||||||
if (disks[drive].flags == -1)
|
if (disks[drive].flags == -1)
|
||||||
|
|
64
lib/device.c
64
lib/device.c
|
@ -78,6 +78,12 @@ struct hd_geometry
|
||||||
# include <sys/ioctl.h> /* ioctl */
|
# include <sys/ioctl.h> /* ioctl */
|
||||||
# include <sys/disklabel.h>
|
# include <sys/disklabel.h>
|
||||||
# include <sys/cdio.h> /* CDIOCCLRDEBUG */
|
# include <sys/cdio.h> /* CDIOCCLRDEBUG */
|
||||||
|
# if defined(__FreeBSD__)
|
||||||
|
# include <sys/param.h>
|
||||||
|
# if __FreeBSD_version >= 500040
|
||||||
|
# include <sys/disk.h>
|
||||||
|
# endif
|
||||||
|
# endif /* __FreeBSD__ */
|
||||||
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
||||||
|
|
||||||
#ifdef HAVE_OPENDISK
|
#ifdef HAVE_OPENDISK
|
||||||
|
@ -94,8 +100,13 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
if (geom->flags == -1)
|
||||||
|
{
|
||||||
fd = open (map[drive], O_RDONLY);
|
fd = open (map[drive], O_RDONLY);
|
||||||
assert (fd >= 0);
|
assert (fd >= 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fd = geom->flags;
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
/* Linux */
|
/* Linux */
|
||||||
|
@ -115,8 +126,42 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
|
||||||
geom->sectors = hdg.sectors;
|
geom->sectors = hdg.sectors;
|
||||||
geom->total_sectors = nr;
|
geom->total_sectors = nr;
|
||||||
|
|
||||||
close (fd);
|
goto success;
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
#elif defined(__FreeBSD__) && __FreeBSD_version >= 500040
|
||||||
|
/* FreeBSD version 5 and later */
|
||||||
|
{
|
||||||
|
u_int sector_size;
|
||||||
|
off_t media_size;
|
||||||
|
uint_t tmp;
|
||||||
|
|
||||||
|
if(ioctl (fd, DIOCGSECTORSIZE, §or_size) != 0)
|
||||||
|
sector_size = 512;
|
||||||
|
|
||||||
|
if (ioctl (fd, DIOCGMEDIASIZE, &media_size) != 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
geometry->total_sectors = media_size / sector_size;
|
||||||
|
|
||||||
|
if (ioctl (fd, DIOCGFWSECTORS, &tmp) == 0)
|
||||||
|
geometry->sectors = tmp;
|
||||||
|
else
|
||||||
|
geometry->sectors = 63;
|
||||||
|
if (ioctl (fd, DIOCGFWHEADS, &tmp) == 0)
|
||||||
|
geometry->heads = tmp;
|
||||||
|
else if (geometry->total_sectors <= 63 * 1 * 1024)
|
||||||
|
geometry->heads = 1;
|
||||||
|
else if (geometry->total_sectors <= 63 * 16 * 1024)
|
||||||
|
geometry->heads = 16;
|
||||||
|
else
|
||||||
|
geometry->heads = 255;
|
||||||
|
|
||||||
|
geometry->cylinders = (geometry->total_sectors
|
||||||
|
/ geometry->heads
|
||||||
|
/ geometry->sectors);
|
||||||
|
|
||||||
|
goto success;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
|
@ -131,8 +176,7 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
|
||||||
geom->sectors = hdg.d_nsectors;
|
geom->sectors = hdg.d_nsectors;
|
||||||
geom->total_sectors = hdg.d_secperunit;
|
geom->total_sectors = hdg.d_secperunit;
|
||||||
|
|
||||||
close (fd);
|
goto success;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -167,6 +211,8 @@ partially. This is not fatal."
|
||||||
geom->total_sectors = geom->cylinders * geom->heads * geom->sectors;
|
geom->total_sectors = geom->cylinders * geom->heads * geom->sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
success:
|
||||||
|
if (geom->flags == -1)
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +249,11 @@ get_floppy_disk_name (char *name, int unit)
|
||||||
sprintf (name, "/dev/fd%d", unit);
|
sprintf (name, "/dev/fd%d", unit);
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
/* FreeBSD */
|
/* FreeBSD */
|
||||||
|
# if __FreeBSD__ >= 4
|
||||||
|
sprintf (name, "/dev/fd%d", unit);
|
||||||
|
# else /* __FreeBSD__ < 4 */
|
||||||
sprintf (name, "/dev/rfd%d", unit);
|
sprintf (name, "/dev/rfd%d", unit);
|
||||||
|
# endif /* __FreeBSD__ < 4 */
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
/* NetBSD */
|
/* NetBSD */
|
||||||
/* opendisk() doesn't work for floppies. */
|
/* opendisk() doesn't work for floppies. */
|
||||||
|
@ -233,7 +283,7 @@ get_ide_disk_name (char *name, int unit)
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
/* FreeBSD */
|
/* FreeBSD */
|
||||||
# if __FreeBSD__ >= 4
|
# if __FreeBSD__ >= 4
|
||||||
sprintf (name, "/dev/rad%d", unit);
|
sprintf (name, "/dev/ad%d", unit);
|
||||||
# else /* __FreeBSD__ <= 3 */
|
# else /* __FreeBSD__ <= 3 */
|
||||||
sprintf (name, "/dev/rwd%d", unit);
|
sprintf (name, "/dev/rwd%d", unit);
|
||||||
# endif /* __FreeBSD__ <= 3 */
|
# endif /* __FreeBSD__ <= 3 */
|
||||||
|
@ -274,7 +324,11 @@ get_scsi_disk_name (char *name, int unit)
|
||||||
sprintf (name, "/dev/sd%d", unit);
|
sprintf (name, "/dev/sd%d", unit);
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
/* FreeBSD */
|
/* FreeBSD */
|
||||||
|
# if __FreeBSD__ >= 4
|
||||||
|
sprintf (name, "/dev/da%d", unit);
|
||||||
|
# else /* __FreeBSD__ < 4 */
|
||||||
sprintf (name, "/dev/rda%d", unit);
|
sprintf (name, "/dev/rda%d", unit);
|
||||||
|
# endif /* __FreeBSD__ < 4 */
|
||||||
#elif defined(__NetBSD__) && defined(HAVE_OPENDISK)
|
#elif defined(__NetBSD__) && defined(HAVE_OPENDISK)
|
||||||
/* NetBSD */
|
/* NetBSD */
|
||||||
char shortname[16];
|
char shortname[16];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue