\begindata{text, 268556792}
\textdsversion{11}
\define{italic
menu:[Font,Italic]
attr:[FontFace Italic Int Set]}
\define{bold
menu:[Font,Bold]
attr:[FontFace Bold Int Set]}
\define{chapter
menu:[Title,Chapter]
attr:[Justification Centered Point 0]
attr:[FontSize PreviousFontSize Point 4]}
\define{section
menu:[Title,Section]
attr:[Justification Centered Point 0]
attr:[FontSize PreviousFontSize Point 4]}
\define{subsection
menu:[Title,Subsection]
attr:[Justification LeftJustified Point 0]
attr:[FontSize PreviousFontSize Point 4]}
\define{paragraph
menu:[Title,Paragraph]
attr:[Justification LeftJustified Point 0]
attr:[FontSize PreviousFontSize Point 4]}
\define{bigger
menu:[Font,Bigger]
attr:[FontSize PreviousFontSize Point 2]}
\define{indent
menu:[Region,Indent]
attr:[LeftMargin LeftMargin Inch 32768]
attr:[RightMargin RightMargin Inch 32768]}
\define{typewriter
menu:[Font,Typewriter]
attr:[FontFace FixedFace Int Set]
attr:[FontFamily AndyType Int 0]}
\define{display
menu:[Region,Display]
attr:[LeftMargin LeftMargin Inch 32768]
attr:[RightMargin RightMargin Inch 32768]
attr:[Justification LeftJustified Point 0]}
\define{example
menu:[Region,Example]
attr:[LeftMargin LeftMargin Inch 32768]
attr:[Justification LeftJustified Point 0]
attr:[FontFace FixedFace Int Set]
attr:[FontFamily AndyType Int 0]}
\define{description
menu:[Region,Description]
attr:[LeftMargin LeftMargin Inch 32768]
attr:[Indent LeftEdge Inch -32768]}
\define{quotation
menu:[Region,Quotation]
attr:[LeftMargin LeftMargin Inch 32768]
attr:[RightMargin RightMargin Inch 32768]
attr:[FontFace Italic Int Set]}
\define{subscript
menu:[Font,Subscript]
attr:[Script PreviousScriptMovement Point 131072]
attr:[FontSize PreviousFontSize Point -2]}
\define{superscript
menu:[Font,Superscript]
attr:[Script PreviousScriptMovement Point -393216]
attr:[FontSize PreviousFontSize Point -2]}
\define{smaller
menu:[Font,Smaller]
attr:[FontSize PreviousFontSize Point -2]}
\define{heading
menu:[Title,Heading]
attr:[LeftMargin LeftMargin Inch -13107]
attr:[Justification LeftJustified Point 0]
attr:[FontFace Bold Int Set]}
\define{majorheading
menu:[Title,MajorHeading]
attr:[Justification Centered Point 0]
attr:[FontSize PreviousFontSize Point 4]}
\define{formatnote
menu:[Region,FormatNote]
attr:[Flags PassThru Int Set]}
\define{subheading
menu:[Title,Subheading]
attr:[Justification LeftJustified Point 0]
attr:[FontFace Bold Int Set]}
\define{center
menu:[Justify,Center]
attr:[Justification Centered Point 0]}
\define{flushleft
menu:[Justify,FlushLeft]
attr:[Justification LeftJustified Point 0]}
\define{flushright
menu:[Justify,FlushRight]
attr:[Justification RightJustified Point 0]}
\define{leftindent
menu:[Region,LeftIndent]
attr:[LeftMargin LeftMargin Inch 32768]}
\define{article
menu:[Title,Article]
attr:[Justification Centered Point 0]
attr:[FontSize ConstantFontSize Point 24]}
\define{subpara
menu:[Title,Subpara]
attr:[Justification LeftJustified Point 0]
attr:[FontFace Bold Int Set]}
\define{subsubpara
menu:[Title,Subsubpara]
attr:[Justification LeftJustified Point 0]
attr:[FontFace Italic Int Set]}
\define{itemize
menu:[Region,Itemize]
attr:[LeftMargin LeftMargin Inch 32768]}
\define{enumerate
menu:[Region,Enumerate]
attr:[LeftMargin LeftMargin Inch 32768]}
\define{programexample
menu:[Region,ProgramExample]
attr:[LeftMargin LeftMargin Inch 32768]
attr:[Justification LeftJustified Point 0]
attr:[FontFamily gacha Int 0]}
\define{notetotypesetter
menu:[Region,NoteToTypesetter]
attr:[Flags PassThru Int Set]}
\define{left
menu:[Justify,Left]
attr:[Justification LeftJustified Point 0]}
\define{right
menu:[Justify,Right]
attr:[Justification RightJustified Point 0]}
\define{underline
menu:[Font,Underline]
attr:[Flags Underline Int Set]}


