Fix hexdump not to duplicate code with kern/partition.c
PATCH 1/1 Fix hexdump not to duplicate code with kern/partition.c
Splitted from nested partition patch
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +5 -0
@@ -1,3 +1,8 @@ +2009-06-08 Vladimir Serbinenko <[email protected]> + + * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead + of homegrown code. + 2009-07-31 Vladimir Serbinenko <[email protected]> * partmap/pc.c (pc_partition_map_iterate): Check that boot flags are
commands/hexdump.c +5 -11
@@ -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;
Quoted 13 lines · Vladimir 'phcoder' Serbinenko
Splitted from nested partition patch
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.gitChangeLog +0
-0
ChangeLog line 5
Quoted 5 lines
ChangeLog +5
-0@@ -1,3 +1,8 @@ +2009-06-08 Vladimir Serbinenko <[email protected]> + + * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_read instead + of homegrown code. +
Hi,
Looks good, but I haven't tried it. Assuming you've tested it and also builds warning-free, I'm fine with it.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."