2006-10-27 Hollis Blanchard <hollis@penguinppc.org>

* kern/disk.c (grub_disk_open): Print debug messages when opening a
	disk.
	(grub_disk_close): Print debug messages when closing a disk.
	(grub_disk_read): Print debug messages when disk read fails.
	* kern/fs.c (grub_fs_probe): Print debug messages when detecting
	filesystem type.
	* kern/partition.c: Include misc.h.
	(grub_partition_iterate): Print debug messages when detecting
	partition type.
This commit is contained in:
hollisb 2006-10-27 18:14:00 +00:00
parent e2b8278c9e
commit 69203a9992
4 changed files with 48 additions and 7 deletions

View file

@ -1,3 +1,15 @@
2006-10-27 Hollis Blanchard <hollis@penguinppc.org>
* kern/disk.c (grub_disk_open): Print debug messages when opening a
disk.
(grub_disk_close): Print debug messages when closing a disk.
(grub_disk_read): Print debug messages when disk read fails.
* kern/fs.c (grub_fs_probe): Print debug messages when detecting
filesystem type.
* kern/partition.c: Include misc.h.
(grub_partition_iterate): Print debug messages when detecting
partition type.
2006-10-27 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_read): Return error if `status'

View file

@ -215,6 +215,8 @@ grub_disk_open (const char *name)
char *raw = (char *) name;
unsigned long current_time;
grub_dprintf ("disk", "Opening `%s'...\n", name);
disk = (grub_disk_t) grub_malloc (sizeof (*disk));
if (! disk)
return 0;
@ -291,6 +293,10 @@ grub_disk_open (const char *name)
if (grub_errno != GRUB_ERR_NONE)
{
grub_error_push ();
grub_dprintf ("disk", "Opening `%s' failed.\n", name);
grub_error_pop ();
grub_disk_close (disk);
return 0;
}
@ -301,6 +307,8 @@ grub_disk_open (const char *name)
void
grub_disk_close (grub_disk_t disk)
{
grub_dprintf ("disk", "Closing `%s'.\n", disk->name);
if (disk->dev && disk->dev->close)
(disk->dev->close) (disk);
@ -353,7 +361,12 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
/* First of all, check if the region is within the disk. */
if (grub_disk_check_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
return grub_errno;
{
grub_error_push ();
grub_dprintf ("disk", "Read out of range: sector 0x%lx.\n", sector);
grub_error_pop ();
return grub_errno;
}
real_offset = offset;
@ -406,7 +419,12 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
num = ((size + GRUB_DISK_SECTOR_SIZE - 1)
>> GRUB_DISK_SECTOR_BITS);
if ((disk->dev->read) (disk, sector, num, tmp_buf))
goto finish;
{
grub_error_push ();
grub_dprintf ("disk", "%s read failed\n", disk->name);
grub_error_pop ();
goto finish;
}
grub_memcpy (buf, tmp_buf + real_offset, size);

View file

@ -81,10 +81,15 @@ grub_fs_probe (grub_device_t device)
for (p = grub_fs_list; p; p = p->next)
{
grub_dprintf ("fs", "Detecting %s...\n", p->name);
(p->dir) (device, "/", dummy_func);
if (grub_errno == GRUB_ERR_NONE)
return p;
grub_error_push ();
grub_dprintf ("fs", "%s detection failed.\n", p->name);
grub_error_pop ();
if (grub_errno != GRUB_ERR_BAD_FS)
return 0;

View file

@ -17,6 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <grub/misc.h>
#include <grub/partition.h>
#include <grub/disk.h>
@ -103,15 +104,20 @@ grub_partition_iterate (struct grub_disk *disk,
int part_map_iterate (const grub_partition_map_t p)
{
grub_err_t err = p->iterate (disk, part_map_iterate_hook);
grub_err_t err;
grub_dprintf ("partition", "Detecting %s...\n", p->name);
err = p->iterate (disk, part_map_iterate_hook);
if (err != GRUB_ERR_NONE)
{
/* Continue to next partition map type. */
grub_dprintf ("partition", "%s detection failed.\n", p->name);
grub_errno = GRUB_ERR_NONE;
return 0;
}
grub_dprintf ("partition", "%s detection succeeded.\n", p->name);
partmap = p;
return 1;
}