2009-08-02 Vladimir Serbinenko <phcoder@gmail.com>
* commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead of homegrown code.
This commit is contained in:
parent
bd288a205f
commit
f84114f583
2 changed files with 10 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2009-08-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead
|
||||||
|
of homegrown code.
|
||||||
|
|
||||||
2009-08-01 Vladimir Serbinenko <phcoder@gmail.com>
|
2009-08-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/hostfs.c (grub_hostfs_dir): Don't use DT_DIR: It doesn't work
|
* util/hostfs.c (grub_hostfs_dir): Don't use DT_DIR: It doesn't work
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/gzio.h>
|
#include <grub/gzio.h>
|
||||||
#include <grub/partition.h>
|
|
||||||
#include <grub/lib/hexdump.h>
|
#include <grub/lib/hexdump.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
|
||||||
|
@ -62,25 +61,20 @@ grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args)
|
||||||
if (! disk)
|
if (! disk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (disk->partition)
|
|
||||||
skip += grub_partition_get_start (disk->partition) << GRUB_DISK_SECTOR_BITS;
|
|
||||||
|
|
||||||
sector = (skip >> (GRUB_DISK_SECTOR_BITS + 2)) * 4;
|
sector = (skip >> (GRUB_DISK_SECTOR_BITS + 2)) * 4;
|
||||||
ofs = skip & (GRUB_DISK_SECTOR_SIZE * 4 - 1);
|
ofs = skip & (GRUB_DISK_SECTOR_SIZE * 4 - 1);
|
||||||
while (length)
|
while (length)
|
||||||
{
|
{
|
||||||
grub_size_t len, n;
|
grub_size_t len;
|
||||||
|
|
||||||
len = length;
|
len = length;
|
||||||
if (ofs + len > sizeof (buf))
|
if (len > sizeof (buf))
|
||||||
len = sizeof (buf) - ofs;
|
len = sizeof (buf);
|
||||||
|
|
||||||
n = ((ofs + len + GRUB_DISK_SECTOR_SIZE - 1)
|
if (grub_disk_read (disk, sector, ofs, len, buf))
|
||||||
>> GRUB_DISK_SECTOR_BITS);
|
|
||||||
if (disk->dev->read (disk, sector, n, buf))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
hexdump (skip, &buf[ofs], len);
|
hexdump (skip, buf, len);
|
||||||
|
|
||||||
ofs = 0;
|
ofs = 0;
|
||||||
skip += len;
|
skip += len;
|
||||||
|
|
Loading…
Reference in a new issue