First: I don't "distribute" this code; if you download it I consider
       the active act to be on your part. That said, the software is
       completely free and you may do with it what you wish, although
       I appreciate a reference to me in your source code, and if for
       some unknown reason somebody actually does something useful with
       this, I'd love to hear about it.


So...       

Recent discussion on the "lpc-language" mailing list prompted me into
an act of sheer perversion; the implementation of a NFS server in LPC.

I've worked a total of perhaps 30 hours on this code, which includes
getting familiar with XDR, RPC and NFS, as well as implementation and
debugging. This should convince even the most dullwitted of doubters
that LPC is an extremely versatile language.

A brief overview of the code gives us:

/README				This file

/config				DGD configuration file

/doc
  rfc1014.txt			The XDR specification
  rfc1057.txt			The RPC version 2 specification
  rfc1094.txt			The NFS version 2 specification
  rfc1813.txt			The NFS version 3 specification

/sys
  driver.c			DGD driver object (minimal)
  rpcd.c			RPC daemon -- binds a port for UDPs.
  mountd.c			MOUNT daemon
  nfsd.c			NFS daemon

/include
  std.h				DGD include file
  xdr.h				XDR definitions
  rpc.h				RPC definitions
  nfs.h				NFS definitions
  file.h			File types

/lib
  auto.c			DGD auto object
  file.c			Elementary file handling
  xdr.c				XDR data handling library



The key files are /sys/rpcd.c, /sys/mountd.c and /sys/nfsd.c

The MOUNT daemon translates incoming mount requests, with full pathnames,
to file handles, which are pathname abstractions used by the NFS daemon.

After successfully mounting and receiving a file handle in response
(which is just a unique integer in our case), the NFS client can issue
NFS requests using that file handle. Consult the RFC's for more detailed
information.

There are a number of weaknesses in the implementation, mostly due to
the limited nature of a Mud's filesystem. A Mud should not contain
links or symlinks, and there are rarely useful ways of translating
internal file-access data to the Unix "drwxrwxr-x" format. File system
information is equally uninteresting.

For these cases, my implementation returns basically constant values.

Another limitation is in file truncation; I only handle the case of
truncating a file to size zero.

I have successfully run GNU autoconf and a subsequent compilation of
a large program in a directory mounted through LPC-NFS. Gnu's configure
script does quite a bit of nasty stuff, and I should think that serves
as a decent test. However, there are no guarantees whatsoever that there
may not be horrible bugs lurking in the code.


A recent DGD version (ftp://ftp.lysator.liu.se/pub/lpmud/drivers/dgd)
with the networking package (in ./pkg relative to above URL) should run
this as it stands.

Under Linux (which has been my only test suite), a command like

	mount -t nfs -o port=2049,mountport=2049 localhost:/ /test

is what I have been using.


Drivers, finally -- the code requires two things that may not be
present in all drivers:

 * Mutable strings that can hold zeroes (ie true byte arrays).
 * Network capability for receiving and transmitting UDP packets.


That's that -- mail me if anything is unclear.

Zell -- zell@alyx.com -- March 1997.
