13main(
int argc,
char *argv[]) {
16 printf(
"Usage: %s <sqsh-file>\n", argv[0]);
24 .mapper_block_size = 0,
26 .metablock_lru_size = 0,
29 .max_symlink_depth = 0,
33 if (error_code != 0) {
37 const struct SqshSuperblock *superblock = sqsh_archive_superblock(archive);
41 if (error_code != 0) {
48 if (error_code != 0) {
49 sqsh_perror(error_code,
"sqsh_directory_iterator_new");
56 fwrite(name, size, 1, stdout);
60 sqsh_perror(error_code,
"sqsh_directory_iterator_next");
66 sqsh_archive_close(archive);
int main(int argc, char *argv[])
void sqsh_perror(int error_code, const char *msg)
Print the error message for the given error code.
const struct SqshMemoryMapperImpl *const sqsh_mapper_impl_mmap
a mapper that uses mmap to map the file into memory.
SQSH_NO_UNUSED struct SqshArchive * sqsh_archive_open(const void *source, const struct SqshConfig *config, int *err)
initializes a archive context in heap.
The SqshConfig struct contains all the configuration options for a sqsh session.
const struct SqshMemoryMapperImpl * source_mapper
source_mapper is the memory mapper implementation that will be used to map the archive.
SQSH_NO_UNUSED struct SqshDirectoryIterator * sqsh_directory_iterator_new(const struct SqshFile *file, int *err)
Allocates and initializes a new directory iterator.
int sqsh_directory_iterator_free(struct SqshDirectoryIterator *iterator)
Frees the resources used by a directory iterator.
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.
SQSH_NO_UNUSED struct SqshFile * sqsh_open_by_ref(struct SqshArchive *archive, uint64_t inode_ref, int *err)
Initializes a file context in heap.
The superblock context is used to access the superblock of the archive.
uint64_t sqsh_superblock_inode_root_ref(const struct SqshSuperblock *context)
Retrieves the reference of the root inode in a superblock context.