\subsection{Andrew File Manager}


\paragraph{Introduction}

The section of the Andrew File System that deals with the transfer of files has two major parts, a server piece that runs on server machines (the Andrew File Manager) and a client piece that runs on workstations (the Andrew Cache Manager).  This is a description of the Andrew File Manager.  The file manager is the part of the Andrew File System that actually stores and retrieves the files on the servers.  It communicates with the cache managers on workstations.  The file manager receives its input calls through the \bold{R} package (a remote procedure call mechanism) and uses \bold{R} to return the results.  It is also responsible for checking that users are authorized to read or write the information requested.


\paragraph{Description}

The Andrew File Manager does not store files using the standard file system naming structure.  Instead it uses a modified kernel that lets it write directly to the file system bypassing the standard naming structure.  It builds its own naming structure to locate files.  The name it uses for files is a \italic{f}ile \italic{id}entifier or \italic{fid}.  A fid has three parts, a \italic{volume number}, a \italic{file number} and a \italic{uniquifier}.  The files are broken into collections that are called \italic{volumes} which hold several attributes, including the location of the volume.  (The other attributes are described in a different section.)  The \italic{volume number} is used to find the location of the file.  The \italic{file number} is used to locate the file on the disk.  It is used as an index into a structure; therefore it is both compressed and reuseable.  The \italic{uniquifier} is used to make the \italic{fid} unique over all of time while still retaining the ability to reuse the file number.  The \italic{fid} for a file does not change when a new version of the file is stored.  A package for manipulating volumes and a set of utilities that are used to operate the system are described in a different section.

The objects stored by the file manager are of several types. 

\indent{User file names are implemented using Unix-like \italic{directories}.  Directories are similar to files but may only be stored by the server.  A directory contains a list of string names and corresponding \italic{fid}s.  The structure of the directories on a volume is constrained to be a tree.  A volume has a distinguished directory called the \italic{root} and all other directories have exactly one parent.  

Ordinary files may have more than one name within a single directory.  Each name is called a \italic{link}.  A \italic{did} is a fid that refers to a directory.

A \italic{symbolic link} contains a path name to be substituted for the part of the file name that has been interpreted at the point where the symbolic link is encountered.}

Each type of object has data associated with it as well as some status information.  (The content of the status information is described below.)  In addition, directories have \italic{access lists} associated with them.  Access lists indicate which users can perform which operations on the directory and also the files and symbolic links that the directory contains.

\subpara{Status}

The status block for \italic{fids} and \italic{dids} contains the following fields:

