comparison mysteryffs/dump2.c @ 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
comparison
equal deleted inserted replaced
23:671db68916c7 24:9f3a7b014e63
204 putchar('\n'); 204 putchar('\n');
205 } 205 }
206 return(0); 206 return(0);
207 } 207 }
208 208
209 dump_file_chain(firstent)
210 {
211 struct index_entry rec;
212 int ent;
213
214 for (ent = firstent; ent != 0xFFFF; ent = rec.descend) {
215 get_index_entry(ent, &rec);
216 if (rec.type == 0xF4) {
217 printf("\nfile continuation (entry #%x)\n", ent);
218 printf("len=%x, unknown fields: %02X %04X %04X\n",
219 rec.len, rec.unknown_b1,
220 rec.unknown_w1, rec.unknown_w2);
221 dump_data_frag(ent, &rec);
222 } else {
223 printf("\ncontinuation entry at %x: type %02X != F4\n",
224 ent, rec.type);
225 printf("len=%x, unknown fields: %02X %04X %04X\n",
226 rec.len, rec.unknown_b1,
227 rec.unknown_w1, rec.unknown_w2);
228 }
229 if (rec.sibling != 0xFFFF)
230 printf("warning: non-nil sibling pointer\n");
231 }
232 }
233
209 dump_dir(firstent, path_prefix) 234 dump_dir(firstent, path_prefix)
210 { 235 {
211 struct index_entry rec; 236 struct index_entry rec;
212 int ent; 237 int ent;
213 int subprefix; 238 int subprefix;
225 continue; 250 continue;
226 dump_dir(rec.descend, subprefix); 251 dump_dir(rec.descend, subprefix);
227 continue; 252 continue;
228 case 0xF1: 253 case 0xF1:
229 /* regular file */ 254 /* regular file */
230 dump_common(ent, &rec, path_prefix, "file", 0); 255 if (dump_common(ent, &rec, path_prefix, "file", 0) < 0)
256 continue;
231 dump_data_frag(ent, &rec); 257 dump_data_frag(ent, &rec);
258 dump_file_chain(rec.descend);
232 continue; 259 continue;
233 case 0xE1: 260 case 0xE1:
234 /* special .journal file */ 261 /* special .journal file */
235 dump_common(ent, &rec, path_prefix, "E1 file", 0); 262 if (dump_common(ent, &rec, path_prefix, "E1 file", 0)<0)
263 continue;
236 dump_data_frag(ent, &rec); 264 dump_data_frag(ent, &rec);
265 dump_file_chain(rec.descend);
237 continue; 266 continue;
238 default: 267 default:
239 printf("entry #%x: unexpected type %02X\n", ent, 268 printf("entry #%x: unexpected type %02X\n", ent,
240 rec.type); 269 rec.type);
241 } 270 }