diff --git a/ChangeLog b/ChangeLog index d7f219b46..670d7258b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-08-02 Vladimir Serbinenko + + * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead + of homegrown code. + 2009-08-01 Vladimir Serbinenko * util/hostfs.c (grub_hostfs_dir): Don't use DT_DIR: It doesn't work diff --git a/commands/hexdump.c b/commands/hexdump.c index 0e560c0ff..f59ba363c 100644 --- a/commands/hexdump.c +++ b/commands/hexdump.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -62,25 +61,20 @@ grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args) if (! disk) return 0; - if (disk->partition) - skip += grub_partition_get_start (disk->partition) << GRUB_DISK_SECTOR_BITS; - sector = (skip >> (GRUB_DISK_SECTOR_BITS + 2)) * 4; ofs = skip & (GRUB_DISK_SECTOR_SIZE * 4 - 1); while (length) { - grub_size_t len, n; + grub_size_t len; len = length; - if (ofs + len > sizeof (buf)) - len = sizeof (buf) - ofs; + if (len > sizeof (buf)) + len = sizeof (buf); - n = ((ofs + len + GRUB_DISK_SECTOR_SIZE - 1) - >> GRUB_DISK_SECTOR_BITS); - if (disk->dev->read (disk, sector, n, buf)) + if (grub_disk_read (disk, sector, ofs, len, buf)) break; - hexdump (skip, &buf[ofs], len); + hexdump (skip, buf, len); ofs = 0; skip += len;