libsquashfs: include/sqfs/block_processor.h Source File

libsquashfs 1.3.2 A new set of tools and libraries for working with SquashFS images

Loading...
Searching...
No Matches
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
30
49
56 struct sqfs_block_processor_stats_t {
64 size_t size;
65
69 sqfs_u64 input_bytes_read;
70
78 sqfs_u64 output_bytes_generated;
79
83 sqfs_u64 data_block_count;
84
88 sqfs_u64 frag_block_count;
89
93 sqfs_u64 sparse_block_count;
94
101 sqfs_u64 total_frag_count;
102
110 sqfs_u64 actual_frag_count;
111};
112
121 struct sqfs_block_processor_desc_t {
132 sqfs_u32 size;
133
137 sqfs_u32 max_block_size;
138
142 sqfs_u32 num_workers;
143
150 sqfs_u32 max_backlog;
151
161 sqfs_compressor_t *cmp;
162
166 sqfs_block_writer_t *wr;
167
171 sqfs_frag_table_t *tbl;
172
181 sqfs_file_t *file;
182
188 sqfs_compressor_t *uncmp;
189};
190
191#ifdef __cplusplus
192extern "C" {
193#endif
194
216SQFS_API
217 sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
218 sqfs_compressor_t *cmp,
219 unsigned int num_workers,
220 size_t max_backlog,
221 sqfs_block_writer_t *wr,
222 sqfs_frag_table_t *tbl);
223
236SQFS_API
237 int sqfs_block_processor_create_ex(const sqfs_block_processor_desc_t *desc,
238 sqfs_block_processor_t **out);
239
272SQFS_API int sqfs_block_processor_begin_file(sqfs_block_processor_t *proc,
273 sqfs_inode_generic_t **inode,
274 void *user, sqfs_u32 flags);
275
290SQFS_API int sqfs_block_processor_append(sqfs_block_processor_t *proc,
291 const void *data, size_t size);
292
309SQFS_API int sqfs_block_processor_end_file(sqfs_block_processor_t *proc);
310
337SQFS_API int sqfs_block_processor_submit_block(sqfs_block_processor_t *proc,
338 void *user, sqfs_u32 flags,
339 const void *data, size_t size);
340
352SQFS_API int sqfs_block_processor_sync(sqfs_block_processor_t *proc);
353
370SQFS_API int sqfs_block_processor_finish(sqfs_block_processor_t *proc);
371
381SQFS_API const sqfs_block_processor_stats_t
382*sqfs_block_processor_get_stats(const sqfs_block_processor_t *proc);
383
384#ifdef __cplusplus
385}
386#endif
387
388#endif /* SFQS_BLOCK_PROCESSOR_H */
predef.h
Includes forward declarations of data structures, macros and integer types.
sqfs_block_processor_desc_t
Encapsulates a description for an sqfs_block_processor_t.
Definition block_processor.h:121
sqfs_block_processor_desc_t::tbl
sqfs_frag_table_t * tbl
A fragment table to use for storing block locations.
Definition block_processor.h:171
sqfs_block_processor_desc_t::size
sqfs_u32 size
Holds the size of the structure.
Definition block_processor.h:132
sqfs_block_processor_desc_t::max_block_size
sqfs_u32 max_block_size
The maximum size of a data block.
Definition block_processor.h:137
sqfs_block_processor_desc_t::num_workers
sqfs_u32 num_workers
The number of worker threads to create.
Definition block_processor.h:142
sqfs_block_processor_desc_t::file
sqfs_file_t * file
Pointer to a file to read back fragment blocks from.
Definition block_processor.h:181
sqfs_block_processor_desc_t::max_backlog
sqfs_u32 max_backlog
The maximum number of blocks currently in flight.
Definition block_processor.h:150
sqfs_block_processor_desc_t::uncmp
sqfs_compressor_t * uncmp
A pointer to a compressor the decompresses data.
Definition block_processor.h:188
sqfs_block_processor_desc_t::wr
sqfs_block_writer_t * wr
A block writer to send to finished blocks to.
Definition block_processor.h:166
sqfs_block_processor_desc_t::cmp
sqfs_compressor_t * cmp
A pointer to a compressor.
Definition block_processor.h:161
sqfs_block_processor_stats_t
Used to store runtime statistics about the sqfs_block_processor_t.
Definition block_processor.h:56
sqfs_block_processor_stats_t::data_block_count
sqfs_u64 data_block_count
Total number of data blocks produced.
Definition block_processor.h:83
sqfs_block_processor_stats_t::sparse_block_count
sqfs_u64 sparse_block_count
Total number of sparse blocks encountered.
Definition block_processor.h:93
sqfs_block_processor_stats_t::actual_frag_count
sqfs_u64 actual_frag_count
Total number of tail-end fragments actually stored in fragment blocks.
Definition block_processor.h:110
sqfs_block_processor_stats_t::total_frag_count
sqfs_u64 total_frag_count
Total number of tail-end fragments produced.
Definition block_processor.h:101
sqfs_block_processor_stats_t::size
size_t size
Holds the size of the structure.
Definition block_processor.h:64
sqfs_block_processor_stats_t::output_bytes_generated
sqfs_u64 output_bytes_generated
Total number of bytes sent down to the block processor.
Definition block_processor.h:78
sqfs_block_processor_stats_t::frag_block_count
sqfs_u64 frag_block_count
Total number of fragment blocks produced.
Definition block_processor.h:88
sqfs_block_processor_stats_t::input_bytes_read
sqfs_u64 input_bytes_read
Total number of bytes fed into the front end API.
Definition block_processor.h:69
sqfs_block_processor_t
Abstracts generating of file data and fragment blocks.
sqfs_block_processor_t::sqfs_block_processor_create
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.
sqfs_block_processor_t::sqfs_block_processor_end_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_block_processor_t::sqfs_block_processor_submit_block
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_block_processor_t::sqfs_block_processor_append
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_block_processor_t::sqfs_block_processor_create_ex
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.
sqfs_block_processor_t::sqfs_block_processor_begin_file
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_block_processor_t::sqfs_block_processor_get_stats
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_block_processor_t::sqfs_block_processor_finish
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_block_processor_t::sqfs_block_processor_sync
SQFS_API int sqfs_block_processor_sync(sqfs_block_processor_t *proc)
Wait for the in-flight data blocks to finish.
sqfs_block_writer_t
Abstracts writing and deduplicating of data and fragment blocks.
Definition block_writer.h:42
sqfs_compressor_t
Encapsultes a compressor with a simple interface to compress or extract chunks of data.
Definition compressor.h:40
sqfs_file_t
Abstracts file I/O to make it easy to embedd SquashFS.
Definition io.h:94
sqfs_frag_table_t
Abstracts reading, writing and management of the fragment table.
sqfs_inode_generic_t
A generic inode structure that combines all others and provides additional information.
Definition inode.h:488