whefs

Not logged in

ACHTUNG: THIS SITE HAS MOVED

As of 16 June 2009, the whefs project has moved to Google Code:

http://code.google.com/p/whefs

The content of this site will only be current until development resumes under the new site (first the wiki needs to be ported). After that, this copy will not be maintained.

whefs: WanderingHorse.net Embedded Filesystem

whefs is a free C library implementing an embedded virtual filesystem. It works by creating a "filesystem" inside a so-called container file (or in memory). This API can then treat that container similarly to a filesystem. In essence this is similar to conventional archives (e.g. zip files), except that this library provides random-access read/write support to the filesystem via an API similar to the conventional fopen(), fread(), fwrite() and friends.

Author: Stephan Beal (http://wanderinghorse.net/home/stephan/)

License: Public Domain.

(A summary of the more useful links on this site can be found here.)

Features

Misfeatures

Significant TODOs

See whefs-TODOs for the list of more pressing TODOs.

Current status

"It works for me!"

Very Beta. It "seems to work", but the nature of the problem means there is lots of room for errors and bugs. Do not make the mistake of using it for data which you can't afford to lose.

That said, most of the basics are in place and working. There is plenty of cleaning up and refactoring to do, however.

The code has been shown to build, run, and pass basic sanity checks on:

The code compiles cleanly, even with gcc's pedantic mode enabled.

Most compilers explicitly require enabling C99 compatibility mode (in gcc this is the -std=c99 flag, on SunCC it's -xc99=all). Note that compilers which don't support C99 variable-sized arrays (e.g. tcc) will need to malloc() in some places where other compilers do not, so the overall memory costs may go up.

Reports of success/failure for other platforms are always appreciated.

Requirements

The library is standalone C code conforming to the ISO C99 standard (don't even think about asking me to back-port to C89 - not gonna happen). The storage handler for on-disk VFSes (as opposed to in-memory VFSes) requires certain functions defined in the POSIX-1.2001 standard (e.g. ftruncate() and fileno()). Most or all Unix-like systems will have the few required POSIX routines. Windows... i don't know. Without those storage handlers it can only be used for in-memory filesystems.

No third-party libraries are needed except the system's standard C libraries.

The i/o layer has some optional support for compression using zlib, but zlib has become a core system-level component and is available preinstalled on any sane system. See the Makefile for how to enable it.

Download

See the downloads page.

Documentation

See the docs page.

News

See the news page.

Want to help?

whefs has some notable limitations and could be improved in some significant ways. Any feedback or assistance is always appreciated. You can reach me via http://wanderinghorse.net/home/stephan/. Anyone who shows an interest and submits a patch or two will gladly be given write access to the code repository.

Some areas of improvement which specifically come to mind (and in which i could definitely use a hand) are: