The World Is a libferris Filesystem
Listing 11. Output of One Virtual Console
$ fcreate --create-type=db4 --rdn=raw.db . $ fls --monitor-all -0 ./raw.db Created new1 Changed c:0x8321f88 /tmp/ljdb/raw.db Changed c:0x8321f88 /tmp/ljdb/raw.db Deleted new1 Created redirected-output Changed c:0x8321f88 /tmp/ljdb/raw.db
Listing 12. Output of Another Virtual Console
$ ftouch ./raw.db/new1 $ ferrisrm -v ./raw.db/new1 removing ./raw.db/new1 $ echo "hello" | \ ferris-redirect -T ./raw.db/redirected-output $ fcat ./raw.db/redirected-output hello
Many operations performed with libferris are also stored for possible future use. This includes the types of files you recently created (png, jpeg, db, tuple and so on), which files you recently edited and viewed and more. All of this is kept only for your personal use and never sent anywhere. Storage of metadata on files you view and edit is called remembrance in libferris. Only view and edit actions invoked through libferris are currently remembered. Listing 13 shows how I set up Xine to be executed as the default view operation on Annodex media files.
Listing 13. Setting Up Xine to Play Annodex Files
$ cat xine.desktop [Desktop Entry] Name=xine Comment=Video Player Exec=xine MimeType=video/mpeg;... Icon=~/icons/xine.png Terminal=0 Type=Application $ ferris-import-desktop-file xine.desktop $ ferris-set-file-action-for-type -v -a xine \ /tmp/Wombats.anx # Lets view the video. $ alias fv="ferris-file-action -v" $ fv /tmp/Wombats.anx
Now we can explore what libferris knows about our past operations. By default, remembered operations are grouped by operation type then media type. The recommended EA for the final directories in the tree are the filename and the time it was last viewed or edited. This history virtual filesystem shown in Listing 14 shows only a set amount of the most recent operations so as not to become too large.
Listing 14. Showing Recent View Operations
$ fls remembrance:// history $ fls remembrance://history edit view $ fls remembrance://history/view video $ fls -0h remembrance://history/view/video /tmp/Wombats.anx 05 Dec 6 21:34
For each file, you also can bring up the complete list of view and edit times. This uses what libferris calls a branch filesystem. A branch filesystem best can be described as an entire personal filesystem attached to a file. Branch filesystems are accessed using the branches:// handler; all other URL handlers appear as direct children of branches://.
In Listing 15, I take a look at what branches are available for my media file and explore the remembrance view filesystem. Then, out of curiosity, I take a look into the extents branch and see that the kernel's XFS filesystem has placed the whole media file in a single contiguous extent on disk.
To see if a file has a valid digital signature, you simply can read the has-valid-signature EA on the file. The signatures branch filesystem allows much more detail to be exposed about the signature. The branchfs-attributes filesystem exposes all EAs for a file as a filesystem. Sometimes it is more convenient to access an EA as though it is a file.
Listing 15. Branch Filesystems: a Filesystem about a File
$ fls branches://file/tmp/Wombats.anx branchfs-attributes branchfs-medallions branchfs-remembrance branchfs-extents branchfs-parents branchfs-signatures $ fls -0 branches://file/tmp/\ Wombats.anx/branchfs-remembrance/view 10.7M -rw-rw---- 05 Dec 6 21:34 ... 05 Dec 6 21:35 10.7M -rw-rw---- 05 Dec 6 21:34 ... 05 Dec 6 21:39 ... $ fls --xml \ branches://file/tmp/Wombats.anx/branchfs-extents <ferrisls> <ferrisls url="branches://.../branchfs-extents" name="branchfs-extents" > <context name="0" start-block="14245376" end-block="14267375" start-address="0" end-address="21999" /> </ferrisls> </ferrisls>
In the future, libferris will continue to support mounting more things and obtaining more metadata where it can. A module for FUSE is planned to supplement the current Samba support.
Resources for this article: /article/8947.
Ben Martin has been working on filesystems for more than ten years. He is currently working toward a PhD combining Semantic Filesystems with Formal Concept Analysis to improve human-filesystem interaction.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- Vagrant Simplified
- System Status as SMS Text Messages
- Dealing with Boundary Issues
- SUSE – “Will not diverge from its Open Source roots!”
- Libreboot on an X60, Part I: the Setup
- Bluetooth Hacks
- New Products
- October 2015 Issue of Linux Journal: Raspberry Pi
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Linux and the Internet of Things