4 releases (2 breaking)
0.3.0 | Jul 26, 2024 |
---|---|
0.2.1 | Jul 26, 2024 |
0.2.0 | Jul 26, 2024 |
0.1.0 | Jul 25, 2024 |
#1254 in Filesystem
31 downloads per month
9KB
173 lines
squashfuse-rs
Implementation of FUSE for SquashFS in rust using the fuser and backhand crates!
Inspired by a C library called squashfuse https://github.com/vasi/squashfuse/tree/master
PRs are welcome, I don't claim to know a lot about SquashFS and FUSE, so if there is a better way of doing things, please let me know!
Example usage from appimage-type2-runtime-rs:
fn fusefs_main(offset: u64, mountpoint: &Path, archive_path: &Path) -> anyhow::Result<()> {
let reader = BufReader::new(File::open(&archive_path)?);
let fs = squashfuse_rs::SquashfsFilesystem::new(
backhand::FilesystemReader::from_reader_with_offset(reader, offset)?,
);
let mount_options = vec![
fuser::MountOption::FSName("squashfuse".to_string()),
fuser::MountOption::RO,
];
match fuser::mount2(fs, mountpoint, &mount_options) {
Ok(()) => {
println!("Mounted {:?} at {:?}", archive_path, mountpoint);
Ok(())
}
Err(err) => Err(anyhow::anyhow!("Failed to mount: {}", err)),
}
Dependencies
~8MB
~142K SLoC