vince (vgeisler@engineer.com) wrote:
: That sounds really intriguing, how exactly do you mount a tar/gz file
: under QNX? Ive tried to make something like tat work for a while now…
In principle, it’s fairly easy. You create a “directory” resource
manager that takes over some pathname. Let’s say that your .tar file
(we won’t consider .gz for just now) lives in /home/spud/x.tar
Your resource manager might register itself as /home/spud/x.tar.dir
Then, the resource manager opens /home/spud/x.tar, and reads the table
of contents from the .tar file, and builds an internal representation of
it – so that it knows what files are present in the .tar file, their
sizes, permissions, and so on, and their offsets within the “real” .tar
file.
Once that’s done, you handle open/read requests. An open request checks
against the table of contents to see if the file “exists” in the .tar file,
and, if so, allows the request; if not, returns ESRCH (or EPERM, depending
on the access modes, permissions etc). Once you’ve allowed the open(),
then you handle the read() by returning bytes from the .tar file. The tricky
part is the directory (i.e., “ls /home/spud/x.tar.dir” should give you the
contents). This is done by creating a number of “struct dirent” entries
that you return from the read() (readdir() effectively calls read()).
Like I said, “easy” in principle.
I did something similar like this for QNX 4 for a virtual filesystem for
USENET news that’s 2 to 3 orders of magnitude more efficient than CNews.
Cheers,
-RK
: vince
: On Tue, 26 Dec 2000 14:01:01 +0000, phearbear <phearbear@spray.se>
: wrote:
: >Previously, vince wrote in qdn.public.qnxrtp.os:
: >> what is a tar/gz virtual filesystem? is it like a ramdisk?
: >>
: >> vince
: >>
: >> On Mon, 25 Dec 2000 21:42:46 +0000, phearbear <phearbear@spray.se>
: >> wrote:
: >>
: >> >Hi
: >> >I had a tar/gz “virtual filesystem” resource manager for nto a while ago, but i forgot to make backup of it when i re-installed RtP. Now i’m planning on making a resource manager and those programs (they were opensrc) would be really helpful, anyone know where i can find them?
: >> >
: >> >//Johan Bj rk
: >> >-phearbear
: >>
: >>
: >read-only filesystem, so you can mount a tar(.gz) file and use it as a read-only harddrive.