getfh() systemcall

Jonathan I. Kamens jik at athena.mit.edu
Tue Jul 17 12:08:23 AEST 1990


In article <1990Jul16.161053.4685 at duc220.uni-duisburg.de>,
hz247bi at duc220.uni-duisburg.de (Bieniek) writes:
|> could someone be so nice and explain me the usage of the getfh
|> systemcall which is available on machines running NFS-Kernels ?
|> I know, it's a "read the funny source" Question, but I do not have
|> access to BSD Kernel or Sun NFS sources.

  File access information between NFS servers and NFS clients is
communicated with entities called "file handles"; When an NFS client
kernel wants to access a file on an NFS server, it asks for the file
handle for that file (doing a path look-up based on the file-handle of
the NFS mount-point and the path from that mount-point to the file in
question, I believe), and uses that file handle in subsequent
communication with the NFS server.

  OK, so this doesn't explain to you what getfh() is for, since file
handle usage would seem to be confined to the client and server kernels,
not to user processes that need to make system calls.  Well, when you go
to mount an NFS filesystem, you have to have some way of telling the
client kernel what the filesystem you want to mount is.  The mount
program makes a request to rpc.mountd on the server machine, specifying
the name of the directory the client wants to mount.  Rpc.mountd opens
the file, and then does a getfd() on the file descriptor thus obtained;
the kernel returns a file handle for the directory in question. 
Rpc.mountd then sends this back over the wire to the NFS client, which
passes it to the client kernel in order to complete the mount.

  Therefore, the simple answer to your question is, "Rpc.mountd uses
getfh() to get an initial file handle to give to clients who request NFS
mounts."

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710



More information about the Comp.unix.wizards mailing list