One of the things that makes the .tar filesystem easy to use is the mount helper program. For example, I snarf newsgroups and store them in compressed .tar archives. So, I might have directories on my machine like /news/comp/os/qnx. As I accumulate articles, I store them in batches, say every 1000 articles. Within that directory, I might have files like 003xxx.tar.gz and 004xxx.tar.gz which are two compressed .tar files containing articles 3000 through 3999 and 4000 through 4999.
Using the .tar filesystem resource manager, I'd have to specify the following command lines to mount these two files:
mount -T tarfs /news/comp/os/qnx/003xxx.tar.gz 003xxx.tar.dir mount -T tarfs /news/comp/os/qnx/004xxx.tar.gz 004xxx.tar.dir
That's not too bad for a handful of files, but it gets to be a real pain when you have hundreds of files.
The find fans will of course realize that it could be done easily using find:
find /news/comp/os/qnx -type f -name "*tar.gz" \ -exec "mount -T tarfs {} {3}.dir"
Which is ever-so-slightly different (the {3}.dir creates an absolute path rather than a relative path, but that's okay).
However, for casual use, it would be really nice to just say:
mount_tarfs -m *.tar.gz
to mount all of the compressed archives in the current directory.
This is the job of the mount helper program. The mount helper is actually used in two modes. In one mode (as seen above) it's invoked standalone. In the second mode, it's invoked automatically by QNX Neutrino's mount command:
mount -T tarfs source.tar[.gz] [dirname]
The code for the mount_tarfs is remarkably simple: main() does the usual call to the option-processing function, and then we determine if we are mounting a single file or multiple files. We optionally generate the target's extension if required, and call the library function mount().