changeset 38:e9c6d6615f32

mpffs-dbgls: reworked for the new understanding of relocated chunks
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 01 Jul 2013 06:28:30 +0000
parents 8256eec598dd
children 9bc7f0e03fa8
files mpffs/dbgls.c
diffstat 1 files changed, 25 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mpffs/dbgls.c	Sun Jun 30 17:56:27 2013 +0000
+++ b/mpffs/dbgls.c	Mon Jul 01 06:28:30 2013 +0000
@@ -28,23 +28,34 @@
 	struct chunkinfo chi;
 
 	for (ent = first_extra_chunk; ent != 0xFFFF; ent = ch.descend) {
-		ch.entryno = ent;
+loop:		ch.entryno = ent;
 		get_index_entry(&ch);
-		if (ch.type != 0xF4) {
-			fprintf(stderr,
-	"file continuation object at index %x: type %02X != expected F4\n",
+		switch (ch.type) {
+		case 0xF4:
+			validate_chunk(&ch);
+			printf("  #%x chunk addr=0x%x len=0x%x\n", ch.entryno,
+				ch.offset, ch.len);
+			size_extra_chunk(&ch, &chi);
+			printf("  extra chunk: %lu bytes at 0x%lx\n",
+				(u_long) chi.len, (u_long)(chi.start-image));
+			break;
+		case 0x00:
+			printf("  #%x marked as deleted\n", ch.entryno);
+			if (ch.sibling == 0xFFFF) {
+				printf("  nil sibling pointer!\n");
+				break;
+			}
+			ent = ch.sibling;
+			printf("  relocated to #%x\n", ent);
+			goto loop;
+		default:
+			printf(
+	"  file continuation object at index %x: unexpected type %02X\n",
 				ent, ch.type);
-			return;
 		}
-		validate_chunk(&ch);
-		printf("  #%x chunk addr=0x%x len=0x%x\n", ch.entryno,
-			ch.offset, ch.len);
-		size_extra_chunk(&ch, &chi);
-		printf("  extra chunk: %lu bytes at 0x%lx\n", (u_long) chi.len,
-			(u_long)(chi.start-image));
 		if (ch.sibling != 0xFFFF)
-			fprintf(stderr,
-"warning: file continuation object (index %x) has a non-nil sibling pointer\n",
+			printf(
+	"  file continuation object (index %x) has a non-nil sibling pointer\n",
 				ent);
 	}
 }
@@ -63,7 +74,7 @@
 		break;
 	case 0xF1:
 		/* regular file */
-		typechar = '-';
+		typechar = 'f';
 		break;
 	case 0xE1:
 		/* special .journal file */