*BSD News Article 12757


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!network.ucsd.edu!usc!howland.reston.ans.net!spool.mu.edu!torn!nott!uotcsi2!revcan!quantum!danh
From: danh@quantum.qnx.com (Dan Hildebrand)
Subject: Re: A challenge to all true kernel hackers - conditional symlinks.
Message-ID: <gpntc0k@quantum.qnx.com>
Date: Mon, 15 Mar 93 02:27:57 GMT
Organization: Quantum Software Systems, Ltd.
References: <JKH.93Mar9214944@whisker.lotus.ie> <C3pA4z.7CG@sugar.neosoft.com> <1norfhINNq5o@life.ai.mit.edu>
Lines: 77

In article <1norfhINNq5o@life.ai.mit.edu> mycroft@hal.gnu.ai.mit.edu (Charles Hannum) writes:
>
>In article <C3pA4z.7CG@sugar.neosoft.com> peter@NeoSoft.com (Peter da
>Silva) writes:
>>
>> On intel's OpenNET system, namei does a preparatory lookup on the
>> file name in a couple of tables, one per UID and one global (only
>> root can diddle with the global one). So you can do:
>>
>>	rdr @tmp /usr1/tmp
>>
>> Then when any process owned by you accessed "@tmp" it got "/usr/tmp".
>
>Sounds like Plan 9, eh?

Sounds like QNX too, eh ?  ( Takes a Canadian to put the right inflection 
on that :-).

QNX has the concept of a prefix table that maps portions of your namespace 
to the individial processes that implement that resource ( the Dev process 
maps /dev, the Fsys process maps /, etc ). There are no "wired in" 
resources, since the file system itself is optional. The GNU Hurd is said 
to be working towards a similar facility, as well.

With this mechanism, you can make virtually any resource in the system 
visible in the pathnme space. The whole system works on what could be 
called "domains of authority", where a process that chooses to can send a 
message to the process manager indicating what they want to control. At 
startup there isn't even a '/' until you start a local fsys process or put 
a prefix in place to direct your local '/' to Fsys on some other node. The 
dev process takes /dev, etc. There are then some rules that govern how 
messages are directed based on longest match. For example, an open of '/' 
or '/dev/hd0' would go to fsys, but just '/dev' would go to the dev task. 
As shipped, QNX makes the conventional things visible, but its only a 
matter of a couple hours work, using the standard library, to write a 
process that will adopt some portion of the namespace, and get all the 
I/O messages for it ( open, close, read, write, seek, etc ). Once you start 
your process, the extension to the namespace you've implemented appears 
under the root where you programmed it to be ( you could accept a command 
line option to make this configurable ). It becomes indistinguishable from 
anything else in the pathname space.

For example, you could code up a resource manager to adopt /proc, and then 
do whatever you want with the I/O messages that end up going to /proc as 
the system runs. You could issue a kill on an unlink(), read the memory of 
the process on a read(), provide the process names when the /proc directory 
is read, etc. Its entirely up to your imagination, and the system doesn't 
get in the way of letting you implement anything you want. This is network 
transparent, and any process anywhere on the network can use the services 
added. The resource manager added can be started and stopped from the 
command line like any user process. On remote execution, processes inherit 
the local prefix tree as part of the inherited environment any child 
process would get, so that both local and network remote processes have the 
same view of network resources.

DFS ( the DOS file system manager ) works by adoptiong /dos and /dos/a, 
/dos/b, etc. for the DOS drives and partitions that exist. The DFS process 
then uses the raw block I/O services of Fsys to map the requests sent to 
DFS into the equivalent operations on the raw DOS partition ( probably 
/dev/hd0t4 as hard drive zero, partition type 4 ). As a result, the DOS 
partition looks exactly like any other piece of the file system, with 
certain limitations, like 8.3 filenames, etc. This way, you can write a 
process that takes whatever resource in the system you want, and present it 
to the user as some entity in the filename space. At this point the shell, 
or standard utilities, etc. will work on this namespace without caring what 
it really is. Alternative file systems for CD or WORM drives, or file 
systems tuned for particular applications, like voice record / playback, 
are easy to add to the system.

Throughout all of this, the POSIX semantics are preserved and everything 
works as POSIX specifies that it should.

-- 
Dan Hildebrand                     email: danh@qnx.com
Quantum Software Systems, Ltd.     QUICS: danh  (613) 591-0934 (data)
(613) 591-0931 x204 (voice)        mail:  175 Terrence Matthews          
(613) 591-3579      (fax)                 Kanata, Ontario, Canada K2M 1W8