aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sqfs/block_writer.h95
-rw-r--r--lib/sqfs/block_writer.c32
2 files changed, 0 insertions, 127 deletions
diff --git a/include/sqfs/block_writer.h b/include/sqfs/block_writer.h
index 06131f5..1fd110a 100644
--- a/include/sqfs/block_writer.h
+++ b/include/sqfs/block_writer.h
@@ -39,86 +39,6 @@
*/
/**
- * @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_writer_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_writer_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 write additional data to the file, which is taken
- * into account when padding the file.
- *
- * @param user A user pointer.
- * @param flags A pointer to a combination of @ref SQFS_BLK_FLAGS
- * describing the block. The callback can modify the
- * user settable flags.
- * @param size The size of the block in bytes.
- * @param data A pointer to the raw block data.
- * @param file The file that the block will be written to.
- */
- void (*pre_block_write)(void *user, sqfs_u32 *flags, sqfs_u32 size,
- const sqfs_u8 *data, 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 flags A combination of @ref SQFS_BLK_FLAGS describing
- * the block.
- * @param size The size of the block in bytes.
- * @param data A pointer to the raw block data.
- * @param file The file that the block was written to.
- */
- void (*post_block_write)(void *user, sqfs_u32 flags, sqfs_u32 size,
- const sqfs_u8 *data, sqfs_file_t *file);
-
- /**
- * @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);
-};
-
-/**
* @struct sqfs_block_writer_stats_t
*
* @brief Collects run time statistics of the @ref sqfs_block_writer_t
@@ -179,21 +99,6 @@ SQFS_API sqfs_block_writer_t *sqfs_block_writer_create(sqfs_file_t *file,
sqfs_u32 flags);
/**
- * @brief Register a set of callbacks with a block writer.
- *
- * @memberof sqfs_block_writer_t
- *
- * @param wr A pointer to a block writer object.
- * @param user_ptr A user data pointer that should be passed to the callbacks.
- * @param hooks A structure holding various callbacks.
- *
- * @return Zero on success, an @ref SQFS_ERROR on failure.
- */
-SQFS_API int sqfs_block_writer_set_hooks(sqfs_block_writer_t *wr,
- void *user_ptr,
- const sqfs_block_hooks_t *hooks);
-
-/**
* @brief Submit a data block to a blokc writer.
*
* @memberof sqfs_block_writer_t
diff --git a/lib/sqfs/block_writer.c b/lib/sqfs/block_writer.c
index c9d1fc1..b819b58 100644
--- a/lib/sqfs/block_writer.c
+++ b/lib/sqfs/block_writer.c
@@ -36,9 +36,6 @@ struct sqfs_block_writer_t {
sqfs_block_writer_stats_t stats;
- const sqfs_block_hooks_t *hooks;
- void *user_ptr;
-
sqfs_u64 data_area_start;
sqfs_u64 start;
@@ -105,9 +102,6 @@ static int align_file(sqfs_block_writer_t *wr)
if (padding == 0)
return SQFS_ERROR_ALLOC;
- if (wr->hooks != NULL && wr->hooks->prepare_padding != NULL)
- wr->hooks->prepare_padding(wr->user_ptr, padding, diff);
-
ret = wr->file->write_at(wr->file, size, padding, diff);
free(padding);
if (ret)
@@ -150,17 +144,6 @@ sqfs_block_writer_t *sqfs_block_writer_create(sqfs_file_t *file,
return wr;
}
-int sqfs_block_writer_set_hooks(sqfs_block_writer_t *wr, void *user_ptr,
- const sqfs_block_hooks_t *hooks)
-{
- if (hooks->size != sizeof(*hooks))
- return SQFS_ERROR_UNSUPPORTED;
-
- wr->hooks = hooks;
- wr->user_ptr = user_ptr;
- return 0;
-}
-
int sqfs_block_writer_write(sqfs_block_writer_t *wr, sqfs_u32 size,
sqfs_u32 checksum, sqfs_u32 flags,
const sqfs_u8 *data, sqfs_u64 *location)
@@ -170,16 +153,6 @@ int sqfs_block_writer_write(sqfs_block_writer_t *wr, sqfs_u32 size,
sqfs_u32 out;
int err;
- if (wr->hooks != NULL && wr->hooks->pre_block_write != NULL) {
- out = flags;
- flags &= ~SQFS_BLK_USER_SETTABLE_FLAGS;
-
- wr->hooks->pre_block_write(wr->user_ptr, &out, size,
- data, wr->file);
-
- flags |= out & SQFS_BLK_USER_SETTABLE_FLAGS;
- }
-
if (flags & SQFS_BLK_FIRST_BLOCK) {
wr->start = wr->file->get_size(wr->file);
wr->file_start = wr->num_blocks;
@@ -213,11 +186,6 @@ int sqfs_block_writer_write(sqfs_block_writer_t *wr, sqfs_u32 size,
wr->stats.bytes_written = offset + size - wr->data_area_start;
}
- if (wr->hooks != NULL && wr->hooks->post_block_write != NULL) {
- wr->hooks->post_block_write(wr->user_ptr, flags, size, data,
- wr->file);
- }
-
if (flags & SQFS_BLK_LAST_BLOCK) {
if (flags & SQFS_BLK_ALIGN) {
err = align_file(wr);