fix a install bug and rename debug_fs* to apropriate names.

This commit is contained in:
okuji 1999-09-23 01:02:31 +00:00
parent ba8c5e1f8c
commit 88efa06787
8 changed files with 94 additions and 42 deletions

View file

@ -1,3 +1,40 @@
1999-09-23 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* stage2/builtins.c (debug_fs_print_func): Renamed to ...
(disk_read_print_func): ... this.
(fstest_func): Use DISK_READ_HOOK instead of DEBUG_FS.
(install_func): Rename debug_fs_savesect_func to
disk_read_savesect_func.
Rename debug_fs_blocklist_func to disk_read_blocklist_func.
Use DISK_READ_HOOK instead of DEBUG_FS.
(testload_func): Use DISK_READ_HOOK instead of DEBUG_FS.
* stage2/disk_io.c [!STAGE1_5] (debug_fs): Renamed to ...
[!STAGE1_5] (disk_read_hook): ... this.
[!STAGE1_5] (debug_fs_func): Renamed to ...
[!STAGE1_5] (disk_read_func): ... this.
(rawread) [!STAGE1_5]: Use DISK_READ_HOOK and DISK_READ_FUNC
instead of DEBUG_FS and DEBUG_FS_FUNC.
(grub_read) [!STAGE1_5]: Likewise.
(devread) [!STAGE1_5]: Use DISK_READ_HOOK instead of DEBUG_FS.
* stage2/fsys_ext2fs.c (ext2fs_read) [!STAGE1_5]: Use
DISK_READ_HOOK and DISK_READ_FUNC instead of DEBUG_FS and
DEBUG_FS_FUNC.
* stage2/fsys_ffs.c (ffs_read) [!STAGE1_5]: Likewise.
* stage2/fsys_minix.c (minix_read) [!STAGE1_5]: Likewise.
* stage2/shared.h [!STAGE1_5] (debug_fs): Renamed to ...
[!STAGE1_5] (disk_read_hook): ... this.
[!STAGE1_5] (debug_fs_func): Renamed to ...
[!STAGE1_5] (disk_read_func): ... this.
* docs/grub.texi: Likewise, replace debug_fs and debug_fs_func
with disk_read_hook and disk_read_func, respectively.
1999-09-23 Pavel Roskin <pavel_roskin@geocities.com>
* stage2/builtins.c (install_func): New local function,
debug_fs_savesect_func. Use debug_fs_savesect_func to determine
the first sector of Stage2. Write Stage 1 after patching Stage
2.
1999-09-22 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* acinclude.m4 (grub_ASM_USCORE): Do not define HAVE_ASM_USCORE
@ -25,7 +62,7 @@
1999-09-20 Edward Killips <ekillips@triton.net>
* stage2/disk_io.c (set_partition_hidden_flag): Set/cleat the
* stage2/disk_io.c (set_partition_hidden_flag): Set/clear the
hidden flag, whether the hidden flag is set or not.
1999-09-21 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>

View file

@ -2859,9 +2859,9 @@ it being the same for later calls into the back-end code!
@item filemax
Should be the length of the file.
@item debug_fs_func
Should be set to the value of @samp{debug_fs} @emph{only} during reading
of data for the file, not any other fs data, inodes, FAT tables,
@item disk_read_func
Should be set to the value of @samp{disk_read_hook} @emph{only} during
reading of data for the file, not any other fs data, inodes, FAT tables,
whatever, then set to @code{NULL} at all other times (it will be
@code{NULL} by default). If this isn't done corrently, then the
@command{testload} and @command{install} commands won't work

View file

