From ff4a9235feb4237854ff102c4dc7cf4645d6a116 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 26 Sep 2019 17:21:44 +0200 Subject: Add file API stub to sqfs data writer Basically move the state tracking from the old data writer over to the new one. Signed-off-by: David Oberhollenzer --- include/sqfs/block.h | 26 +++++++++++++------------- include/sqfs/data_writer.h | 6 ++++++ 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'include/sqfs') diff --git a/include/sqfs/block.h b/include/sqfs/block.h index 5216fd7..0dee934 100644 --- a/include/sqfs/block.h +++ b/include/sqfs/block.h @@ -40,16 +40,6 @@ typedef enum { */ SQFS_BLK_DONT_COMPRESS = 0x0001, - /** - * @brief Indicates that an equeued block is the first block of a file. - */ - SQFS_BLK_FIRST_BLOCK = 0x0002, - - /** - * @brief Indicates that an equeued block is the last block of a file. - */ - SQFS_BLK_LAST_BLOCK = 0x0004, - /** * @brief Allign the block on disk to device block size. * @@ -60,13 +50,23 @@ typedef enum { * If used with @ref SQFS_BLK_LAST_BLOCK, the output file is padded * after writing the block. */ - SQFS_BLK_ALLIGN = 0x0008, + SQFS_BLK_ALLIGN = 0x0002, + + /** + * @brief Indicates that an equeued block is the first block of a file. + */ + SQFS_BLK_FIRST_BLOCK = 0x0800, + + /** + * @brief Indicates that an equeued block is the last block of a file. + */ + SQFS_BLK_LAST_BLOCK = 0x1000, /** * @brief Indicates that a block is a tail end of a file and the block * processor should take care of fragment packing and accounting. */ - SQFS_BLK_IS_FRAGMENT = 0x0010, + SQFS_BLK_IS_FRAGMENT = 0x2000, /** * @brief Set by the block processor on fragment blocks that @@ -82,7 +82,7 @@ typedef enum { /** * @brief The combination of all flags that are user settable. */ - SQFS_BLK_USER_SETTABLE_FLAGS = 0x001F, + SQFS_BLK_USER_SETTABLE_FLAGS = 0x0003, } E_SQFS_BLK_FLAGS; /** diff --git a/include/sqfs/data_writer.h b/include/sqfs/data_writer.h index cc99700..ffa3334 100644 --- a/include/sqfs/data_writer.h +++ b/include/sqfs/data_writer.h @@ -169,6 +169,10 @@ sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size, */ SQFS_API void sqfs_data_writer_destroy(sqfs_data_writer_t *proc); +SQFS_API int sqfs_data_writer_begin_file(sqfs_data_writer_t *proc, + sqfs_inode_generic_t *inode, + uint32_t flags); + /** * @brief Add a block to be processed. * @@ -187,6 +191,8 @@ SQFS_API void sqfs_data_writer_destroy(sqfs_data_writer_t *proc); SQFS_API int sqfs_data_writer_enqueue(sqfs_data_writer_t *proc, sqfs_block_t *block); +SQFS_API int sqfs_data_writer_end_file(sqfs_data_writer_t *proc); + /** * @brief Wait for the works to finish and finally flush the current * fragment block. -- cgit v1.2.3