commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[2466] 2009-08-02 Vladimir Serbinenko <address@hidden>


From: Vladimir Serbinenko
Subject: [2466] 2009-08-02 Vladimir Serbinenko <address@hidden>
Date: Sun, 02 Aug 2009 21:57:27 +0000

Revision: 2466
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2466
Author:   phcoder
Date:     2009-08-02 21:57:26 +0000 (Sun, 02 Aug 2009)
Log Message:
-----------
2009-08-02  Vladimir Serbinenko  <address@hidden>

        * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead
        of homegrown code.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/commands/hexdump.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2009-08-01 14:47:11 UTC (rev 2465)
+++ trunk/grub2/ChangeLog       2009-08-02 21:57:26 UTC (rev 2466)
@@ -1,3 +1,8 @@
+2009-08-02  Vladimir Serbinenko  <address@hidden>
+
+       * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead
+       of homegrown code.
+
 2009-08-01  Vladimir Serbinenko  <address@hidden>
 
        * util/hostfs.c (grub_hostfs_dir): Don't use DT_DIR: It doesn't work

Modified: trunk/grub2/commands/hexdump.c
===================================================================
--- trunk/grub2/commands/hexdump.c      2009-08-01 14:47:11 UTC (rev 2465)
+++ trunk/grub2/commands/hexdump.c      2009-08-02 21:57:26 UTC (rev 2466)
@@ -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 @@
       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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]