On Sun, Jun 8, 2008 at 2:52 PM, Pavel Roskin <[EMAIL PROTECTED]> wrote: >> >> The reason I add device support for hexdump is to debug the nand >> driver. I need to go around the disk cache and call the underlying >> disk driver directly, so I use disk->dev->read. For (nand), there is >> just one partition, so I didn't notice the problem then. > > Here's the patch. Everything seems to be OK. "--skip=N" is not > recognized, but it's something in the option parsing code. "-s N" is > working. > > Please feel free to apply.
Perhaps we should keep the low level api, just fix the offset. Hexdump is normally used for debugging, and the disk cache is quite annoying. btw, please try the patch, it dumps the journal information. There could be quite some output, you can use grub-fstest to capture it. -- Bean
diff --git a/fs/ext2.c b/fs/ext2.c index ffe9e33..4e76097 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -443,14 +443,19 @@ grub_ext3_get_journal (struct grub_ext2_data *data) log->last_block = grub_be_to_cpu32 (jsb->maxlen); log->start_block = grub_be_to_cpu32 (jsb->start); + grub_printf ("header: %d %d %d\n", log->first_block, log->last_block, log->start_block); + last_num = num = 0; block = log->start_block; seq = grub_be_to_cpu32 (jsb->sequence); + grub_printf ("seq: %d\n", seq); while (1) { struct grub_ext3_journal_header *jh; + grub_printf ("block: %d\n", block); + if (grub_fshelp_read_file (data->disk, &data->logfile, 0, block << (log2bs + 9), sizeof (buf), buf, grub_ext2_read_block, @@ -476,6 +481,7 @@ grub_ext3_get_journal (struct grub_ext2_data *data) struct grub_ext3_journal_block_tag *tag; int ofs, flags; + grub_printf ("dblock: "); ofs = sizeof (struct grub_ext3_journal_header); do @@ -491,15 +497,19 @@ grub_ext3_get_journal (struct grub_ext2_data *data) ofs += 16; log->mapping[num++] = grub_be_to_cpu32 (tag->block); + grub_printf ("%d ", grub_be_to_cpu32 (tag->block)); next_block(); } while (! (flags & EXT3_JOURNAL_FLAG_LAST_TAG)); + grub_printf ("\n"); + continue; } case EXT3_JOURNAL_COMMIT_BLOCK: { + grub_printf ("cblock: %d\n", seq); seq++; last_num = num - 1; continue; @@ -510,6 +520,8 @@ grub_ext3_get_journal (struct grub_ext2_data *data) struct grub_ext3_journal_revoke_header *jrh; grub_uint32_t i; + grub_printf ("rblock: %d ", jrh->count); + jrh = (struct grub_ext3_journal_revoke_header *) jh; for (i = 0; i < grub_be_to_cpu32 (jrh->count); i++) @@ -518,11 +530,12 @@ grub_ext3_get_journal (struct grub_ext2_data *data) grub_uint32_t map; map = grub_be_to_cpu32 (jrh->data[i]); + grub_printf ("%d ", map); for (j = 0; j < num; j++) if (log->mapping[j] == map) log->mapping[j] = GRUB_FSHELP_JOURNAL_UNUSED_MAPPING; } - + grub_printf ("\n"); continue; } default: @@ -538,6 +551,7 @@ quit: { int size; + grub_printf ("num: %d\n", last_num); size = sizeof (struct grub_fshelp_journal) + last_num * sizeof (grub_disk_addr_t);
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel