libsqsh v1.5.2
Loading...
Searching...
No Matches
sqsh_tree_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_TREE_PRIVATE_H
35#define SQSH_TREE_PRIVATE_H
36
38#include <sqsh_tree.h>
39
40#include <cextras/memory.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46struct SqshArchive;
47
48/***************************************
49 * tree/path_resolver.c
50 */
51
59 size_t max_symlink_depth;
60 size_t current_symlink_depth;
61 struct SqshFile cwd;
62 struct SqshDirectoryIterator iterator;
63 struct SqshArchive *archive;
64 struct SqshInodeMap *inode_map;
65 uint64_t current_inode_ref;
66 uint64_t root_inode_ref;
67};
68
70 struct SqshPathResolver *resolver, struct SqshArchive *archive);
71
73 struct SqshPathResolver *resolver, uint64_t inode_ref);
74
76 struct SqshPathResolver *resolver, uint32_t inode_number);
77
80
83
86
88 struct SqshPathResolver *resolver, const char *path, size_t path_len,
89 bool follow_symlinks);
90
93
94/***************************************
95 * tree/traversal.c
96 */
97
106
115 struct CxPreallocPool stack_pool;
116 struct SqshTreeTraversalStackElement *stack;
117
118 size_t depth;
119 size_t max_depth;
120
121 const struct SqshFile *base_file;
122 struct SqshDirectoryIterator base_iterator;
123
124 const struct SqshFile *current_file;
125 struct SqshDirectoryIterator *current_iterator;
126 enum SqshTreeTraversalState state;
127};
128
140 struct SqshTreeTraversal *traversal, const struct SqshFile *file);
141
153
154/***************************************
155 * tree/walker.c
156 */
157
166 struct SqshPathResolver inner;
167} __attribute__((deprecated("Since 1.2.0. Use SqshPathResolver instead.")));
168
169#ifdef __cplusplus
170}
171#endif
172#endif /* SQSH_TREE_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
SqshFileType
enum that represents the file type.
Definition sqsh_file.h:315
SqshTreeTraversalState
The state of the tree traversal.
Definition sqsh_tree.h:455
SQSH_NO_EXPORT enum SqshFileType sqsh__path_resolver_type(const struct SqshPathResolver *resolver)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__path_resolver_to_ref(struct SqshPathResolver *resolver, uint64_t inode_ref)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__path_resolver_resolve_nt(struct SqshPathResolver *resolver, const char *path, size_t path_len, bool follow_symlinks)
SQSH_NO_EXPORT int sqsh__tree_traversal_cleanup(struct SqshTreeTraversal *traversal)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__tree_traversal_init(struct SqshTreeTraversal *traversal, const struct SqshFile *file)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__path_resolver_to_inode(struct SqshPathResolver *resolver, uint32_t inode_number)
SQSH_NO_EXPORT int sqsh__path_resolver_cleanup(struct SqshPathResolver *resolver)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__path_resolver_follow_symlink(struct SqshPathResolver *resolver)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__path_resolver_init(struct SqshPathResolver *resolver, struct SqshArchive *archive)
SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__path_resolver_follow_all_symlinks(struct SqshPathResolver *resolver)
A directory iterator.
The Inode context.
The inode map context is used to cache inodes numbers and their corresponding inode references.
Resolves paths.
A walker over the contents of a file.
struct SqshTreeTraversalStackElement * next
struct SqshDirectoryIterator iterator
A walker over the contents of a file.
A walker over the contents of a file.