FreeCalypso > hg > freecalypso-reveng
comparison mpffs/common.c @ 39:9bc7f0e03fa8
iterate_extra_chunks() function written, mpffs-ls converted to use it
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jul 2013 06:49:50 +0000 |
parents | 3cca8070ef0f |
children |
comparison
equal
deleted
inserted
replaced
38:e9c6d6615f32 | 39:9bc7f0e03fa8 |
---|---|
333 chi->start = ch->dataptr; | 333 chi->start = ch->dataptr; |
334 chi->end = find_end_of_chunk(ch); | 334 chi->end = find_end_of_chunk(ch); |
335 chi->len = chi->end - chi->start; | 335 chi->len = chi->end - chi->start; |
336 } | 336 } |
337 | 337 |
338 iterate_extra_chunks(first_extra_chunk, callback, callback_data) | |
339 void (*callback)(); | |
340 u_long callback_data; | |
341 { | |
342 int ent; | |
343 struct objinfo obj; | |
344 | |
345 for (ent = first_extra_chunk; ent != 0xFFFF; ent = obj.descend) { | |
346 loop: obj.entryno = ent; | |
347 get_index_entry(&obj); | |
348 switch (obj.type) { | |
349 case 0xF4: | |
350 validate_chunk(&obj); | |
351 callback(&obj, callback_data); | |
352 continue; | |
353 case 0x00: | |
354 if (obj.sibling == 0xFFFF) { | |
355 fprintf(stderr, | |
356 "file continuation object at index %x: marked deleted, but no sibling\n", | |
357 ent); | |
358 exit(1); | |
359 } | |
360 ent = obj.sibling; | |
361 goto loop; | |
362 default: | |
363 fprintf(stderr, | |
364 "file continuation object at index %x: unexpected type %02X\n", | |
365 ent, obj.type); | |
366 exit(1); | |
367 } | |
368 } | |
369 } | |
370 | |
338 find_root_node() | 371 find_root_node() |
339 { | 372 { |
340 struct objinfo obj; | 373 struct objinfo obj; |
341 u16 lim; | 374 u16 lim; |
342 | 375 |