0

can anybody please tell how the squashfs maps the disk block numbers to file system blocks. Basically i am saying about read_blocklist() in squashfs.

Thanks, Kapil

1 Answer 1

0

The squashfs metadata for a regular file looks roughly like this:

===== Header
start_block: Position of the first block in the file
file_size: Size of the file in bytes
...
===== Block list
size0: 32-bit header for the first block
size1
size2
...
=====

The block header contains the compressed size of the block. So we can calculate the position of any given block by adding up start_block and the sizes of all preceding blocks.

Playing around with my pure-ruby squashfs parser might help: https://github.com/vasi/squash.rb

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.