@ -70,7 +70,7 @@ init_config (void)
/* Print which sector is read when loading a file. */
static void
debug_fs_print_func (int sector)
disk_read_print_func (int sector)
{
grub_printf ("[%d]", sector);
}
@ -411,14 +411,14 @@ static struct builtin builtin_fallback =
static int
fstest_func (char *arg, int flags)
{
if (debug_fs)
if (disk_read_hook)
{
debug_fs = NULL;
disk_read_hook = NULL;
printf (" Filesystem tracing is now off\n");
}
else
{
debug_fs = debug_fs_print_func;
disk_read_hook = disk_read_print_func;
printf (" Filesystem tracing is now on\n");
}
@ -727,11 +727,20 @@ install_func (char *arg, int flags)
int write_stage2_sect = 0;
int stage2_sect;
char *ptr;
int installaddr, installlist, installsect;
int installaddr, installlist;
/* Save the first sector of Stage2 in STAGE2_SECT. */
static void disk_read_savesect_func (int sector)
{
if (debug)
printf ("[%d]", sector);
stage2_sect = sector;
}
/* Write SECTOR to INSTALLLIST, and update INSTALLADDR and
INSTALLSECT. */
static void debug_fs_blocklist_func (int sector)
static void disk_read_blocklist_func (int sector)
{
if (debug)
printf("[%d]", sector);
@ -752,7 +761,6 @@ install_func (char *arg, int flags)
}
*((unsigned short *) installlist) += 1;
installsect = sector;
installaddr += 512;
}
@ -895,8 +903,12 @@ install_func (char *arg, int flags)
installlist = BOOTSEC_LOCATION + STAGE1_FIRSTLIST + 4;
/* Read the first sector of Stage 2. */
disk_read_hook = disk_read_savesect_func;
if (! grub_read ((char *) SCRATCHADDR, SECTOR_SIZE) == SECTOR_SIZE)
return 1;
{
disk_read_hook = 0;
return 1;
}
/* Check for the version of Stage 2. */
if (*((short *) (SCRATCHADDR + STAGE2_VER_MAJ_OFFS)) != COMPAT_VERSION)
@ -921,8 +933,6 @@ install_func (char *arg, int flags)
*((unsigned short *) (BOOTSEC_LOCATION + STAGE1_INSTALLADDR))
= installaddr;
stage2_sect = installsect;
if (*ptr == 'p')
{
write_stage2_sect = 1;
@ -945,30 +955,35 @@ install_func (char *arg, int flags)
/* Read the whole of Stage 2. */
filepos = 0;
debug_fs = debug_fs_blocklist_func;
disk_read_hook = disk_read_blocklist_func;
if (! grub_read ((char *) RAW_ADDR (0x100000), -1))
{
debug_fs = 0;
disk_read_hook = 0;
return 1;
}
/* Clear the cache. */
buf_track = -1;
if (biosdisk (BIOSDISK_WRITE,
dest_drive, &dest_geom,
dest_sector, 1, (BOOTSEC_LOCATION >> 4))
|| (write_stage2_sect
&& biosdisk (BIOSDISK_WRITE,
current_drive, &buf_geom,
stage2_sect, 1, SCRATCHSEG)))
/* Write the modified first sector of Stage2 to the disk. */
if (write_stage2_sect
&& biosdisk (BIOSDISK_WRITE, current_drive, &buf_geom,
stage2_sect, 1, SCRATCHSEG))
{
errnum = ERR_WRITE;
debug_fs = 0;
disk_read_hook = 0;
return 1;
}
if (biosdisk (BIOSDISK_WRITE, dest_drive, &dest_geom,
dest_sector, 1, (BOOTSEC_LOCATION >> 4)))
{
errnum = ERR_WRITE;
disk_read_hook = 0;
return 1;
}
debug_fs = 0;
disk_read_hook = 0;
#ifndef NO_DECOMPRESSION
no_decompression = 0;
@ -1320,7 +1335,7 @@ testload_func (char *arg, int flags)
if (! grub_open (arg))
return 1;
debug_fs = debug_fs_print_func;
disk_read_hook = disk_read_print_func;
/* Perform filesystem test on the specified file. */
/* Read whole file first. */
@ -1376,7 +1391,7 @@ testload_func (char *arg, int flags)
break;
grub_printf ("Max is 0x10ac0: i=0x%x, filepos=0x%x\n", i, filepos);
debug_fs = 0;
disk_read_hook = 0;
return 0;
}

View file

@ -26,8 +26,8 @@
#ifndef STAGE1_5
/* instrumentation variables */
void (*debug_fs) (int) = NULL;
void (*debug_fs_func) (int) = NULL;
void (*disk_read_hook) (int) = NULL;
void (*disk_read_func) (int) = NULL;
int print_possibilities;
@ -176,13 +176,13 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
/*
* Instrumentation to tell which sectors were read and used.
*/
if (debug_fs && debug_fs_func)
if (disk_read_hook && disk_read_func)
{
int sector_end = sector + ((num_sect < slen) ? num_sect : slen);
int sector_num = sector;
while (sector_num < sector_end)
(*debug_fs_func) (sector_num++);
(*disk_read_func) (sector_num++);
}
#endif /* STAGE1_5 */
@ -225,7 +225,7 @@ devread (int sector, int byte_offset, int byte_len, char *buf)
}
#if !defined(STAGE1_5)
if (debug_fs && debug)
if (disk_read_hook && debug)
printf ("<%d, %d, %d>", sector, byte_offset, byte_len);
#endif /* !STAGE1_5 */
@ -1360,7 +1360,7 @@ grub_read (char *buf, int len)
size = len;
#ifndef STAGE1_5
debug_fs_func = debug_fs;
disk_read_func = disk_read_hook;
#endif /* STAGE1_5 */
/* read current block and put it in the right place in memory */
@ -1368,7 +1368,7 @@ grub_read (char *buf, int len)
off, size, buf);
#ifndef STAGE1_5
debug_fs_func = NULL;
disk_read_func = NULL;
#endif /* STAGE1_5 */
len -= size;

View file

@ -431,14 +431,14 @@ ext2fs_read (char *buf, int len)
size = len;
#ifndef STAGE1_5
debug_fs_func = debug_fs;
disk_read_func = disk_read_hook;
#endif /* STAGE1_5 */
devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
offset, size, buf);
#ifndef STAGE1_5
debug_fs_func = NULL;
disk_read_func = NULL;
#endif /* STAGE1_5 */
buf += size;

View file

@ -161,13 +161,13 @@ ffs_read (char *buf, int len)
size = len;
#ifndef STAGE1_5
debug_fs_func = debug_fs;
disk_read_func = disk_read_hook;
#endif /* STAGE1_5 */
devread (fsbtodb (SUPERBLOCK, map), off, size, buf);
#ifndef STAGE1_5
debug_fs_func = NULL;
disk_read_func = NULL;
#endif /* STAGE1_5 */
buf += size;

View file

@ -269,14 +269,14 @@ minix_read (char *buf, int len)
size = len;
#ifndef STAGE1_5
debug_fs_func = debug_fs;
disk_read_func = disk_read_hook;
#endif /* STAGE1_5 */
devread (map * (BLOCK_SIZE / DEV_BSIZE),
offset, size, buf);
#ifndef STAGE1_5
debug_fs_func = NULL;
disk_read_func = NULL;
#endif /* STAGE1_5 */
buf += size;

View file

@ -401,8 +401,8 @@ extern int compressed_file;
#ifndef STAGE1_5
/* instrumentation variables */
extern void (*debug_fs) (int);
extern void (*debug_fs_func) (int);
extern void (*disk_read_hook) (int);
extern void (*disk_read_func) (int);
/* The flag for debug mode. */
extern int debug;
/* Color settings */