159 const size_t name_size);
228 bool follow_symlinks);
256__attribute__((deprecated(
"Since 1.2.0. Use sqsh_path_resolver_new() "
269__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_up() "
285__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_next() "
298__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_type() "
312__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_name() "
313 "instead."))) const
char *
325__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_name_size() "
326 "instead."))) uint16_t
342__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_name_dup() "
355__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_revert() "
370__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_lookup() "
374 const
size_t name_size);
385__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_down() "
398__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_to_root() "
412__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_open_file() "
430__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_resolve() "
433 struct
SqshTreeWalker *walker, const
char *path,
bool follow_symlinks);
444__attribute__((deprecated("Since 1.2.0. Use sqsh_path_resolver_free() "
#define SQSH_NO_UNUSED
Warn if return value is unused.
size_t sqsh_index_t
typedef used for indexing
SqshFileType
enum that represents the file type.
const struct SqshDirectoryIterator * sqsh_tree_traversal_iterator(const struct SqshTreeTraversal *traversal)
Gets the underlying directory iterator pointing to the current entry.
SqshTreeTraversalState
The state of the tree traversal.
@ SQSH_TREE_TRAVERSAL_STATE_INIT
@ SQSH_TREE_TRAVERSAL_STATE_FILE
@ SQSH_TREE_TRAVERSAL_STATE_DIRECTORY_BEGIN
@ SQSH_TREE_TRAVERSAL_STATE_DIRECTORY_END
const char * sqsh_path_resolver_name(const struct SqshPathResolver *walker)
Returns the name of the current entry. This entry is not zero terminated.
uint64_t sqsh_path_resolver_inode_ref(const struct SqshPathResolver *walker)
Returns the inode reference of the current entry.
struct SqshPathResolver * sqsh_path_resolver_new(struct SqshArchive *archive, int *err)
Creates a new SqshPathResolver object at the root inode.
SQSH_NO_UNUSED char * sqsh_path_resolver_name_dup(const struct SqshPathResolver *walker)
creates a heap allocated copy of the name of the current entry.
SQSH_NO_UNUSED int sqsh_path_resolver_resolve(struct SqshPathResolver *walker, const char *path, bool follow_symlinks)
Resolve a path with the tree walker.
uint32_t sqsh_path_resolver_dir_inode(const struct SqshPathResolver *walker)
Returns the inode of the current working directory.
enum SqshFileType sqsh_path_resolver_type(const struct SqshPathResolver *walker)
Returns the inode type of the current entry.
SQSH_NO_UNUSED int sqsh_path_resolver_up(struct SqshPathResolver *walker)
Moves the walker one level up.
SQSH_NO_UNUSED int sqsh_path_resolver_lookup(struct SqshPathResolver *walker, const char *name, const size_t name_size)
Looks up an entry in the current directory.
SQSH_NO_UNUSED int sqsh_path_resolver_down(struct SqshPathResolver *walker)
Lets the walker enter the current entry.
SQSH_NO_UNUSED int sqsh_path_resolver_to_root(struct SqshPathResolver *walker)
Moves the walker to the root directory.
SQSH_NO_UNUSED struct SqshFile * sqsh_path_resolver_open_file(const struct SqshPathResolver *walker, int *err)
Returns the inode of the current entry.
int sqsh_path_resolver_free(struct SqshPathResolver *reader)
Cleans up resources used by a SqshPathResolver struct.
SQSH_NO_UNUSED int sqsh_path_resolver_revert(struct SqshPathResolver *walker)
reverts the walker to the begining of the current directory.
uint16_t sqsh_path_resolver_name_size(const struct SqshPathResolver *walker)
Returns the size of the name of the current entry.
SQSH_NO_UNUSED bool sqsh_path_resolver_next(struct SqshPathResolver *walker, int *err)
Moves the walker to the next entry int the current directory.
A walker over the contents of a file.
SQSH_NO_UNUSED char * sqsh_tree_traversal_name_dup(const struct SqshTreeTraversal *traversal)
creates a heap allocated copy of the name of the current entry.
enum SqshTreeTraversalState sqsh_tree_traversal_state(const struct SqshTreeTraversal *traversal)
returns the state of the traversal.
SQSH_NO_UNUSED bool sqsh_tree_traversal_next(struct SqshTreeTraversal *traversal, int *err)
Moves the traversal to the next entry int the current directory.
char * sqsh_tree_traversal_path_dup(const struct SqshTreeTraversal *traversal)
Creates a heap allocated copy of the path to the current entry.
int sqsh_tree_traversal_free(struct SqshTreeTraversal *traversal)
void sqsh_tree_traversal_set_max_depth(struct SqshTreeTraversal *traversal, size_t max_depth)
Sets the maximum depth of the traversal.
const char * sqsh_tree_traversal_name(const struct SqshTreeTraversal *traversal, size_t *len)
Returns the name of the current entry.
struct SqshTreeTraversal * sqsh_tree_traversal_new(const struct SqshFile *file, int *err)
Creates a new SqshTreeTraversal object rooted at the specified inode.
const char * sqsh_tree_traversal_path_segment(const struct SqshTreeTraversal *traversal, size_t *len, sqsh_index_t index)
Get a segment of the path of the current entry.
enum SqshFileType sqsh_tree_traversal_type(const struct SqshTreeTraversal *traversal)
Returns the inode type of the current entry.
size_t sqsh_tree_traversal_depth(const struct SqshTreeTraversal *traversal)
Returns the path segment at a given index.
SQSH_NO_UNUSED struct SqshFile * sqsh_tree_traversal_open_file(const struct SqshTreeTraversal *traversal, int *err)
Returns the inode of the current entry.
A walker over the contents of a file.
SQSH_NO_UNUSED struct SqshFile * sqsh_tree_walker_open_file(const struct SqshTreeWalker *walker, int *err)
Returns the inode of the current entry.
SQSH_NO_UNUSED int sqsh_tree_walker_up(struct SqshTreeWalker *walker)
Moves the walker one level up.
uint16_t sqsh_tree_walker_name_size(const struct SqshTreeWalker *walker)
Returns the size of the name of the current entry.
enum SqshFileType sqsh_tree_walker_type(const struct SqshTreeWalker *walker)
Returns the inode type of the current entry.
SQSH_NO_UNUSED int sqsh_tree_walker_resolve(struct SqshTreeWalker *walker, const char *path, bool follow_symlinks)
Resolve a path with the tree walker.
struct SqshTreeWalker * sqsh_tree_walker_new(struct SqshArchive *archive, int *err)
Creates a new SqshTreeWalker object at the root inode.
SQSH_NO_UNUSED int sqsh_tree_walker_to_root(struct SqshTreeWalker *walker)
Moves the walker to the root directory.
SQSH_NO_UNUSED int sqsh_tree_walker_next(struct SqshTreeWalker *walker)
Moves the walker to the next entry int the current directory.
const char * sqsh_tree_walker_name(const struct SqshTreeWalker *walker)
Returns the name of the current entry. This entry is not zero terminated.
SQSH_NO_UNUSED int sqsh_tree_walker_lookup(struct SqshTreeWalker *walker, const char *name, const size_t name_size)
Looks up an entry in the current directory.
SQSH_NO_UNUSED int sqsh_tree_walker_down(struct SqshTreeWalker *walker)
Lets the walker enter the current entry.
SQSH_NO_UNUSED char * sqsh_tree_walker_name_dup(const struct SqshTreeWalker *walker)
creates a heap allocated copy of the name of the current entry.
SQSH_NO_UNUSED int sqsh_tree_walker_revert(struct SqshTreeWalker *walker)
reverts the walker to the begining of the current directory.
int sqsh_tree_walker_free(struct SqshTreeWalker *reader)
Cleans up resources used by a SqshTreeWalker struct.