changeset 24:9f3a7b014e63

MysteryFFS dump2: dumping all file fragments
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 18 May 2013 21:09:33 +0000
parents 671db68916c7
children ae5337f881e3
files mysteryffs/dump2.c
diffstat 1 files changed, 31 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mysteryffs/dump2.c	Sat May 18 19:48:07 2013 +0000
+++ b/mysteryffs/dump2.c	Sat May 18 21:09:33 2013 +0000
@@ -206,6 +206,31 @@
 	return(0);
 }
 
+dump_file_chain(firstent)
+{
+	struct index_entry rec;
+	int ent;
+
+	for (ent = firstent; ent != 0xFFFF; ent = rec.descend) {
+		get_index_entry(ent, &rec);
+		if (rec.type == 0xF4) {
+			printf("\nfile continuation (entry #%x)\n", ent);
+			printf("len=%x, unknown fields: %02X %04X %04X\n",
+				rec.len, rec.unknown_b1,
+				rec.unknown_w1, rec.unknown_w2);
+			dump_data_frag(ent, &rec);
+		} else {
+			printf("\ncontinuation entry at %x: type %02X != F4\n",
+				ent, rec.type);
+			printf("len=%x, unknown fields: %02X %04X %04X\n",
+				rec.len, rec.unknown_b1,
+				rec.unknown_w1, rec.unknown_w2);
+		}
+		if (rec.sibling != 0xFFFF)
+			printf("warning: non-nil sibling pointer\n");
+	}
+}
+
 dump_dir(firstent, path_prefix)
 {
 	struct index_entry rec;
@@ -227,13 +252,17 @@
 			continue;
 		case 0xF1:
 			/* regular file */
-			dump_common(ent, &rec, path_prefix, "file", 0);
+			if (dump_common(ent, &rec, path_prefix, "file", 0) < 0)
+				continue;
 			dump_data_frag(ent, &rec);
+			dump_file_chain(rec.descend);
 			continue;
 		case 0xE1:
 			/* special .journal file */
-			dump_common(ent, &rec, path_prefix, "E1 file", 0);
+			if (dump_common(ent, &rec, path_prefix, "E1 file", 0)<0)
+				continue;
 			dump_data_frag(ent, &rec);
+			dump_file_chain(rec.descend);
 			continue;
 		default:
 			printf("entry #%x: unexpected type %02X\n", ent,