\description{\bold{InterfaceVersion}	The revision level of the block.
\bold{VnodeType}	The type of the file (directory, file, symbolic link)
\bold{LinkCount}	The number of directories that point to this vnode
\bold{Length}   	The length of the data
\bold{DataVersion}	The revision number of the data (incremented on each data change (store for a file or member added or deleted for a directory)
\bold{Date}     	The date of the last data change.  It can also be explicitly changed by storing the status
\bold{Author}    	The user Id of the last user to change the data
\bold{Owner}    	The user Id of the creator of the file.  It  can also be explicitly changed by storing the status.
\bold{CallBack}	Whether a call back has been set
\bold{MyAccess}	The requestors rights to the file (see protection)
\bold{AnyAccess}	The rights of any user to the file
\bold{Mode}    	The mode bits that are used to supplement rights}

On a store, the Date, Owner, and Mode fields can be changed by filling them into the input status field.  All other fields in the input status are ignored. 

The next group of sections describe features which are different between the Andrew File System and a standard 4.2BSD.

\subpara{Locking}

When a requestor requests a lock, the lock is granted for a specified time period (initially 30 minutes).  If another request comes in after the time period has expired, the lock will be granted.  Locks, therefore, are stateless.  The Andrew Cache Manager will extend the locks for another 30 minutes before they expire.  If a workstation crashes causing a lock not to be freed, it will automatically be freed after 30 minutes.  A user must have lock authorization to set or release locks.  Since it is not known who acquired a lock, it is always possible to free locks that the requestor does not own.  This is not too great an exposure, however, since the locks are only advisory.  If a user wants to ignore locking and store a file that has a write lock on it, he or she can without the bother of releasing it.

\subpara{Protection}

Protection is associated with directories.  The rights supported are \italic{Read} and \italic{Write} for the files in that directory;  \italic{Lookup}, \italic{Insert} and \italic{Delete} for the directory itself; \italic{Administer} to allow the holder to always update rights; and \italic{Lock} to allow the holder to acquire and release advisory locks.  In addition the Unix mode bits for the owner are used to provide a soft protection (meaning one the user can easily change for himself or herself).  That is, if a user has rights to a file but the owner mode bits do not allow access (read or write), the request will be denied.  A user with administer rights or the owner can always change the mode bits or the rights.  A user who is a member of the \italic{System:Administrators} group has \italic{Administer} rights on all directories.


\paragraph{Andrew File Manager Interface}

The file manager interface supports several classes of calls:

\bold{File operations} which allow files to be created removed and stored.  
\bold{Volume operations} which deal directly with volumes and 
\bold{Miscellaneous operations} which deal with things like time and status.  

The file manager uses rgen to create its interface routines (described in more detail in a separate section).  The file \italic{\bold{vice.rg}} contains a description of the type of all of the parameters needed for the following calls and is kept in \italic{/usr/andy/server/include}.  Since vice.rg is used to generate the interface routines, it is the most up to date definition of the routines.  It also describes all of the blocks that are used to pass information back and forth.  To see examples of how to invoke the routines described below, look at the workstation cache manager code, which is also described in a separate section.  Normally programs are not written to deal directly with the file manager interface, but they use the workstation cache manager code.  The parameters are designated with an indicator IN, INOUT, OUT to indicate what type of parameter they are.  These designations are ignored when the system is actually used.

\subpara{File Operations}

The following operations are allowed on the files in a volume.  Each has an implicit volume parameter.  Each may return an error code indicating why the operation was not performed instead of the return values shown.  In addition any call may return EINVAL if any input \italic{fid} or \italic{did} is invalid.  Any of the following return codes from the Vnode or Volume package are also passed through.   

\description{\typewriter{VSALVAGE  	Volume containing fid/did needs to be salvaged
VNOVNODE  	The fid/did has an unused vnode number
VNOVOL    	The fid/did has an unused volume number
VNOSERVICE	The fid/did refers to an out of service volume
VMOVED    	The fid/did refers to a volume which has moved
VBUSY     	The fid/did refers to a volume which is busy}}

Most routines also attempt to check that the token has not timed out.  If it has they may get a

\description{\typewriter{VICETOKENDEAD	The user's token has expired}}

Callbacks are never signaled to the workstation making the request that causes a callback to occur.  Here are the routines for file operations and some information about each:

\subsubpara{RViceFetch}(IN tcon, IN fid, IN bidfid, IN type, IN bulk_descriptor, IN access_list, OUT status)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;
struct ViceFid 	*bidfid;
ViceFetchType 	type;
struct BD 		*bulk_descriptor;
struct BBS 		*acess_list;
ViceStatus 		*status;}

Returns the contents, access list and/or status information associated with the file.  The valid types are FetchData and FetchNoData.  The status is always returned and comes back in the status return area; the file is stored at the location described by the bulk descriptor.  The bidfid is the fid offered if the work station already has too many callbacks.  If an area for the access list is specified, an access list will be returned.  An access list can only be requested for a directory.  The request always requests that a callback be established. 
\typewriter{Errors
\description{EINVAL	Incorrect type, or invalid fid/did
EACCES 	Not authorized or read mode bit off
E2BIG  	Access list to large for the return area}}

\subsubpara{RViceFetchP}(IN tcon, IN fid, IN bidfid, IN type, IN bulk_descriptor, IN access_list, OUT optional_data, OUT status)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;
struct ViceFid 	*bidfid;
ViceFetchType 	type;
struct BD 		*bulk_descriptor;
struct BBS 		*acess_list;
struct BBS 		*optional_data;
ViceStatus 		*status;}

Returns the contents, access list and/or status information associated with the file.  The valid types are FetchData and FetchNoData.  The status is always returned and comes back in the status return area; the file is stored at the location described by the bulk descriptor.  The optional_data is returned if the area provided is large enough to hold the whole file.  This is done to transfer small files on the request.  The requestor is responsible for setting the MaxSeqLen field in the optional_data operand to just fill the empty space in the return packet.  The bidfid is the fid offered if the work station already has too many callbacks.  If an area for the access list is specified, an access list will be returned.  An access list can only be requested for a directory.  The request always requests that a callback be established. 
\typewriter{Errors
\description{EINVAL	Incorrect type or invalid fid/did
EACCES 	Not authorized or read mode bit off
E2BIG  	Access list too large for the return area}}

\subsubpara{RViceStore}(IN tcon, IN fid, IN type, IN access_list, IN bulk_descriptor, INOUT status, IN length)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;
ViceStoreType 	type;
struct CBS 		*access_list;
struct BD 		*bulk_descriptor;
struct ViceStatus 	*status;
long 			length;}

