문제

(SquashFS is a compressed filesystem - http://en.wikipedia.org/wiki/SquashFS)

I'm looking for a way to read a SquashFS filesystem from a program. So far, I've know about the in-kernel drivers for it, but I'm sure that a userspace library for it must exist somewhere. Any language would be fine, but C is preferred.

Just mounting the filesystem and using it that way is technically possible, but I'd rather avoid that route because the application I'm looking at would involve working with at least a few dozen archives at any given time.

도움이 되었습니까?

해결책

I just downloaded the code tarball from squashfs.sourceforce.net and there is no kernel code in there. Only userland code in C for mksquashfs and unsquashfs.

You could probably extract code from unsquashfs.

다른 팁

There is a tool called unsquashfs which extracts the squashfs image akin to tar. It should be bundled with mksquashfs

I've got some ruby code that'll do it: https://github.com/vasi/squash.rb

It's pretty rough, but it works fine. Maybe I'll turn it into a better-designed C library someday.

mksquashfs and unsquashfs are packaged as "squashfs-tools" on my Red Hat system:

Name        : squashfs-tools
Group       : System Environment/Base
Size        : 160923
URL         : http://squashfs.sf.net
Summary     : squashfs utilities
Description :

Squashfs is a highly compressed read-only filesystem for Linux. This package contains the utilities for manipulating squashfs filesystems.

/sbin/mksquashfs
/usr/sbin/unsquashfs
/usr/share/doc/squashfs-tools-3.0
/usr/share/doc/squashfs-tools-3.0/ACKNOWLEDGEMENTS
/usr/share/doc/squashfs-tools-3.0/CHANGES
/usr/share/doc/squashfs-tools-3.0/COPYING
/usr/share/doc/squashfs-tools-3.0/PERFORMANCE.README
/usr/share/doc/squashfs-tools-3.0/README

Be warned that squashing and unsquashing are painfully slow. It takes several minutes for a script I wrote to unsquash, modify, and re-squash an 87M stage2.img file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top