https://github.com/mgord9518/squashfuse-zig
Read and mount SquashFS archives
https://github.com/mgord9518/squashfuse-zig
fuse fuse-filesystem squashfs squashfs-image zig
Last synced: 3 months ago
JSON representation
Read and mount SquashFS archives
- Host: GitHub
- URL: https://github.com/mgord9518/squashfuse-zig
- Owner: mgord9518
- License: mit
- Created: 2022-12-20T06:59:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-20T06:33:28.000Z (over 1 year ago)
- Last Synced: 2025-04-13T10:06:27.923Z (about 1 year ago)
- Topics: fuse, fuse-filesystem, squashfs, squashfs-image, zig
- Language: Zig
- Homepage:
- Size: 788 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# squashfuse-zig
SquashFS implementation in Zig, modeled after squashfuse
Active/ complete goals:
- [ ] Library usage in line with Zig stdlib
- [ ] (Partial) Dir implementation
- [ ] Move Inode methods into Dir and File structs
- [ ] File struct
- [x] Performance; choose the fastest decompression libraries by default
(being done for the CLI tool by default via libdeflate)
- [x] (Partial) Compatibility with existing squashfuse tools
Future goals:
- [ ] Writing?
- [ ] Multithreading
Importing example:
[build.zig.zon](example/build.zig.zon)
```zig
.{
.name = "import_example",
.version = "0.0.0",
.minimum_zig_version = "0.13.0",
.dependencies = .{
.squashfuse = .{
//.url = "https://github.com/mgord9518/squashfuse-zig/archive/refs/tags/continuous.tar.gz",
//.hash = "1220e675672f86be446965d5b779a384c81c7648e385428ed5a8858842cfa38a4e22",
.path = "../",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
"README.md",
},
}
```
[build.zig](example/build.zig)
```zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const squashfuse_dep = b.dependency("squashfuse", .{
.target = target,
.optimize = optimize,
.zlib_decompressor = .libz_dynamic,
.zstd_decompressor = .libzstd_static,
});
const exe = b.addExecutable(.{
.name = "squashfs_inspector",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
// libc must be explicitly linked unless all compression libraries are
// using Zig implementations
exe.linkLibC();
exe.root_module.addImport(
"squashfuse",
squashfuse_dep.module("squashfuse"),
);
// If a C-ABI compression library is used and isn't linked at runtime,
// the libraries must be linked in the build script as well
exe.linkLibrary(squashfuse_dep.artifact("zstd"));
exe.linkSystemLibrary("z");
b.installArtifact(exe);
}
```