Crates.io | squashfuse-rs |
lib.rs | squashfuse-rs |
version | 0.3.0 |
source | src |
created_at | 2024-07-25 16:46:55.836262 |
updated_at | 2024-07-26 03:43:37.807748 |
description | FUSE implementation of Squashfs written in Rust. |
homepage | |
repository | https://github.com/linux-packaging-rs/squashfuse-rs |
max_upload_size | |
id | 1315264 |
size | 9,793 |
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)),
}