diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-29 19:44:09 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-29 19:56:59 +0200 |
commit | 2ff34144df4ce521bfb789a61e24a05aea39b220 (patch) | |
tree | 54c7c1818d758de90e4c34c8f9b9c39ea301824b /include/sqfs | |
parent | 577aae140e05f2b7cd140926443517260c0132b7 (diff) |
Block processor: Add a raw block submission function
This function allows submission of raw blocks to the block processor,
completely bypassing the file API.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs')
-rw-r--r-- | include/sqfs/block.h | 2 | ||||
-rw-r--r-- | include/sqfs/block_processor.h | 30 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/sqfs/block.h b/include/sqfs/block.h index 582f128..30f181c 100644 --- a/include/sqfs/block.h +++ b/include/sqfs/block.h @@ -149,6 +149,8 @@ typedef enum { * @brief The combination of all flags that are user settable. */ SQFS_BLK_USER_SETTABLE_FLAGS = 0x003F, + + SQFS_BLK_FLAGS_ALL = 0xFC3F, } SQFS_BLK_FLAGS; #endif /* SQFS_BLOCK_H */ diff --git a/include/sqfs/block_processor.h b/include/sqfs/block_processor.h index 5c77155..1846069 100644 --- a/include/sqfs/block_processor.h +++ b/include/sqfs/block_processor.h @@ -215,6 +215,36 @@ SQFS_API int sqfs_block_processor_append(sqfs_block_processor_t *proc, SQFS_API int sqfs_block_processor_end_file(sqfs_block_processor_t *proc); /** + * @brief Submit a raw block for processing. + * + * @memberof sqfs_block_processor_t + * + * This function provides an alternative to the simple file front end to submit + * raw data blocks to the processor. It will throw an error if called in between + * @ref sqfs_block_processor_begin_file and @ref sqfs_block_processor_end_file. + * + * The flags aren't sanity checked (besides being a subset + * of @ref SQFS_BLK_FLAGS_ALL), so in contrast to the simple file API, you can + * shoot yourself in the foot as hard as you want. + * + * If not specified otherwise through flags, the fragment block/deduplication + * and fragment consolidation are still in effect and sparse blocks are + * discarded. + * + * @param proc A pointer to a block processor object. + * @param user An optional user data pointer stored with the block and passed on + * to the underlying @ref sqfs_block_writer_t. + * @param flags A combination of @ref SQFS_BLK_FLAGS that can be used to + * micro manage how the data is processed. + * @param data The data to write to the block. + * + * @return Zero on success, an @ref SQFS_ERROR value on failure. + */ +SQFS_API int sqfs_block_processor_submit_block(sqfs_block_processor_t *proc, + void *user, sqfs_u32 flags, + const void *data, size_t size); + +/** * @brief Wait for the in-flight data blocks to finish. * * @memberof sqfs_block_processor_t |