diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-10 21:48:37 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-10 21:52:09 +0100 |
commit | 9d6515ce3dbc2b4e854a1ac418555cc89bb2bb70 (patch) | |
tree | 7040067e02b9d748735f4461cbc21ef46aab7c3a | |
parent | 13a0c1b05a4b175f13decf3b15567dc71ea043ac (diff) |
Cleanup: remove the fragment store/discard and block discard hooks
There is no obvious non-footgun use for those other than tallying
statistics, which is now done by the data structures themselves.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r-- | include/sqfs/block_writer.h | 33 | ||||
-rw-r--r-- | lib/sqfs/block_processor/common.c | 9 | ||||
-rw-r--r-- | lib/sqfs/block_writer.c | 10 |
3 files changed, 1 insertions, 51 deletions
diff --git a/include/sqfs/block_writer.h b/include/sqfs/block_writer.h index 421f8bd..678abd5 100644 --- a/include/sqfs/block_writer.h +++ b/include/sqfs/block_writer.h @@ -98,39 +98,6 @@ struct sqfs_block_hooks_t { 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. diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c index bedc923..6bd5d26 100644 --- a/lib/sqfs/block_processor/common.c +++ b/lib/sqfs/block_processor/common.c @@ -165,10 +165,6 @@ int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag, sqfs_inode_set_frag_location(frag->inode, proc->frag_block->index, proc->frag_block->size); - if (proc->hooks != NULL && proc->hooks->pre_fragment_store != NULL) { - proc->hooks->pre_fragment_store(proc->user_ptr, frag); - } - memcpy(proc->frag_block->data + proc->frag_block->size, frag->data, frag->size); @@ -182,11 +178,6 @@ fail: return err; out_duplicate: sqfs_inode_set_frag_location(frag->inode, index, offset); - - if (proc->hooks != NULL && - proc->hooks->notify_fragment_discard != NULL) { - proc->hooks->notify_fragment_discard(proc->user_ptr, frag); - } return 0; } diff --git a/lib/sqfs/block_writer.c b/lib/sqfs/block_writer.c index 94bd044..52ed3ac 100644 --- a/lib/sqfs/block_writer.c +++ b/lib/sqfs/block_writer.c @@ -165,8 +165,8 @@ void sqfs_block_writer_destroy(sqfs_block_writer_t *wr) int sqfs_block_writer_write(sqfs_block_writer_t *wr, sqfs_block_t *block, sqfs_u64 *location) { - sqfs_u64 offset, bytes; size_t start, count; + sqfs_u64 offset; sqfs_u32 out; int err; @@ -230,14 +230,6 @@ int sqfs_block_writer_write(sqfs_block_writer_t *wr, sqfs_block_t *block, wr->num_blocks = wr->file_start; } - if (wr->hooks != NULL && - wr->hooks->notify_blocks_erased != NULL) { - bytes = wr->file->get_size(wr->file) - wr->start; - - wr->hooks->notify_blocks_erased(wr->user_ptr, - count, bytes); - } - err = wr->file->truncate(wr->file, wr->start); if (err) return err; |