2008-06-13 Bean <bean123ch@gmail.com>
* commands/hexdump.c (grub_cmd_hexdump): Adjust offset for partition. * fs/ext2.c (grub_ext3_get_journal): Fix revoke block handling. * fs/fshelp.c (grub_fshelp_map_block): Don't map block 0 as it's used to indicate sparse block.
This commit is contained in:
parent
e6d1a308ed
commit
dfe9ddd4cb
4 changed files with 25 additions and 10 deletions
|
@ -1,3 +1,12 @@
|
|||
2008-06-13 Bean <bean123ch@gmail.com>
|
||||
|
||||
* commands/hexdump.c (grub_cmd_hexdump): Adjust offset for partition.
|
||||
|
||||
* fs/ext2.c (grub_ext3_get_journal): Fix revoke block handling.
|
||||
|
||||
* fs/fshelp.c (grub_fshelp_map_block): Don't map block 0 as it's used
|
||||
to indicate sparse block.
|
||||
|
||||
2008-06-12 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* fs/ext2.c (grub_ext2_read_inode): Don't normalize block
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/hexdump.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"skip", 's', 0, "skip offset bytes from the beginning of file.", 0,
|
||||
|
@ -84,7 +85,7 @@ grub_cmd_hexdump (struct grub_arg_list *state, int argc, char **args)
|
|||
{
|
||||
char buf[GRUB_DISK_SECTOR_SIZE * 4];
|
||||
grub_ssize_t size, length;
|
||||
unsigned long skip;
|
||||
grub_disk_addr_t skip;
|
||||
int namelen;
|
||||
|
||||
if (argc != 1)
|
||||
|
@ -107,6 +108,9 @@ grub_cmd_hexdump (struct grub_arg_list *state, 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)
|
||||
|
|
18
fs/ext2.c
18
fs/ext2.c
|
@ -436,12 +436,12 @@ grub_ext3_get_journal (struct grub_ext2_data *data)
|
|||
{
|
||||
struct grub_ext3_journal_header *jh;
|
||||
|
||||
if (grub_fshelp_read_file (data->disk, &data->logfile, 0,
|
||||
block << (log2bs + 9), sizeof (buf),
|
||||
buf, grub_ext2_read_block,
|
||||
log->last_block << (log2bs + 9),
|
||||
log2bs) !=
|
||||
(int) sizeof (buf))
|
||||
grub_fshelp_read_file (data->disk, &data->logfile, 0,
|
||||
block << (log2bs + 9), sizeof (buf),
|
||||
buf, grub_ext2_read_block,
|
||||
log->last_block << (log2bs + 9),
|
||||
log2bs);
|
||||
if (grub_errno)
|
||||
break;
|
||||
|
||||
jh = (struct grub_ext3_journal_header *) &buf[0];
|
||||
|
@ -493,11 +493,13 @@ grub_ext3_get_journal (struct grub_ext2_data *data)
|
|||
case EXT3_JOURNAL_REVOKE_BLOCK:
|
||||
{
|
||||
struct grub_ext3_journal_revoke_header *jrh;
|
||||
grub_uint32_t i;
|
||||
grub_uint32_t i, cnt;
|
||||
|
||||
jrh = (struct grub_ext3_journal_revoke_header *) jh;
|
||||
cnt = (grub_be_to_cpu32 (jrh->count) -
|
||||
sizeof (struct grub_ext3_journal_revoke_header)) >> 2;
|
||||
|
||||
for (i = 0; i < grub_be_to_cpu32 (jrh->count); i++)
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
int j;
|
||||
grub_uint32_t map;
|
||||
|
|
|
@ -356,7 +356,7 @@ grub_fshelp_map_block (grub_fshelp_journal_t log, grub_disk_addr_t block)
|
|||
{
|
||||
int map_block;
|
||||
|
||||
if (! log)
|
||||
if ((! log) || (! block))
|
||||
return block;
|
||||
|
||||
for (map_block = log->num_mappings - 1; map_block >= 0; map_block--)
|
||||
|
|
Loading…
Reference in a new issue