fix some bugs in biosdisk.
This commit is contained in:
parent
f2151e4b57
commit
82889257ad
2 changed files with 22 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
1999-09-10 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* grub/asmstub.c (_FILE_OFFSET_BITS): Defined.
|
||||||
|
(biosdisk) [!__linux__]: Pass the offset argument as off_t
|
||||||
|
instead of int to lseek, and compare the return value with
|
||||||
|
OFFSET. Reported by Pavel Roskin.
|
||||||
|
(grub_stage2) [!__linux__ && !__GNU__]: Print a warning message.
|
||||||
|
|
||||||
1999-09-08 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
1999-09-08 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
* stage2/stage2.c (run_menu): If run_script is successfully
|
* stage2/stage2.c (run_menu): If run_script is successfully
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Try to use glibc's transparant LFS support. */
|
/* Try to use glibc's transparant LFS support. */
|
||||||
#define _LARGEFILE_SOURCE 1
|
#define _LARGEFILE_SOURCE 1
|
||||||
|
/* lseek becomes synonymous with lseek64. */
|
||||||
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
/* Simulator entry point. */
|
/* Simulator entry point. */
|
||||||
int grub_stage2 (void);
|
int grub_stage2 (void);
|
||||||
|
@ -154,8 +156,10 @@ grub_stage2 (void)
|
||||||
char buf[512];
|
char buf[512];
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
char unit = 'a' + i;
|
char unit = 'a' + i;
|
||||||
#else
|
#elif defined(__GNU__)
|
||||||
char unit = '0' + i;
|
char unit = '0' + i;
|
||||||
|
#else
|
||||||
|
#warning "BIOS drives cannot be guessed in your operating system."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sprintf (name, "/dev/hd%c", unit);
|
sprintf (name, "/dev/hd%c", unit);
|
||||||
|
@ -204,7 +208,7 @@ grub_stage2 (void)
|
||||||
assert (name);
|
assert (name);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
sprintf (name, "/dev/sd%c", i + 'a');
|
sprintf (name, "/dev/sd%c", i + 'a');
|
||||||
#else
|
#elif defined(__GNU__)
|
||||||
sprintf (name, "/dev/sd%d", i);
|
sprintf (name, "/dev/sd%d", i);
|
||||||
#endif
|
#endif
|
||||||
device_map[num_hd++ + 0x80] = name;
|
device_map[num_hd++ + 0x80] = name;
|
||||||
|
@ -755,9 +759,13 @@ biosdisk (int subfunc, int drive, struct geometry *geometry,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (lseek (fd, sector * SECTOR_SIZE, SEEK_SET))
|
{
|
||||||
return -1;
|
off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;
|
||||||
#endif /* __linux__ */
|
|
||||||
|
if (lseek (fd, offset, SEEK_SET) != offset)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
buf = (char *) (segment << 4);
|
buf = (char *) (segment << 4);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue