<pedantic>

The filesystem is a tree-structured arrangement of
nodes, each of whose purpose is to provide access to
some system resource.  Interior nodes typically (safe
to say "always" since they corresond to directories)
represent and provide access to collections of other nodes.
Leaf nodes typically provide access to "file" data and to
"devices".  The definition of a device isn't as simple
as it used to be but generally correspond to identifiable
subdivisions/abstractions of the system hardware/software.

Just as the OS enforces no particular relationship between
the name/location of a simple text file and its contents,
the name/location of a device node has no relationship to
the corresponding device or its attributes.  If it happens
to be handy to follow the convention of placing device
nodes under the /dev directory node, and to give them
(ahem!) obvious names like /dev/hda3 and such, fine,
but it's definitely not sacred.

To demonstrate this, choose a node under the /dev directory
node like (say) /dev/null.  If we use "ls" to learn its
vital statistics:

   % ls -l /dev/null
   crw-rw-rw- 1 root root 1, 3 Apr 6 14:39 /dev/null

...we can see that it's been associated with some chunk
of the kernel that has "character" attributes (subject
of another discussion) and which the kernel knows only
via major number 1 and minor number 3.  In other words,
this node is the rendevous point where the OS offers
(access to) that device to the rest of the world, so when
we manipulate this node we're telling the OS "From your
table of device drivers select the entry corresponding to 1
(the major number).  Then please invoke the routines that
comprise that driver on my behalf and mention the number 3
(the minor number) to them, along with other parameters."
The driver may or may not be interested in the minor number
but it's supplied to it regardless.

Just for fun, we can create our very own device node that
activates the same kernel code and is in every possible
way the equivalent of /dev/null.  This is an admittedly
trivial (though thoroughly exhilarating!) exercise but
before you laugh please recall that any number of startups
during the dotcom era had business plans that were less
obviously worthwhile.

We'll call our device node "useless" and we'll create
it in the /tmp directory to connote its lasting value.
The utility program "mknod" can create the node for us:

   mknod /tmp/useless c 1 3

...and the result is a new device node under the /tmp
directory node with the same attributes as /dev/null:

   crw-rw-rw- 1 root root 1, 3 May 17 20:12 /tmp/useless

...and which can be substituted under any circumstances
for /dev/null because, ultimately, it's invoking the same
kernel code:

   cp /vmlinux          /tmp/useless
   flames              >/tmp/useless
   EnronRetirementFund >/tmp/useless

...etc.

</pedantic>


Well, thanks to those who tolerated my spew this far.
I don't presume to lecture to anybody, just to supply
some background of possible use, maybe to lurkers who
might be wondering about some of the concepts under
discussion.  I didn't mean to go on so long but, um
Sam Adams has a way of loosening my tongue^H^H^H^H^H^Hfingers...


*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************

Reply via email to