[comp.os.minix] Minix NFS-type thing

gdtltr@brahms.udel.edu (root@research.bdi.com (Systems Research Supervisor)) (03/14/91)

   I am currently starting work on an NFS-type facility for Minix based on
Amoeba RPC. I am still in the planning stages, so I would appreciate
hearing from anyone who has done any similar work. The plan is to insert
code into the client FS to check the destination device of system calls and
generate an RPC to a server process to handle remote requests. I want to
maintain compatability with old binaries and reasonable transparency. My
main concern is clearly defining the client/server interface in a way that
will support all the operations necessary to the Minix FS. Any pointers/
suggestions appreciated.

                                        Gary Duzan
                                        Time  Lord
                                    Third Regeneration



-- 
                            gdtltr@brahms.udel.edu
   _o_                      ----------------------                        _o_
 [|o o|]   Two CPU's are better than one; N CPU's would be real nice.   [|o o|]
  |_o_|           Disclaimer: I AM Brain Dead Innovations, Inc.          |_o_|

waltje@uwalt.nl.mugnet.org (Fred 'The Rebel' van Kempen) (03/21/91)

gdtltr@brahms.udel.edu (root@research.bdi.com (Systems Research Supervisor) wrote:
> 
>    I am currently starting work on an NFS-type facility for Minix based on
> Amoeba RPC. I am still in the planning stages, so I would appreciate
> hearing from anyone who has done any similar work. The plan is to insert
> code into the client FS to check the destination device of system calls and
> generate an RPC to a server process to handle remote requests. I want to
> maintain compatability with old binaries and reasonable transparency. My
> main concern is clearly defining the client/server interface in a way that
> will support all the operations necessary to the Minix FS. Any pointers/
> suggestions appreciated.
I did this, and, in fact, I am using it right now...
(the /pub dir on "minixug" is a remote FS on "uwalt" :-)

You have to add a series of /dev/nfs? devices, together with a major
device trap in fs/table.c .  This ensures you can do a mount(1) of
the device.

I implemented this as follows:

1. Wrote the local server, which listens to a certain major device. It
   gets messages from FS only.  This server is initially idle, until it
   gets an open() request from FS (i.e. someone is mounting it onto some
   directory).  After the open(), an ioctl() should follow, which sets
   the operating mode,and, more important, Amoeba port of the server
   that has to be contacted for this device.
   So, one can have N /dev/nfs? entries, which all listen to separate
   remote servers... :-)

2. Wrote the 'rmount' command.  This does something like:

	# /etc/rmount uwalt:/ftp/pub /pub

   Rmount then extracts the remote system name ("uwalt") and directory
   or special file name ("/ftp/pub"), plus the local directory name.
   It then looks up the port number for this machine (my ANET project
   somewhat resembles the TCP/IP environment... it maps system names
   into a 4-byte "IP" number, and then adds two bytes for a private or
   well-known port).
   Then, it does:

	fd = open("/dev/nfs?", O_RDWR)

   repeatedly, to find a free device for the mount.  After it found
   one, it does:

	nfs.mode = NFS_RDWR;	/* file system mode */
	strncpy(nfs.port, myport, PORTSIZE);	/* set port of server */
	ioctl(fd, ANETNFS_OPEN, &nfs);		/* tell the server */
	(void) close(fd);

   The local server now contacts the remote server, after which we can
   do a simple:

	(void) mount("/dev/nfs?", mydirname);	/* mount the FS */

   Easy!

3. Wrote a "remote file server", which is _very_ simple to start with.
   I am still experimenting with the exchange of capabilities to ensure
   system securiry, but it works...

Caveats:

A. If the remote server dies, your FS will probably hang.  This is due
   to our simplistic FS, not Amoeba RPC.

B. You can choose to do the entire "local server" stuff in FS, if you
   wish.  Since Advanced MINIX can handle a variable number of servers
   and device drivers (a device driver is, in this case, a process that
   serves some major device, if it is present), I chose to implement it
   as a server for /dev/nfs[0-4].

C. With the standard MINIX system (i.e. Amoeba in kernel space), you
   cannot have the file server on the same machine as the client.  It
   causes a deadlock.
   I am finishing up the Amoeba RPC Transaction Server, which now runs
   as a system server (a la MM and FS) in user space.  This should be
   nice for Motorola-people, too, I guess...

Hope this helps,

	Fred.
--
MicroWalt Corporation, for MINIX Development	waltje@uwalt.nl.mugnet.org
Tel (+31) 252 230 205, Hoefbladhof  27, 2215 DV  VOORHOUT, The Netherlands