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");
64 traversal, &segment_size, i);
66 fwrite(segment, 1, segment_size, stdout);
71 sqsh_perror(error_code,
"sqsh_directory_iterator_next");
77 sqsh_archive_close(archive);
size_t sqsh_index_t
typedef used for indexing
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.
SqshTreeTraversalState
The state of the tree traversal.
@ SQSH_TREE_TRAVERSAL_STATE_DIRECTORY_END
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 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.
A walker over the contents of a file.
enum SqshTreeTraversalState sqsh_tree_traversal_state(const struct SqshTreeTraversal *traversal)
returns the state of the traversal.
SQSH_NO_UNUSED bool sqsh_tree_traversal_next(struct SqshTreeTraversal *traversal, int *err)
Moves the traversal to the next entry int the current directory.
int sqsh_tree_traversal_free(struct SqshTreeTraversal *traversal)
struct SqshTreeTraversal * sqsh_tree_traversal_new(const struct SqshFile *file, int *err)
Creates a new SqshTreeTraversal object rooted at the specified inode.
const char * sqsh_tree_traversal_path_segment(const struct SqshTreeTraversal *traversal, size_t *len, sqsh_index_t index)
Get a segment of the path of the current entry.
size_t sqsh_tree_traversal_depth(const struct SqshTreeTraversal *traversal)
Returns the path segment at a given index.
int main(int argc, char *argv[])