libsqsh v1.5.1
Loading...
Searching...
No Matches
sqsh_metablock_private.h
Go to the documentation of this file.
1/******************************************************************************
2 * *
3 * Copyright (c) 2023-2024, Enno Boland <g@s01.de> *
4 * *
5 * Redistribution and use in source and binary forms, with or without *
6 * modification, are permitted provided that the following conditions are *
7 * met: *
8 * *
9 * * Redistributions of source code must retain the above copyright notice, *
10 * this list of conditions and the following disclaimer. *
11 * * Redistributions in binary form must reproduce the above copyright *
12 * notice, this list of conditions and the following disclaimer in the *
13 * documentation and/or other materials provided with the distribution. *
14 * *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS *
16 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, *
17 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR *
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR *
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
23 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26 * *
27 ******************************************************************************/
28
34#ifndef SQSH_METABLOCK_PRIVATE_H
35#define SQSH_METABLOCK_PRIVATE_H
36
38#include "sqsh_mapper_private.h"
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44struct SqshArchive;
45
46/***************************************
47 * metablock/metablock_iterator.c
48 */
49
57 struct SqshMapReader reader;
58 struct SqshExtractManager *compression_manager;
59 struct SqshExtractView extract_view;
60 bool is_compressed;
61 uint16_t outer_size;
62 uint16_t inner_size;
63 const uint8_t *data;
64};
65
78 struct SqshMetablockIterator *iterator, struct SqshArchive *sqsh,
79 uint64_t start_address, uint64_t upper_limit);
80
95
109 struct SqshMetablockIterator *iterator, uint64_t *offset);
110
119SQSH_NO_EXPORT const uint8_t *
121
130SQSH_NO_EXPORT size_t
132
143
144/***************************************
145 * metablock/metablock_reader.c
146 */
147
155 struct SqshReader reader;
156 struct SqshMetablockIterator iterator;
157};
158
172 struct SqshMetablockReader *reader, struct SqshArchive *sqsh,
173 const uint64_t start_address, const uint64_t upper_limit);
174
187 struct SqshMetablockReader *reader, uint64_t offset, size_t size);
188
199SQSH_NO_EXPORT const uint8_t *
201
212SQSH_NO_EXPORT size_t
214
226
227#ifdef __cplusplus
228}
229#endif
230#endif /* SQSH_METABLOCK_PRIVATE_H */
#define SQSH_NO_EXPORT
Do not export symbol.
Definition sqsh_common.h:64
#define SQSH_NO_UNUSED
Warn if return value is unused.
Definition sqsh_common.h:59
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__metablock_reader_init(struct SqshMetablockReader *reader, struct SqshArchive *sqsh, const uint64_t start_address, const uint64_t upper_limit)
SQSH_NO_EXPORT const uint8_t * sqsh__metablock_iterator_data(const struct SqshMetablockIterator *iterator)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__metablock_iterator_init(struct SqshMetablockIterator *iterator, struct SqshArchive *sqsh, uint64_t start_address, uint64_t upper_limit)
SQSH_NO_EXPORT const uint8_t * sqsh__metablock_reader_data(const struct SqshMetablockReader *reader)
SQSH_NO_EXPORT int sqsh__metablock_reader_cleanup(struct SqshMetablockReader *reader)
SQSH_NO_EXPORT int sqsh__metablock_iterator_cleanup(struct SqshMetablockIterator *iterator)
SQSH_NO_EXPORT size_t sqsh__metablock_reader_size(const struct SqshMetablockReader *reader)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__metablock_reader_advance(struct SqshMetablockReader *reader, uint64_t offset, size_t size)
SQSH_NO_EXPORT bool sqsh__metablock_iterator_next(struct SqshMetablockIterator *iterator, int *err)
SQSH_NO_EXPORT size_t sqsh__metablock_iterator_size(const struct SqshMetablockIterator *iterator)
Manages chunks of compressed areas from an archive.
A fiew into compressed memory managed by a SqshExtractManager.
A reader over a mapping of data.
Iterator over metablocks.
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__metablock_iterator_skip(struct SqshMetablockIterator *iterator, uint64_t *offset)
Skips blocks until the block containing the offset is reached. Note that calling this function will i...
Reader over metablocks.