TrolledFS: A filesystem with fake file contents
My friend [gm] had this idea for a filesystem. It would take a real filesystem, and then whenever a user requested to open a file, it would instead give them a contents of another file from another folder, determined by it’s file extension. For example, it would map all AVI files to a single AVI file in another folder.
Because he didn’t implement it, and I got bored, I ended up writing “TrolledFS” as a FUSE filesystem module in Python.
The module requests two options, root, which is the directory that provides the structure of the filesystem (ie: it will appear to be a copy of this folder), and fakes, a folder containing replacement files. So if you requested example.avi, it would map it to the first file with the AVI extension in the fakes folder.
It is based on the Xmp.py (example) filesystem module from FUSE’s Python bindings, with all of the write calls filtered out. Instead, filesystem will say it is a read-only filesystem. If a file has no match in the fakes folder, the filesystem will say there was an I/O error.