Stores new versions of the file's status, access list, and/or data.  The valid types are StoreNeither, StoreData, StoreStatus, StoreStatusData.  The location of the file to store is in the bulk descriptor and its length is in the length field. (Data can only be stored for files.  Attempts to store directories or symbolic links are rejected.)  If an access list is provided, it will replace the current access list.  (Access lists can only be stored for directories.)  The updated status block for the file, including the values assigned by the server, is returned in the area where the status is passed.  This call does not change the storing workstation's callback state with respect to the stored file.   Any workstation having a callback on \italic{fid} is notified.
\typewriter{Errors
\description{EINVAL	Incorrect type or access list invalid
ENOTDIR	Requesting to store an access list and not a directory
EISDIR  	Requesting to store data in a directory
EACCES 	Not authorized or write mode bit off
E2BIG  	The input access list is too large}}

\subsubpara{RViceStoreP}(IN tcon, IN fid, IN type, IN access_list, IN optional_data, IN bulk_descriptor, INOUT status, IN length)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;
ViceStoreType 	type;
struct CBS 		*access_list;
struct BBS 		*optional_data;
struct BD *		bulk_descriptor;
struct ViceStatus 	*status;
long 			length;}

Stores new versions of the file's status, access list, and/or data.  The valid types are StoreNeither, StoreData, StoreStatus, StoreStatusData.  The location of the file to store is in the bulk descriptor and its length is in the length field. If optional_data exists, it is the file; this optimization is used to transfer short files in the spare space in the request header.  (Data can only be stored for files.  Attempts to store directories or symbolic links are rejected.)  If an access list is provided, it will replace the current access list.  Access lists can only be stored for directories.  The updated status block for the file, including the values assigned by the server, is returned in the area that the status is passed in.  This call does not change the storing workstation's callback state with respect to the stored file.   Any workstation having a callback on \italic{fid} is notified.
\typewriter{Errors
\description{EINVAL	Incorrect type or access list invalid
ENOTDIR	Requesting to store an access list and not a directory
EISDIR  	Requesting to store data in a directory
EACCES 	Not authorized or write mode bit off
E2BIG  	The input access list is too large}}

