2003-01-03 Yoshinori K. Okuji <okuji@enbug.org>

* util/i386/pc/pupa-setup.c (setup): Define the internal
	function find_first_partition_start at the top level, because GCC
	3.0.x cannot compile internal functions in deeper scopes
	correctly.
	(find_root_device): Use lstat instead of stat.
	Don't follow symbolic links.
	Fix the path-constructing code.

	* util/i386/pc/biosdisk.c [__linux__] (BLKFLSBUF): New macro.
	(pupa_util_biosdisk_open) [__linux__]: Get the size of a device
	by a BLKGETSIZE ioctl first, because block devices don't fill
	the member st_mode of the structure stat on Linux.
	[__linux__] (linux_find_partition): Use a temporary buffer
	REAL_DEV for the working space. Copy it to DEV before returning.
	(open_device) [__linux__]: Call ioctl with BLKFLSBUF to make the
	buffer cache consistent.
	(get_os_disk) [__linux__]: Use the length 5 instead of 4 for
	strncmp. The previous value was merely wrong.
	(pupa_util_biosdisk_get_pupa_dev): Use stat instead of lstat.

	* fs/fat.c (pupa_fat_read_data): Shift 4 instead of 12 when the
	FAT size is 12. The previous value was merely wrong.

	* kern/main.c (pupa_main): Don't split the starting message from
	newlines.

	* kern/term.c (pupa_putchar): Put CR after LF instead of before
	LF, because BIOS goes crazy about character attributes in this
	case.
This commit is contained in:
okuji 2003-01-02 23:46:21 +00:00
parent 1cc73a62da
commit 012d7999fe
8 changed files with 191 additions and 50 deletions

View file

@ -156,7 +156,7 @@ pupa_fat_mount (pupa_disk_t disk)
data = (struct pupa_fat_data *) pupa_malloc (sizeof (*data));
if (! data)
goto fail;
/* Read the BPB. */
if (pupa_disk_read (disk, 0, 0, sizeof (bpb), (char *) &bpb))
goto fail;
@ -437,19 +437,25 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data,
break;
case 12:
if (data->cur_cluster & 1)
next_cluster >>= 12;
next_cluster >>= 4;
next_cluster &= 0x0FFF;
break;
}
#if 0
pupa_printf ("%s:%d: fat_size=%d, next_cluster=%u\n",
__FILE__, __LINE__, data->fat_size, next_cluster);
#endif
/* Check the end. */
if (next_cluster >= data->cluster_eof_mark)
return ret;
if (next_cluster < 2 || next_cluster >= data->num_clusters)
{
pupa_error (PUPA_ERR_BAD_FS, "invalid cluster");
pupa_error (PUPA_ERR_BAD_FS, "invalid cluster %u",
next_cluster);
return -1;
}