From 5038c4b33ea403203b8edd82b44a8db06464409b Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 11 Jun 2019 01:24:57 +0200 Subject: Major cleanup of mkfs block processor This commit tries to make the block and fragment processing code a lot more readable by simplifying it as follows. The following pattern is used repeatedly: - Try to compress a block - Write the compressed if smaller (the original otherwise) to a file - Print errors on the way - Set the magic (1 << 24) flag if we wrote the original - Increment the super block byte counter => Move that to a seperate function called "write_compressed" => Move the code to grow the fragment table is moved to a seperate function. => Clearing the fragment buffer is pointless, so remove that The add_fragment/add_block functions are now trivial => Merge them into process_file => Global block counter no longer needed, so remove that too Signed-off-by: David Oberhollenzer --- mkfs/mkfs.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'mkfs/mkfs.h') diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h index c4cd8a1..fe4123b 100644 --- a/mkfs/mkfs.h +++ b/mkfs/mkfs.h @@ -47,8 +47,6 @@ typedef struct { sqfs_fragment_t *fragments; size_t num_fragments; size_t max_fragments; - - int file_block_count; size_t frag_offset; id_table_t idtbl; -- cgit v1.2.3