libsqsh v1.5.2
Loading...
Searching...
No Matches
sqsh_archive_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_ARCHIVE_PRIVATE_H
35#define SQSH_ARCHIVE_PRIVATE_H
36
37#include "sqsh_archive.h"
38
39#include "sqsh_error.h"
40#include "sqsh_file_private.h"
41#include "sqsh_utils_private.h"
42#include "sqsh_xattr_private.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/***************************************
49 * archive/trailing_context.c
50 */
51
60 struct SqshMapReader cursor;
61};
62
74 struct SqshTrailingContext *context, struct SqshArchive *sqsh);
75
86
87/***************************************
88 * archive/inode_map.c
89 */
90
95 int (*init)(struct SqshInodeMap *map, struct SqshArchive *archive);
96 uint64_t (*get)(
97 const struct SqshInodeMap *map, uint32_t inode_number, int *err);
98 int (*set)(
99 struct SqshInodeMap *map, uint32_t inode_number,
100 uint64_t inode_ref);
101 int (*cleanup)(struct SqshInodeMap *map);
102};
111 const struct SqshInodeMapImpl *impl;
112 sqsh__mutex_t *mutex;
113 struct CxRadixTree inode_refs;
114 size_t inode_count;
115 struct SqshExportTable *export_table;
116};
117
129sqsh__inode_map_init(struct SqshInodeMap *map, struct SqshArchive *archive);
130
141
142/***************************************
143 * archive/superblock.c
144 */
145
154 struct SqshMapReader cursor;
155};
156
168 struct SqshSuperblock *superblock, struct SqshMapManager *mapper);
169
180
181/***************************************
182 * archive/compression_options.c
183 */
184
193 uint16_t compression_id;
194 struct SqshMetablockIterator metablock;
195};
196
207 struct SqshCompressionOptions *compression_options,
208 struct SqshArchive *sqsh);
209
220 struct SqshCompressionOptions *compression_options);
221
222/***************************************
223 * archive/archive.c
224 */
225
230 struct SqshMapManager map_manager;
231 struct SqshExtractManager data_extract_manager;
232 struct SqshExtractManager metablock_extract_manager;
233 struct SqshSuperblock superblock;
234 struct SqshIdTable id_table;
235 struct SqshExportTable export_table;
236 struct SqshXattrTable xattr_table;
237 struct SqshFragmentTable fragment_table;
238 struct SqshInodeMap inode_map;
239 uint8_t initialized;
240 struct SqshConfig config;
241 sqsh__mutex_t lock;
242 uint8_t *zero_block;
243};
244
257 struct SqshArchive *sqsh, const void *source,
258 const struct SqshConfig *config);
259
272 struct SqshArchive *archive,
273 struct SqshExtractManager **data_extract_manager);
274
287
297SQSH_NO_EXPORT const uint8_t *
299
309SQSH_NO_EXPORT size_t
311
322
323#ifdef __cplusplus
324}
325#endif
326#endif /* SQSH_ARCHIVE_PRIVATE_H */
SQSH_NO_EXPORT int sqsh__inode_map_cleanup(struct SqshInodeMap *map)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__compression_options_init(struct SqshCompressionOptions *compression_options, struct SqshArchive *sqsh)
SQSH_NO_EXPORT int sqsh__compression_options_cleanup(struct SqshCompressionOptions *compression_options)
SQSH_NO_EXPORT const uint8_t * sqsh__archive_zero_block(const struct SqshArchive *archive)
SQSH_NO_UNUSED SQSH_NO_EXPORT int sqsh__superblock_init(struct SqshSuperblock *superblock, struct SqshMapManager *mapper)
SQSH_NO_UNUSED SQSH_NO_EXPORT int sqsh__inode_map_init(struct SqshInodeMap *map, struct SqshArchive *archive)
SQSH_NO_EXPORT size_t sqsh__archive_zero_block_size(const struct SqshArchive *archive)
SQSH_NO_EXPORT int sqsh__archive_cleanup(struct SqshArchive *sqsh)
SQSH_NO_EXPORT int sqsh__archive_data_extract_manager(struct SqshArchive *archive, struct SqshExtractManager **data_extract_manager)
SQSH_NO_EXPORT struct SqshExtractManager * sqsh__archive_metablock_extract_manager(struct SqshArchive *archive)
SQSH_NO_UNUSED SQSH_NO_EXPORT int sqsh__trailing_init(struct SqshTrailingContext *context, struct SqshArchive *sqsh)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__archive_init(struct SqshArchive *sqsh, const void *source, const struct SqshConfig *config)
SQSH_NO_EXPORT int sqsh__trailing_cleanup(struct SqshTrailingContext *context)
SQSH_NO_EXPORT int sqsh__superblock_cleanup(struct SqshSuperblock *superblock)
#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
The compression options context is used to store the compression options for a specific compression a...
The SqshConfig struct contains all the configuration options for a sqsh session.
The export table.
Manages chunks of compressed areas from an archive.
The fragment table of an archive.
The id table of an archive.
The inode map context is used to cache inodes numbers and their corresponding inode references.
The map manager.
A reader over a mapping of data.
Iterator over metablocks.
The superblock context is used to access the superblock of the archive.
The trailing context is used to access the trailing data of the archive.
The extended attribute lookup table.