libsqsh v1.5.1
Loading...
Searching...
No Matches
sqsh_easy.h File Reference
#include "sqsh_common.h"
#include <fcntl.h>
#include <stdio.h>
#include <time.h>
Include dependency graph for sqsh_easy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool sqsh_easy_file_exists (struct SqshArchive *archive, const char *path, int *err)
 checks if a file exists.
 
uint8_t * sqsh_easy_file_content (struct SqshArchive *archive, const char *path, int *err)
 retrieves the content of a file.
 
uint64_t sqsh_easy_file_size2 (struct SqshArchive *archive, const char *path, int *err)
 retrieves the size of a file.
 
size_t sqsh_easy_file_size (struct SqshArchive *archive, const char *path, int *err)
 retrieves the size of a file.
 
mode_t sqsh_easy_file_permission (struct SqshArchive *archive, const char *path, int *err)
 retrieves unix permissions of a file.
 
uint32_t sqsh_easy_file_mtime2 (struct SqshArchive *archive, const char *path, int *err)
 retrieves the modification time of a file.
 
time_t sqsh_easy_file_mtime (struct SqshArchive *archive, const char *path, int *err)
 retrieves the modification time of a file.
 
char ** sqsh_easy_directory_list (struct SqshArchive *archive, const char *path, int *err)
 retrieves the contents of a directory as a list of file names
 
char ** sqsh_easy_directory_list_path (struct SqshArchive *archive, const char *path, int *err)
 retrieves the contents of a directory as a list of file paths
 
char ** sqsh_easy_tree_traversal (struct SqshArchive *archive, const char *path, int *err)
 
char ** sqsh_easy_xattr_keys (struct SqshArchive *archive, const char *path, int *err)
 retrieves all xattr keys of a file or directory.
 
char * sqsh_easy_xattr_get (struct SqshArchive *archive, const char *path, const char *key, int *err)
 retrieves the value of a xattr key of a file or directory.
 

Detailed Description

Author
Enno Boland (mail@.nosp@m.ebol.nosp@m.and.d.nosp@m.e)

Definition in file sqsh_easy.h.

Function Documentation

◆ sqsh_easy_directory_list()

char ** sqsh_easy_directory_list ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves the contents of a directory as a list of file names

The returned list needs to be released with free().

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
A list of files and directories on success, NULL on error.

◆ sqsh_easy_directory_list_path()

char ** sqsh_easy_directory_list_path ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves the contents of a directory as a list of file paths

The returned list needs to be released with free().

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
A list of files and directories on success, NULL on error.

◆ sqsh_easy_file_content()

uint8_t * sqsh_easy_file_content ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves the content of a file.

The content is not null terminated. The size of the content can be retrieved with sqsh_file_size. The returned pointer needs to be released with free().

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
The content of the file on success, NULL on error.

◆ sqsh_easy_file_exists()

bool sqsh_easy_file_exists ( struct SqshArchive * archive,
const char * path,
int * err )

checks if a file exists.

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
true if the file exists, false otherwise.

◆ sqsh_easy_file_mtime()

time_t sqsh_easy_file_mtime ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves the modification time of a file.

Deprecated
Since 1.5.0. Use sqsh_easy_file_mtime2() instead.
Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
The modification time of the file on success, 0 on error.

◆ sqsh_easy_file_mtime2()

uint32_t sqsh_easy_file_mtime2 ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves the modification time of a file.

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
The modification time of the file on success, 0 on error.

◆ sqsh_easy_file_permission()

mode_t sqsh_easy_file_permission ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves unix permissions of a file.

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
The unix permissions of the file on success, 0 on error.

◆ sqsh_easy_file_size()

size_t sqsh_easy_file_size ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves the size of a file.

Deprecated
Since 1.5.0. Use sqsh_easy_file_size2() instead.
Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
The size of the file on success, 0 on error.

◆ sqsh_easy_file_size2()

uint64_t sqsh_easy_file_size2 ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves the size of a file.

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
The size of the file on success, 0 on error.

◆ sqsh_easy_tree_traversal()

char ** sqsh_easy_tree_traversal ( struct SqshArchive * archive,
const char * path,
int * err )

◆ sqsh_easy_xattr_get()

char * sqsh_easy_xattr_get ( struct SqshArchive * archive,
const char * path,
const char * key,
int * err )

retrieves the value of a xattr key of a file or directory.

The returned pointer needs to be released with free().

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[in]keyThe xattr key.
[out]errPointer to an int where the error code will be stored.
Returns
The value of the given xattr key on success, NULL on error.

◆ sqsh_easy_xattr_keys()

char ** sqsh_easy_xattr_keys ( struct SqshArchive * archive,
const char * path,
int * err )

retrieves all xattr keys of a file or directory.

The returned list needs to be released with free().

Parameters
[in]archiveThe sqsh archive context.
[in]pathThe path the file or directory.
[out]errPointer to an int where the error code will be stored.
Returns
A list of xattr keys on success, NULL on error.