libsqsh v1.5.2
Loading...
Searching...
No Matches
SqshPathResolver Struct Reference

Resolves paths. More...

#include <sqsh_tree_private.h>

Public Member Functions

struct SqshPathResolversqsh_path_resolver_new (struct SqshArchive *archive, int *err)
 Creates a new SqshPathResolver object at the root inode.
 
SQSH_NO_UNUSED int sqsh_path_resolver_up (struct SqshPathResolver *walker)
 Moves the walker one level up.
 
SQSH_NO_UNUSED bool sqsh_path_resolver_next (struct SqshPathResolver *walker, int *err)
 Moves the walker to the next entry int the current directory.
 
enum SqshFileType sqsh_path_resolver_type (const struct SqshPathResolver *walker)
 Returns the inode type of the current entry.
 
const char * sqsh_path_resolver_name (const struct SqshPathResolver *walker)
 Returns the name of the current entry. This entry is not zero terminated.
 
uint16_t sqsh_path_resolver_name_size (const struct SqshPathResolver *walker)
 Returns the size of the name of the current entry.
 
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_revert (struct SqshPathResolver *walker)
 reverts the walker to the begining of the current directory.
 
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 SqshFilesqsh_path_resolver_open_file (const struct SqshPathResolver *walker, int *err)
 Returns the inode of the current entry.
 
uint32_t sqsh_path_resolver_dir_inode (const struct SqshPathResolver *walker)
 Returns the inode of the current working directory.
 
uint64_t sqsh_path_resolver_inode_ref (const struct SqshPathResolver *walker)
 Returns the inode reference 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.
 
int sqsh_path_resolver_free (struct SqshPathResolver *reader)
 Cleans up resources used by a SqshPathResolver struct.
 

Detailed Description

Resolves paths.

Definition at line 55 of file sqsh_tree_private.h.

Member Function Documentation

◆ sqsh_path_resolver_dir_inode()

uint32_t sqsh_path_resolver_dir_inode ( const struct SqshPathResolver * walker)

Returns the inode of the current working directory.

Parameters
[in]walkerThe walker to use
Returns
the inode of the current entry.

◆ sqsh_path_resolver_down()

SQSH_NO_UNUSED int sqsh_path_resolver_down ( struct SqshPathResolver * walker)

Lets the walker enter the current entry.

Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

◆ sqsh_path_resolver_free()

int sqsh_path_resolver_free ( struct SqshPathResolver * reader)

Cleans up resources used by a SqshPathResolver struct.

Parameters
[in,out]readerThe file reader struct to clean up.
Returns
0 on success, less than 0 on error.

◆ sqsh_path_resolver_inode_ref()

uint64_t sqsh_path_resolver_inode_ref ( const struct SqshPathResolver * walker)

Returns the inode reference of the current entry.

Parameters
[in]walkerThe walker to use
Returns
the inode reference of the current item the resolver is pointing to.

◆ sqsh_path_resolver_lookup()

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.

Parameters
[in,out]walkerThe walker to use
[in]nameThe name of the entry to look up.
[in]name_sizeThe size of the name.
Returns
0 on success, less than 0 on error.

◆ sqsh_path_resolver_name()

const char * sqsh_path_resolver_name ( const struct SqshPathResolver * walker)

Returns the name of the current entry. This entry is not zero terminated.

Parameters
[in]walkerThe walker to use
Returns
the name of the current entry.

◆ sqsh_path_resolver_name_dup()

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.

The caller is responsible for calling free() on the returned pointer.

The returned string is 0 terminated.

Parameters
[in]walkerThe walker to use
Returns
the name of the current entry.

◆ sqsh_path_resolver_name_size()

uint16_t sqsh_path_resolver_name_size ( const struct SqshPathResolver * walker)

Returns the size of the name of the current entry.

Parameters
[in]walkerThe walker to use
Returns
the size of the name of the current entry.

◆ sqsh_path_resolver_new()

struct SqshPathResolver * sqsh_path_resolver_new ( struct SqshArchive * archive,
int * err )

Creates a new SqshPathResolver object at the root inode.

Parameters
[in]archiveThe archive to use
[out]errPointer to an int where the error code will be stored.
Returns
a new file reader.

◆ sqsh_path_resolver_next()

SQSH_NO_UNUSED bool sqsh_path_resolver_next ( struct SqshPathResolver * walker,
int * err )

Moves the walker to the next entry int the current directory.

Parameters
[in,out]walkerThe walker to use
[out]errPointer to an int where the error code will be stored.
Return values
trueif the walker was moved to the next entry.
falseif the walker has no more entries to move to or an error occured.

◆ sqsh_path_resolver_open_file()

SQSH_NO_UNUSED struct SqshFile * sqsh_path_resolver_open_file ( const struct SqshPathResolver * walker,
int * err )

Returns the inode of the current entry.

Parameters
[in,out]walkerThe walker to use
[out]errPointer to an int where the error code will be
Returns
the inode of the current entry.

◆ sqsh_path_resolver_resolve()

SQSH_NO_UNUSED int sqsh_path_resolver_resolve ( struct SqshPathResolver * walker,
const char * path,
bool follow_symlinks )

Resolve a path with the tree walker.

This function will resolve the given path with the tree walker. The base is the current directory.

Parameters
[in,out]walkerThe walker to use
[in]pathThe path to resolve.
[in]follow_symlinksWhether to follow symlinks.
Returns
the inode of the current entry.

◆ sqsh_path_resolver_revert()

SQSH_NO_UNUSED int sqsh_path_resolver_revert ( struct SqshPathResolver * walker)

reverts the walker to the begining of the current directory.

Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

◆ sqsh_path_resolver_to_root()

SQSH_NO_UNUSED int sqsh_path_resolver_to_root ( struct SqshPathResolver * walker)

Moves the walker to the root directory.

Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

◆ sqsh_path_resolver_type()

enum SqshFileType sqsh_path_resolver_type ( const struct SqshPathResolver * walker)

Returns the inode type of the current entry.

Parameters
[in]walkerThe walker to use
Returns
the inode type of the current entry.

◆ sqsh_path_resolver_up()

SQSH_NO_UNUSED int sqsh_path_resolver_up ( struct SqshPathResolver * walker)

Moves the walker one level up.

Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

The documentation for this struct was generated from the following files: