On Thu, 14 Jun 2001, Derek Martin wrote:
>> Maybe I phrased the question poorly.  I know I can't nfs mount a
>> remote /dev but if I created a /nfs/exportstuff directory and made
>> symlinks to the devices I wanted to share, and then machine B nfs
>> mounted /nfs/exportstuff on /dev/remdevs could machine B play a wav
>> on /dev/remdevs/audio ?
> 
> I'd say not.  A device file, even though it is treated much like a regular
> file in many respects, is very different.  It's sort of like a symbolic
> link to a kernel driver.

  In terms of how they are implemented in Linux: When you invoke a syscall
(like open(2), read(2), or write(2)) on a device node, the call is actually
mapped onto functions provided by the device driver for the major number of
the node.  There is a structure ("struct file_operations") which contains a
number of function pointers, each corresponding to the usual file I/O
operations.  The appropriate driver simply places pointers in a structure, and
registers that structure in the kernel.

  Thus, when you call write(2) on a file descriptor opened on the "/dev/null"
device, you are actually calling write_null() in <drivers/char/mem.c>.

  This is not supported over standard NFS.  I do not think it could be, as
many device drivers access memory directly (buffers and such), expecting to
hand those buffers back to userspace, and "the PC down the hall" is a bit
outside your computer's address space.  ;-)

> My best guess is that if you NFS mounted a device file, say, /dev/dsp,
> that if you wrote to that NFS-mounted device file, the sound would play on
> the local machine, just as if you'd sent it to the local filesystem's
> /dev/dsp.  It would do that because the major and minor number of the
> device file is the same as the local one, and that (as I understand it) is
> really all that the kernel cares about.

  I believe you are correct.  A quick glance at the NFS code shows that the
standard kernel open function is used for NFS inodes, and the standard open
function should do what it always does.  However, I haven't actually tried
this.  And, of course, if the other system did not use the exact same
major/minor numbers, serious havoc would likely follow.

-- 
Ben Scott <[EMAIL PROTECTED]>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to