FreeCalypso > hg > freecalypso-reveng
diff 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 |
line wrap: on
line diff
--- a/mpffs/common.c Mon Jul 01 06:28:30 2013 +0000 +++ b/mpffs/common.c Mon Jul 01 06:49:50 2013 +0000 @@ -335,6 +335,39 @@ chi->len = chi->end - chi->start; } +iterate_extra_chunks(first_extra_chunk, callback, callback_data) + void (*callback)(); + u_long callback_data; +{ + int ent; + struct objinfo obj; + + for (ent = first_extra_chunk; ent != 0xFFFF; ent = obj.descend) { +loop: obj.entryno = ent; + get_index_entry(&obj); + switch (obj.type) { + case 0xF4: + validate_chunk(&obj); + callback(&obj, callback_data); + continue; + case 0x00: + if (obj.sibling == 0xFFFF) { + fprintf(stderr, +"file continuation object at index %x: marked deleted, but no sibling\n", + ent); + exit(1); + } + ent = obj.sibling; + goto loop; + default: + fprintf(stderr, + "file continuation object at index %x: unexpected type %02X\n", + ent, obj.type); + exit(1); + } + } +} + find_root_node() { struct objinfo obj;