\subsubpara{RViceCreate}(IN tcon, IN did, IN bidfid, IN name, INOUT status, OUT fid, OUT DirStatus)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*did;
struct ViceFid 	*bindfid;
char 			*name;
struct ViceStatus 	*status;
struct ViceFid 	*fid;
struct ViceStatus 	*DirStatus;}

Creates a new file with name \italic{name} and status as given in directory \italic{did}.  The new status of the file is returned in the input area.  The directory status is returned in DirStatus.  The directory update is performed locally on those directories on which the workstation has callbacks and the callback state is maintained.  A callback is also placed on the newly-created fid and bidfid has the same meaning as in\bold{ Fetch}.  All workstations having a callback on the \italic{did} are notified.
\typewriter{Errors
\description{EINVAL	The did was invalid
ENOTDIR	The input did does not refer to a directory
EACCES 	The caller does not have insert writes on the directory or the write mode bit is off
EEXIST 	The file already exists}}

\subsubpara{RViceSymlink}(IN tcon, IN did, IN destName, IN name, INOUT status, OUT fid, OUT DirStatus)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*did;
char 			*destName;
char 			*name
struct ViceStatus 	*status;
struct ViceFid 	*fid;
struct ViceStaus 	*DirStatus;}

Creates a new symbolic link with name \italic{name} in directory \italic{did}.  The symbolic link resolves to the name \italic{destName}. The status in status is stored with the link.  The fid for the link and the status for the link and directory are returned.
\typewriter{Errors
\description{EINVAL	The did is invalid
ENOTDIR	Did is not a directory
EACCES 	No insert rights on the directory or the directory write mode bit is off
EEXIST  	Name already exists in the directory}}

\subsubpara{RViceLink}(IN tcon, IN did, IN name, IN fid, OUT status, OUT newDirStatus)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*did;
char 			*name;
struct ViceFid 	*fid;
struct ViceStatus 	*status;
struct ViceStatus 	*newDirStatus;}

Creates a new reference to the object \italic{fid} having name \italic{name} in directory \italic{did}.  The object must be an ordinary file.  The fid for the new object along with its status and the updated status of directory is returned.  Both the new and old names must be in the same directory.
\typewriter{Errors
\description{EINVAL	The did is invalid
ENOTDIR	Did is not a directory
EACCES 	No insert rights on did or write mode bit is off
EISDIR  	Fid is not a file
EXDEV  	Fid is not a member of did.
EEXIST 	Name already exists in did}}

\subsubpara{RViceRemove}(IN tcon, IN did, IN name, OUT status)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*did;
char 			*name;
struct ViceStatus 	*status;}

Deletes the reference to the object with name \italic{name} in directory \italic{did}.  The object named must be an ordinary file or a symbolic link.  If this is the only reference to the object, it is removed from storage.  The new status for did is returned.  Any workstations with callback on \italic{did} or \italic{name} are notified.
\typewriter{Errors
\description{EINVAL	The did is invalid
ENOTDIR	Input did is not a directory
EACCES 	No delete rights for the directory or the write mode bit is off
ENOENT  	The file does not exist
EISDIR  	The name refers to a directory}}

\subsubpara{RViceMakeDir}(IN tcon, IN did, IN name, INOUT status, OUT newdid, OUT newDirStatus)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*did;
char 			*name;
struct ViceStatus 	*status;
struct ViceFid 	*newdid;
struct ViceStatus 	*newDirStatus;}

Creates a new, empty directory with name \italic{name} in directory \italic{did}.  Status is used along with the status in \italic{did} to create the status for the new directory.  The newdid of the new directory along with its status and the updated status from \italic{did} are returned.  Any workstation with a callback request on \italic{did} are notified.
\typewriter{Errors
\description{EINVAL	The did is invalid
ENOTDIR	Did is not a directory
EACCESS	No insert writes on did or the write mode bit is off
EEXIST  	Name exists in did}}

