libsqsh v1.5.2
Loading...
Searching...
No Matches
sqsh_directory.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_DIRECTORY_H
35#define SQSH_DIRECTORY_H
36
37#include "sqsh_file.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/***************************************
44 * iterator/directory_iterator.c
45 */
46
48
59sqsh_directory_iterator_new(const struct SqshFile *file, int *err);
60
75
87 struct SqshDirectoryIterator *iterator, const char *name,
88 const size_t name_len);
89
99__attribute__((deprecated("Since 1.3.0. Use sqsh_directory_iterator_name2() "
100 "instead"))) uint16_t
102
111uint32_t
113
123__attribute__((deprecated("Since 1.2.0. Use sqsh_directory_iterator_inode() "
124 "instead"))) uint64_t
126 const struct SqshDirectoryIterator *iterator);
135uint64_t
137
146enum SqshFileType
148
159 const struct SqshDirectoryIterator *iterator, int *err);
160
176 const struct SqshDirectoryIterator *iterator, size_t *len);
177
192__attribute__((deprecated("Since 1.3.0. Use sqsh_directory_iterator_inode() "
193 "instead"))) const char *
195
208SQSH_NO_UNUSED char *
210
221
222#ifdef __cplusplus
223}
224#endif
225#endif /* SQSH_DIRECTORY_H */
#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
A directory iterator.
uint32_t sqsh_directory_iterator_inode(const struct SqshDirectoryIterator *iterator)
Retrieves the inode number of the current entry.
SQSH_NO_UNUSED struct SqshDirectoryIterator * sqsh_directory_iterator_new(const struct SqshFile *file, int *err)
Allocates and initializes a new directory iterator.
uint64_t sqsh_directory_iterator_inode_ref(const struct SqshDirectoryIterator *iterator)
Retrieves the inode reference of the current entry.
SQSH_NO_UNUSED int sqsh_directory_iterator_lookup(struct SqshDirectoryIterator *iterator, const char *name, const size_t name_len)
Looks up an entry by name.
int sqsh_directory_iterator_free(struct SqshDirectoryIterator *iterator)
Frees the resources used by a directory iterator.
uint16_t sqsh_directory_iterator_name_size(const struct SqshDirectoryIterator *iterator)
Retrieves the size of the name of the current entry.
enum SqshFileType sqsh_directory_iterator_file_type(const struct SqshDirectoryIterator *iterator)
Retrieves the inode type of the current entry.
SQSH_NO_UNUSED char * sqsh_directory_iterator_name_dup(const struct SqshDirectoryIterator *iterator)
creates a heap allocated copy of the name of the current entry.
SQSH_NO_UNUSED struct SqshFile * sqsh_directory_iterator_open_file(const struct SqshDirectoryIterator *iterator, int *err)
Loads the inode of the current entry.
uint64_t sqsh_directory_iterator_inode_number(const struct SqshDirectoryIterator *iterator)
Retrieves the inode number of the current entry.
const char * sqsh_directory_iterator_name(const struct SqshDirectoryIterator *iterator)
Retrieves the name of the current entry.
SQSH_NO_UNUSED bool sqsh_directory_iterator_next(struct SqshDirectoryIterator *iterator, int *err)
Advances the iterator to the next entry.
const char * sqsh_directory_iterator_name2(const struct SqshDirectoryIterator *iterator, size_t *len)
Retrieves the name of the current entry.
The Inode context.