Re: "everything is a file" and beyond

From: Andy Valencia From: <vandys_at_nospam.org>
Date: Wed Feb 25 2004 - 10:25:12 PST

>Thinking of all resources as files in interesting. If one can
>open/read/write/close a file, one has a good chance of being able to
>open/read/write/close any resource. Being able to address everything in a
>unified namespace is interesting, too. However, the general file IO commands
>don't provide a general way to deal with attributes associated with a
>resource.

Right, that's why there's stat/wstat commands in the message operations,
and the "stat" command for accessing this from the shell.

>... I just need
>to know the desired attribute names and values, e.g., attr_set("/dev/cua",
>"baud", "57600").

That'd be:

        stat //tty/tty01

to see its attributes, and:

        stat -w //tty/tty01 baud=57600

To set the baud rate.

>An alternative to having a direct attribute interface would be to attempt to
>express attributes as part of the path name, which can seem appealing, e.g.,
>/ip/www.somewhere.com/80/tcp for a TCP stream with particular host and port
>attributes (the server might use gethostbyname, create /ip/1.2.3.4 and make
>/ip/www.somwhere.com a symbolic link to it). This becomes less appealing
>when there are many attributes, though, e.g., /dev/cua/57600/8/N/1/hw/raw
>(which gets even worse when we add read timeout and write timeout).

I found it cumbersome (I implemented a bit of each approach before I decided
that the "stat" approach was preferred). Of course, the directory approach
is not prevented by VSTa, but all the standard servers use stat/wstat as
their primary interface to their attributes.

>"Everything is XML"

I did a startup where we did XML as the primitive. It turns out to be
pretty cumbersome. You find yourself with these huge and complex data
structures which are the parsed interpretation of the XML, and you have to
use tons of C code to walk through'em. I think that XML is about as easy
for a human to traverse visually as a filesystem, but filesystems pull ahead
when you then write C code to do the traversals and operations.

>"Everything is just a message client/server"

I did another major project (at Cisco) where the whole config system was
RPC. This was even more cumbersome than XML, because you didn't even have a
nice visual starting point for visualizing the conceptual state you want to
itneract with.

>Taking a step in the other direction, one could just make sure the script
>language has support for msg_connect, msg_send, etc., and that's all you
>need. This is an equally valid though much lower-level view. ("Everything is
>an atom" :-)

That'd be:

    mount //tty /dev/tty
    cd /dev/tty
    ls
     (you should see tty01)
    stat tty01
    stat -w tty01 baud=9600

Andy
Received on 25 Feb 2004 18:25:12 GMT

This archive was generated by hypermail 2.1.8 : Tue Sep 26 2006 - 09:03:11 PDT