\subsubpara{RViceRemoveDir}(IN tcon, IN did, IN name, OUT status)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*did;
char 			*name;
struct ViceStatus 	*status;}

Removes the directory referred to by name \italic{name} in directory \italic{did}.  The named object must be a directory and must be empty.  The new status for \italic{did} is returned.  Any workstation with callback requests on \italic{did} or \italic{name} are notified.
\typewriter{Errors
\description{EINVAL	The did is invalid
ENOTDIR	Did is not a directory or name is not a directory
EACCES 	No delete rights on did or write mode bit is off
ENOENT 	Name does not exist in did
ENOTEMPTY	Name is not empty}}

\subsubpara{RViceRename}(IN tcon, IN oldDid, IN oldName, IN newDid, IN newName, OUT oldDirStatus, OUT newDirStatus)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*oldDid;
char 			*oldName;
struct ViceFid 	*newDid;
char 			*newName;
struct ViceStatus 	*oldDirStatus;
struct ViceStatus 	*newDirStatus;}

Renames the file, directory, or symbolic link referred to by \italic{oldDid} and \italic{oldName} to \italic{newName} in \italic{newDid}.  The name \italic{oldName} is no longer present in \italic{oldDid}.  If the moved object is a directory, the rename operation must preserve the invariant that the directories form a tree.  The status from the old and new directories are returned (the status of the renamed object remains the same).  If an object with the name \italic{newName} exists, it must be of the same type as \italic{oldName} (files and symbolic links are considered the same type for this check).  If \italic{newName} refers to a directory, it must be empty.  Any workstations holding a callback request on \italic{oldDid} or \italic{newDid} are notified.
\typewriter{Errors
\description{EXDEV   	OldDid and newDid refer to different volumes
EINVAL 	Either oldName or newName is "." or ".."
ENOTDIR	OldDid or newDid are not directories or oldName is a file and newName is a directory
EACCES 	Do not have delete rights on oldDid or insert rights on newDid (delete rights are also needed on newDid if newName is present).  The write mode bits must be set on both oldDid and newDid.
ENOENT 	OldName does not exist in directory oldDid
ELOOP  	The rename would cause the directories to form other than a tree
ENOTEMPTY	NewName refers to a directory and it is not empty
EISDIR  	oldName is a directory and newName is a file
EXDEV  	A rename was attempted to a file that has a hard link pointed to it}}

\subsubpara{RViceRemoveCallBack}(IN tcon, IN fid)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;}

Releases the Callback status for \italic{fid}.  This is used by a workstation to inform the file manager that it no longer has a copy of the data in its cache.
\typewriter{Errors
\description{NONE}}

\subsubpara{RViceRemoveCallBackBulk}(tcon fids, nfids)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fids;
long 			nfids;}

Exactly the same as RViceRemoveCallBack except that the workstation can supply up to \typewriter{MAX_CB_FIDS} (currently 50) in a single bulk call.  This call will eventually obsolete RViceRemoveCallBack.

\subsubpara{RViceSetLock}(IN tcon, IN fid, IN type)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;
ViceLockType 		type;}

Sets a lock on the input fid.  The types allowed are LockRead or LockWrite.  If it is not possible to set the lock, it is rejected.  A description of locking is in a following section.  If the lock is set, a callback is given for \italic{fid}.  The lock is only held for 30 minutes, unless an extend lock call is given.
\typewriter{Errors
\description{EINVAL 	Type is invalid
EACCES 	Lock rights are not set
EWOULDBLOCK	Lock already held}}

\subsubpara{\subsubpara{RViceExtendLock}(IN tcon, IN fid)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;}

Extends the expiration time for the lock specified by the input fid.  
\typewriter{Errors
\description{EINVAL 	The fid/did is invalid or the lock is not held
}}
RViceReleaseLock}(IN tcon, IN fid)
\typewriter{struct r_connection 	*tcon;
struct ViceFid 	*fid;}

