diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-01-31 17:15:04 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-01-31 17:15:04 +0100 |
commit | 940c3e3333ba0063f536dfbecbb77d070dbcc87a (patch) | |
tree | 89c7f7159d5d6b597453c4df38752647af7146e0 /include/sqfs/block_processor.h | |
parent | 9d5b0c381a7961a14d2a94a6b31a4e25a2543eae (diff) |
Split the block writing/deduplication away from the block processor
This commit moves the entire block writing and deduplication of data
blocks over to a different data type named "block writer".
For simplicity, the interfaces of the block processor are left as is
and are turned into warppers. Likewise, most of the code in the block
writer is just verbatim from the block processor, to be cleaned up in
subsequent commits.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs/block_processor.h')
-rw-r--r-- | include/sqfs/block_processor.h | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/include/sqfs/block_processor.h b/include/sqfs/block_processor.h index c6dd734..a1e6f2b 100644 --- a/include/sqfs/block_processor.h +++ b/include/sqfs/block_processor.h @@ -43,112 +43,6 @@ * and finally writing it to disk. */ -/** - * @struct sqfs_block_hooks_t - * - * @brief A set of hooks for tapping into the data writer. - * - * This structure can be registered with an @ref sqfs_block_processor_t and - * contains function pointers that will be called during various stages - * when writing data to disk. - * - * The callbacks can not only be used for accounting but may also write extra - * data to the output file or make modifications to the blocks before they are - * writtien. - * - * The callbacks can be individually set to NULL to disable them. - */ -struct sqfs_block_hooks_t { - /** - * @brief Set this to the size of the struct. - * - * This is required for future expandabillity while maintaining ABI - * compatibillity. At the current time, the implementation of - * @ref sqfs_block_processor_set_hooks rejects any hook struct where - * this isn't the exact size. If new hooks are added in the future, - * the struct grows and the future implementation can tell by the size - * whether the application uses the new version or the old one. - */ - size_t size; - - /** - * @brief Gets called before writing a block to disk. - * - * If this is not NULL, it gets called before a block is written to - * disk. If the block has the @ref SQFS_BLK_ALIGN flag set, the - * function is called before padding the file. - * - * The function may modify the block itself or write data to the file. - * which is taken into account when padding the file. - * - * @param user A user pointer. - * @param block The block that is about to be written. - * @param file The file that the block will be written to. - */ - void (*pre_block_write)(void *user, sqfs_block_t *block, - sqfs_file_t *file); - - /** - * @brief Gets called after writing a block to disk. - * - * If this is not NULL, it gets called after a block is written to - * disk. If the block has the @ref SQFS_BLK_ALIGN flag set, the - * function is called before padding the file. - * - * Modifying the block is rather pointless, but the function may - * write data to the file which is taken into account when padding - * the file. - * - * @param user A user pointer. - * @param block The block that is about to be written. - * @param file The file that the block was written to. - */ - void (*post_block_write)(void *user, const sqfs_block_t *block, - sqfs_file_t *file); - - /** - * @brief Gets called before storing a fragment in a fragment block. - * - * The function can modify the block before it is stored. - * - * @param user A user pointer. - * @param block The data chunk that is about to be merged into the - * fragment block. - */ - void (*pre_fragment_store)(void *user, sqfs_block_t *block); - - /** - * @brief Gets called if block deduplication managed to get - * rid of the data blocks of a file. - * - * @param user A user pointer. - * @param count The number of blocks that have been erased. - * @param bytes The number of bytes that have been erased. Includes - * potential padding before and after the end. - */ - void (*notify_blocks_erased)(void *user, size_t count, - sqfs_u64 bytes); - - /** - * @brief Gets called before throwing away a fragment that turned out - * to be a duplicate. - * - * @param user A user pointer. - * @param block The data chunk that is about to be merged into the - * fragment block. - */ - void (*notify_fragment_discard)(void *user, const sqfs_block_t *block); - - /** - * @brief Gets called before writing a block of padding bytes to disk. - * - * @param user A user pointer. - * @param block The padding bytes that are about to be written. - * @param count The number of padding bytes in the block. - */ - void (*prepare_padding)(void *user, sqfs_u8 *block, size_t count); -}; - #ifdef __cplusplus extern "C" { #endif |