|
libsquashfs 1.3.0
A new set of tools and libraries for working with SquashFS images
|
Abstracts writing and deduplicating of data and fragment blocks. More...
#include <block_writer.h>


Public Member Functions | |
| SQFS_API sqfs_block_writer_t * | sqfs_block_writer_create (sqfs_file_t *file, size_t devblksz, sqfs_u32 flags) |
| Create an instance of a default block writer implementation. | |
Data Fields | |
| sqfs_object_t | base |
| int(* | write_data_block )(sqfs_block_writer_t *wr, void *user, sqfs_u32 size, sqfs_u32 checksum, sqfs_u32 flags, const sqfs_u8 *data, sqfs_u64 *location) |
| Submit a data block to a block writer. | |
| sqfs_u64(* | get_block_count )(const sqfs_block_writer_t *wr) |
| Get the number of blocks actually written to disk. | |
Data Fields inherited from sqfs_object_t | |
| void(* | destroy )(struct sqfs_object_t *instance) |
| struct sqfs_object_t *(* | copy )(const struct sqfs_object_t *orig) |
Additional Inherited Members | |
Static Public Member Functions inherited from sqfs_object_t | |
| static SQFS_INLINE void | sqfs_destroy (void *obj) |
| Destroy an object and free all its memory. | |
| static SQFS_INLINE void * | sqfs_copy (const void *obj) |
| Create a deep copy of an object if possible. | |
Abstracts writing and deduplicating of data and fragment blocks.
A default reference implementation can be obtaiend through sqfs_block_writer_create. The default implementation is not copyable, i.e. sqfs_copy will always return NULL.
Definition at line 42 of file block_writer.h.
| SQFS_API sqfs_block_writer_t * sqfs_block_writer_create | ( | sqfs_file_t * | file, |
| size_t | devblksz, | ||
| sqfs_u32 | flags | ||
| ) |
Create an instance of a default block writer implementation.
| file | A pointer to a file object that data should be appended to. |
| devblksz | The underlying device block size if output data should be aligned. |
| flags | A combination of SQFS_BLOCK_WRITER_FLAGS values. If an unknown flag is set, creation will fail. |
| sqfs_object_t base |
Definition at line 43 of file block_writer.h.
| sqfs_u64(* get_block_count) (const sqfs_block_writer_t *wr) |
Get the number of blocks actually written to disk.
| wr | A pointer to a block writer. |
Definition at line 90 of file block_writer.h.
| int(* write_data_block) (sqfs_block_writer_t *wr, void *user, sqfs_u32 size, sqfs_u32 checksum, sqfs_u32 flags, const sqfs_u8 *data, sqfs_u64 *location) |
Submit a data block to a block writer.
If the SQFS_BLK_FIRST_BLOCK flag is set, the data block writer memorizes the starting location and block index of the block. If the SQFS_BLK_LAST_BLOCK flag is set, it uses those stored locations to do block deduplication.
If the flag SQFS_BLK_ALIGN is set in combination with the SQFS_BLK_FIRST_BLOCK, the file size is padded to a multiple of the device block size before writing. If it is set together with the SQFS_BLK_LAST_BLOCK flag, the padding is added afterwards.
| wr | A pointer to a block writer. |
| user | An optional user data pointer. The sqfs_block_processor_t can be told to pass this on to the block writer for each block. |
| size | The size of the block to write. |
| checksum | A 32 bit checksum of the block data. |
| flags | A combination of SQFS_BLK_FLAGS flag bits describing the block. @arapm data A pointer to the data to write. |
| location | Returns the location where the block has been written. If the SQFS_BLK_LAST_BLOCK flag was set, deduplication is performed and this returns the (new) location of the first block instead. |
Definition at line 76 of file block_writer.h.