Releases the lock specified by the input fid.  If this is the last holder of the lock a callback is sent to all holders of \italic{fid}.
\typewriter{Errors
\description{EINVAL 	The fid/did is invalid
EACCES 	Lock rights are not set}}

\subpara{Volume operations}

The following operations are used to manipulate volumes.  Each may return an error code indicating why the operation was not performed instead of the return values shown.

\subsubpara{RViceGetRootVolume}() => (IN tcon, IN volume)
\typewriter{struct r_connection 	*tcon;
struct BBS 		*volume;}

Returns the volume number of the default root for the file system.
\typewriter{Errors
\description{None}}

\subsubpara{RViceSetRootVolume}(IN tcon, IN volume)
\typewriter{struct r_connection 	*tcon;
char 			*volume}

Sets the volume number of the default root for the file system.
\typewriter{Errors
\description{EINVAL 	the volume number is less than one
EACCES 	the requestor is not a system administrator}}

\subsubpara{RViceGetVolumeStatus}(volume) => (IN tcon, IN volume, OUT status, OUT name, OUT offmsg, OUT msgotd)
\typewriter{struct r_connection 	*tcon;
long			volume;
VolumeStatus		*status;
struct BBS		*name;
struct BBS		*offmsg;
struct BBS		*msgotd;}

Returns the current status block (\italic{status}), \italic{name}, offline msg (\italic{offmsg}) and message of the day (\italic{msgotd}) for \italic{volume}.
\typewriter{Errors
\description{EINVAL 	The volume parameter is invalid
EACCES 	The requestor does not have read access to the root directory on the volume}}

\subsubpara{RViceSetVolumeStatus}(IN tcon, IN volume, INOUT status, INOUT name, INOUT offmsg, INOUT msgotd)
\typewriter{struct r_connection	*tcon;
long			volume;
VolumeStatus		*status;
struct BBS		*name;
struct BBS		*offmsg;
struct BBS		*msgotd;}

Uses any of the input parameters to change the current values stored with the volume, then returns the current settings of all of the parameters.
\typewriter{Errors
\description{See Volume errors above}}

\subsubpara{RViceGetVolumeInfo}(IN tcon, IN volume, IN info)
\typewriter{struct r_connection 	*tcon;
char			*volume;
struct VolumeInfo	*info;}

Returns the location information on \italic{volume} in the field \italic{info}.
\typewriter{Errors
\description{See Volume errors above}}

\subpara{Miscellaneous Operations}

\subsubpara{RViceConnectFS}(IN tcon, IN user, IN work, IN venus)
\typewriter{struct r_connection	*tcon;
char			*user;
char			*work;
char			*venus;}

This must be the first call on a connection after it is established.  It presents the name of the user, the workstation on which he or she is located, and the cache manager through which the connection is made.
\typewriter{Errors
\description{EPIPE 	The connection is for viceid 0
EINVAL 	There is no connection for this request}}

\subsubpara{RViceDisconnectFS}(IN tcon)
\typewriter{struct r_connection	*tcon;}

Releases all the resources for a workstation.
\typewriter{Errors
\description{None}}

\subsubpara{RViceGetTime}(IN tcon, OUT secs, OUT usecs)
\typewriter{struct r_connection	*tcon;
unsigned long		*secs;
unsigned long		*usecs;}

Returns the current time from the server.
\typewriter{Errors
\description{None}}

\subsubpara{RViceGetStatistics}(IN tcon, OUT stats)
\typewriter{struct r_connection		*tcon;
struct ViceStatistics	*stats;}

Returns the status block that contains a dump of useful server statistics.  This call can only come from the operators console.
\typewriter{Errors
\description{None}}

\subsubpara{RViceCheckToken}(IN tcon, IN userid, IN secrettoken)
\typewriter{struct r_connection	*tcon;
long			userid;
struct CBS		*secrettoken;}

Used to ensure that the \italic{secrettoken} is valid for user \italic{userid}.
\typewriter{Errors
\description{ECONNREFUSED	the token is not valid for the requested userid}}

\subsubpara{RViceEnableGroup}(IN tcon, IN groupname)
\typewriter{struct r_connection	*tcon;
char			*groupname;}

Enables the user to operate as a member of group \italic{groupname} if he is on the membership list for the group.
\typewriter{Errors
\description{None}}

\subsubpara{RViceDisableGroup}(IN tcon, IN groupname)
\typewriter{struct r_connection	*tcon;
char			*groupname;}

Disables the user from having the rights associated with group \italic{groupname}, even though he is listed as being a member of the group
\typewriter{Errors
\description{None}}


\paragraph{Module hierarchy}

The packages that are used by the Andrew File Manager are described in separate sections.  The packages used are:

\indent{Volume Package

LWP Package

R Package

Dir Package}

\bold{\italic{File.c}} is the main entry point.  It is used to initialize the various packages and to receive input requests.  All requests are handled in \bold{\italic{file.c}} and then the \bold{\italic{rgen}} interface modules are invoked to take the input from network format and pass it to the appropriate request handlers.  All of the request handlers are in \bold{\italic{fileproc.c}} and \bold{\italic{fileproc2.c}}.  \italic{Callback.c} contains the routines to implement notifying the various cache managers that have copies of files that are changing.  \italic{\bold{Host.c}} contains the routines to deal with identifying the hosts to which the server is connected.  \italic{\bold{Profile.c}} contains the interface to allow online profiling of an active server.  \italic{\bold{Physio.c}} contains the reads and writes needed by the dir package as well as the logging of errors.  \italic{\bold{Cbd.c}} is a utility that interprets a callback dump from the server.


\paragraph{Debugging information}

The Andrew File Manager (file) process dumps a log file into /vice/file/FileLog, which contains much useful information.  Every 4096 requests, the file process dumps the state of a number of its counters; that state can be used to see whether the server is running and receiving requests at a reasonable rate.  File also will use /vice/file/FileLog to save error messages if they occur.  You can watch what is happening by issuing the command:  

\italic{tail -f /vice/file/FileLog &} 

In addition a number of shell scripts are provided that can supply additional dubugging information.  

The script \italic{\bold{debugon}} is used to increase the amount of debugging information that is saved in the log.  If it is repeatedly invoked, \bold{\italic{debugon}} will increase the amount of information saved.  The script \italic{\bold{debugoff}} will return to the original level of message saving.  If \italic{\bold{debugon}} is issued once, you will receive one message for every request to the file manager.  If it is issued twice, you will also receive the results of the call and about triple the number of messages.  Issuing \italic{\bold{debugon}} a third time will bring you to the maximum amount of debugging information.  Do not forget to issue \italic{\bold{debugoff}} when you are finished or the log will grow quickly and may fill up your disk.

\italic{\bold{List}} gets a current list of the users that are attached to the file manager.

\italic{\bold{Stats}} gets the dump that happens every 4096 requests to take place immediately.

\italic{\bold{Restart}} brings down and then starts up the file manager cleanly without doing a salvage or effecting any of the other processes.

\italic{\bold{Shutdown}} brings all processes down cleanly and stops all file manager processes from running.  

\italic{\bold{Startup}} brings all processes back up.  This command is normally in the \italic{/etc/rc} file for the servers.

\italic{\bold{Checknew}} restarts the file manager process if a new file manager has been installed on the system.  It is normally invoked from \italic{/usr/lib/crontab}.

\bold{\italic{Profile}} turns on profile.  Issuing \italic{profile} a second time causes the profiling to be turned off and a mon.out file to be written.

\italic{\bold{Newvollist}} causes a new \italic{/vice/vol/VolumeList} file to be written.  This is done automatically when backup volumes are created.  Volumes that are created are also automatically included in the list.  This command is used when volumes are deleted if you need to purge them from the list for some reason.

\italic{\bold{Swaplog}} is used to change the log files.  It is usually invoked from \italic{/usr/lib/crontab}.  As shipped, \italic{swaplog} runs once a week.
\notetotypesetter{.bp}
\enddata{text,268556792}
