libsquashfs  1.3.2
A new set of tools and libraries for working with SquashFS images
block_processor.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later */
2 /*
3  * block_processor.h - This file is part of libsquashfs
4  *
5  * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published
9  * by the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 #ifndef SFQS_BLOCK_PROCESSOR_H
21 #define SFQS_BLOCK_PROCESSOR_H
22 
23 #include "sqfs/predef.h"
24 
64  size_t size;
65 
69  sqfs_u64 input_bytes_read;
70 
79 
83  sqfs_u64 data_block_count;
84 
88  sqfs_u64 frag_block_count;
89 
94 
102 
111 };
112 
132  sqfs_u32 size;
133 
137  sqfs_u32 max_block_size;
138 
142  sqfs_u32 num_workers;
143 
150  sqfs_u32 max_backlog;
151 
162 
167 
172 
182 
189 };
190 
191 #ifdef __cplusplus
192 extern "C" {
193 #endif
194 
216 SQFS_API
218  sqfs_compressor_t *cmp,
219  unsigned int num_workers,
220  size_t max_backlog,
222  sqfs_frag_table_t *tbl);
223 
236 SQFS_API
238  sqfs_block_processor_t **out);
239 
273  sqfs_inode_generic_t **inode,
274  void *user, sqfs_u32 flags);
275 
291  const void *data, size_t size);
292 
310 
338  void *user, sqfs_u32 flags,
339  const void *data, size_t size);
340 
353 
371 
381 SQFS_API const sqfs_block_processor_stats_t
383 
384 #ifdef __cplusplus
385 }
386 #endif
387 
388 #endif /* SFQS_BLOCK_PROCESSOR_H */
SQFS_API int sqfs_block_processor_begin_file(sqfs_block_processor_t *proc, sqfs_inode_generic_t **inode, void *user, sqfs_u32 flags)
Start writing a file.
sqfs_frag_table_t * tbl
A fragment table to use for storing block locations.
Abstracts reading, writing and management of the fragment table.
Encapsultes a compressor with a simple interface to compress or extract chunks of data...
Definition: compressor.h:40
sqfs_compressor_t * cmp
A pointer to a compressor.
sqfs_u32 max_block_size
The maximum size of a data block.
sqfs_u64 actual_frag_count
Total number of tail-end fragments actually stored in fragment blocks.
SQFS_API int sqfs_block_processor_submit_block(sqfs_block_processor_t *proc, void *user, sqfs_u32 flags, const void *data, size_t size)
Submit a raw block for processing.
sqfs_u32 num_workers
The number of worker threads to create.
SQFS_API int sqfs_block_processor_finish(sqfs_block_processor_t *proc)
Wait for the in-flight data blocks to finish and finally flush the current fragment block...
sqfs_u64 sparse_block_count
Total number of sparse blocks encountered.
Abstracts file I/O to make it easy to embedd SquashFS.
Definition: io.h:94
SQFS_API const sqfs_block_processor_stats_t * sqfs_block_processor_get_stats(const sqfs_block_processor_t *proc)
Get accumulated runtime statistics from a block processor.
sqfs_u64 total_frag_count
Total number of tail-end fragments produced.
sqfs_u64 output_bytes_generated
Total number of bytes sent down to the block processor.
Used to store runtime statistics about the sqfs_block_processor_t.
Encapsulates a description for an sqfs_block_processor_t.
sqfs_u32 size
Holds the size of the structure.
SQFS_API sqfs_block_processor_t * sqfs_block_processor_create(size_t max_block_size, sqfs_compressor_t *cmp, unsigned int num_workers, size_t max_backlog, sqfs_block_writer_t *wr, sqfs_frag_table_t *tbl)
Create a data block processor.
Abstracts generating of file data and fragment blocks.
sqfs_u64 data_block_count
Total number of data blocks produced.
SQFS_API int sqfs_block_processor_sync(sqfs_block_processor_t *proc)
Wait for the in-flight data blocks to finish.
sqfs_file_t * file
Pointer to a file to read back fragment blocks from.
sqfs_u64 frag_block_count
Total number of fragment blocks produced.
sqfs_block_writer_t * wr
A block writer to send to finished blocks to.
Abstracts writing and deduplicating of data and fragment blocks.
Definition: block_writer.h:42
SQFS_API int sqfs_block_processor_append(sqfs_block_processor_t *proc, const void *data, size_t size)
Append data to the current file.
SQFS_API int sqfs_block_processor_end_file(sqfs_block_processor_t *proc)
Stop writing the current file and flush everything that is buffered internally.
SQFS_API int sqfs_block_processor_create_ex(const sqfs_block_processor_desc_t *desc, sqfs_block_processor_t **out)
Create a data block processor.
Includes forward declarations of data structures, macros and integer types.
sqfs_compressor_t * uncmp
A pointer to a compressor the decompresses data.
sqfs_u64 input_bytes_read
Total number of bytes fed into the front end API.
sqfs_u32 max_backlog
The maximum number of blocks currently in flight.
size_t size
Holds the size of the structure.
A generic inode structure that combines all others and provides additional information.
Definition: inode.h:488