[Flac-dev] flac in the filesystem?

Matt Zimmerman
Fri, 10 Sep 2004 16:45:30 -0000

On Tue, Oct 30, 2001 at 11:39:11PM -0800, Joshua Haberman wrote:

> So I was wondering if flac could be incorporated into the filesystem
> driver so that any file ending in .wav would be transparently encoded
> into flac. I don't know if this could be done at the vfs level so that
> it could be done to all filesystems simultaneously, or if individual
> filesystems would need to be modified.

If you really want this, the right place to implement it is in
userspace, not in the kernel.  Take a look at libbz2 and zlib for
examples of how this can be done.  You could write a FLACopen routine
like gzopen, which would transparently encode/decode from/to WAV format.
This would probably go in the FLAC library, and make it trivial to add
FLAC support to many WAV-supporting programs (those which don't use
mmap).

If you wanted transparency, you would write a shared library which would
override open(), and perhaps read(), etc. and do its magic there.
fakeroot, esddsp, and dmalloc are examples of how this is done.
However, in this case, you'd want to name all of your FLAC files with a
.wav extension so that the programs in question would open them.  The
right thing to do is to add FLAC support to these programs, and the
above technique might make that easier.

--
 - mdz