A directory iterator.
More...
#include <sqsh_directory_private.h>
A directory iterator.
Definition at line 53 of file sqsh_directory_private.h.
◆ sqsh_directory_iterator_file_type()
Retrieves the inode type of the current entry.
- Parameters
-
[in] | iterator | The iterator to use. |
- Returns
- The inode type on success, SQSH_INODE_TYPE_UNKNOWN on error.
◆ sqsh_directory_iterator_free()
Frees the resources used by a directory iterator.
- Parameters
-
[in] | iterator | The iterator to free. |
- Returns
- The file name of the current directory entry, NULL if the allocation fails. The user is responsible for freeing the memory.
◆ sqsh_directory_iterator_inode()
Retrieves the inode number of the current entry.
- Parameters
-
[in] | iterator | The iterator to use. |
- Returns
- The inode number.
◆ sqsh_directory_iterator_inode_number()
◆ sqsh_directory_iterator_inode_ref()
Retrieves the inode reference of the current entry.
- Parameters
-
[in] | iterator | The iterator to use. |
- Returns
- The inode reference.
◆ sqsh_directory_iterator_lookup()
Looks up an entry by name.
- Parameters
-
[in,out] | iterator | The iterator to use. |
[in] | name | The name of the entry to look up. |
[in] | name_len | The length of the name. |
- Returns
- 0 on success, a negative value on error.
◆ sqsh_directory_iterator_name()
◆ sqsh_directory_iterator_name2()
const char * sqsh_directory_iterator_name2 |
( |
const struct SqshDirectoryIterator * | iterator, |
|
|
size_t * | len ) |
Retrieves the name of the current entry.
The returned pointer is allocated internally and only valid until the next call of sqsh_directory_iterator_next(). It must not be freed. The returned string is not 0 terminated.
- Parameters
-
[in] | iterator | The iterator to use. |
[out] | len | Pointer to a size_t where the length of the name will be stored. |
- Returns
- The name of the current entry.
◆ sqsh_directory_iterator_name_dup()
creates a heap allocated copy of the name of the current entry.
The caller is responsible for calling free() on the returned pointer.
The returned string is 0 terminated.
- Parameters
-
[in] | iterator | The iterator to use. |
- Returns
- The name of the current entry.
◆ sqsh_directory_iterator_name_size()
Retrieves the size of the name of the current entry.
- Deprecated
- Since 1.3.0. Use sqsh_directory_iterator_name2() instead.
- Parameters
-
[in] | iterator | The iterator to use. |
- Returns
- The size of the name on success, a negative value on error.
◆ sqsh_directory_iterator_new()
Allocates and initializes a new directory iterator.
- Parameters
-
[in] | file | file context of a directory to iterate over. |
[out] | err | Pointer to an int where the error code will be stored. |
- Returns
- The new iterator on success, NULL on error.
◆ sqsh_directory_iterator_next()
Advances the iterator to the next entry.
- Parameters
-
[in,out] | iterator | The iterator to advance. |
[out] | err | Pointer to an int where the error code will be stored. |
- Return values
-
true | When the iterator has been advanced |
false | When the iterator has reached the end of the directory or if an error occured. |
◆ sqsh_directory_iterator_open_file()
Loads the inode of the current entry.
- Parameters
-
[in] | iterator | The iterator to use. |
[out] | err | Pointer to an int where the error code will be stored. |
- Returns
- The loaded inode on success, NULL on error.
The documentation for this struct was generated from the following files: