Splitted from nested partition patch

-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
diff --git a/ChangeLog b/ChangeLog
index e553828..e987af6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-08  Vladimir Serbinenko  <phco...@gmail.com>
+
+       * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead
+       of homegrown code.
+
 2009-07-31  Vladimir Serbinenko  <phco...@gmail.com>
 
        * partmap/pc.c (pc_partition_map_iterate): Check that boot flags are
diff --git a/commands/hexdump.c b/commands/hexdump.c
index 0e560c0..f59ba36 100644
--- a/commands/hexdump.c
+++ b/commands/hexdump.c
@@ -22,7 +22,6 @@
 #include <grub/disk.h>
 #include <grub/misc.h>
 #include <grub/gzio.h>
-#include <grub/partition.h>
 #include <grub/lib/hexdump.h>
 #include <grub/extcmd.h>
 
@@ -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;
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to