libsquashfs 1.3.0
A new set of tools and libraries for working with SquashFS images
|
Contains helper functions for reading or writing tables. More...
#include "sqfs/predef.h"
Go to the source code of this file.
Functions | |
SQFS_API int | sqfs_write_table (sqfs_file_t *file, sqfs_compressor_t *cmp, const void *data, size_t table_size, sqfs_u64 *start) |
Write a table to disk. | |
SQFS_API int | sqfs_read_table (sqfs_file_t *file, sqfs_compressor_t *cmp, size_t table_size, sqfs_u64 location, sqfs_u64 lower_limit, sqfs_u64 upper_limit, void **out) |
Read a table from a SquashFS filesystem. | |
Contains helper functions for reading or writing tables.
Definition in file table.h.
SQFS_API int sqfs_read_table | ( | sqfs_file_t * | file, |
sqfs_compressor_t * | cmp, | ||
size_t | table_size, | ||
sqfs_u64 | location, | ||
sqfs_u64 | lower_limit, | ||
sqfs_u64 | upper_limit, | ||
void ** | out | ||
) |
Read a table from a SquashFS filesystem.
This function takes an absolute position and an array size as input. It then computes the number of meta data blocks required to store this array and reads that many 64 bit integers from the given start location. Each integer is interpreted as the location of a meta data block containing the respective array chunk.
The entire data encoded in that way is read and uncompressed into memory.
file | An input file to read from. |
cmp | A compressor to use for uncompressing the meta data block. |
table_size | The size of the entire array in bytes. |
location | The absolute position of the location list. |
lower_limit | The lowest "sane" position at which to expect a meta data block. Anything less than that is interpreted as an out-of-bounds read. |
upper_limit | The highest "sane" position at which to expect a meta data block. Anything after that is interpreted as an out-of-bounds read. |
out | Returns a pointer to the table in memory. |
SQFS_API int sqfs_write_table | ( | sqfs_file_t * | file, |
sqfs_compressor_t * | cmp, | ||
const void * | data, | ||
size_t | table_size, | ||
sqfs_u64 * | start | ||
) |
Write a table to disk.
This function takes an in-memory array, breaks it down into meta data blocks, compresses and writes those blocks to the given output file and then writes a raw list of 64 bit absolute locations of each meta data block. The position of the location list is returned through a pointer.
file | The output file to write to. |
cmp | A compressor to use for compressing the meta data blocks. |
data | A pointer to a array to divide into blocks and write to disk. |
table_size | The size of the input array in bytes. |
start | Returns the absolute position of the location list. |