Caleb J. Gardner 5ec12b5786 Finished adding multi-threaded extraction.
Added option in unsquashfs to specify the number of threads used.
Changed some functions to accept an allocator instead of just using
Archive's
Fixed run_tests.sh due to new c libraries
2026-02-08 15:14:35 -06:00
2026-01-15 06:40:59 -06:00
2026-02-07 17:20:03 -06:00
2026-01-15 06:40:59 -06:00

zig-squashfs

This is my experiments to learn Zig. Might amount to something. Might not.

A library and application to decompress or view squashfs archives.

Current State

Overall works, but currently is completely single threaded and is missing some features. Extraction is slow. Only properly work on Linux, any other OSes probably won't work fully.

Build options

-Duse_c_libs

Instead of using Zig's standard library for decompression

-Dversion

Sets the version of unsquashfs shown when --version is passed.

Capabilities

Most features are present except for the following:

  • mod_time is not set on extraction
  • xattrs are not applied on extraction
  • Only zstd c library is implemented (all others result in error.TODO).
  • When using Zig decompression libraries then lzo and lz4 compression types are unavailable. I don't really plan on spending the time to find and validate a library since neither is popular.

Building considerations

Compilation without use_c_libs works completely fine, but Zig has issues with some symbols from the lzo library that needs to be manually fixed. In particular you need to fix the definitions for lzo_bytep and lzo_voidp to be *u8 and ?*anyopaque respectively.

pub const lzo_bytep = @compileError("unable to translate C expr: unexpected token ''");
// /usr/include/lzo/lzoconf.h:148:9
pub const lzo_charp = @compileError("unable to translate C expr: unexpected token ''");
// /usr/include/lzo/lzoconf.h:149:9
pub const lzo_voidp = @compileError("unable to translate C expr: unexpected token ''");

to

pub const lzo_bytep = *u8;
// /usr/include/lzo/lzoconf.h:148:9
pub const lzo_charp = @compileError("unable to translate C expr: unexpected token ''");
// /usr/include/lzo/lzoconf.h:149:9
pub const lzo_voidp = ?*anyopaque;
S
Description
A Zig library to access & extract squashfs archives. VERY EXPERIMENTAL.
Readme MIT 798 KiB
Languages
Zig 99.9%