OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/doc/protocol/fs-cm-spec.h
00001 
01462 \endcode
01463 \par Description 
01464 [Opcode 137] This call is used to create a file, but not for creating a
01465 directory or a symbolic link. If this call succeeds, it is the Cache Manager's
01466 responsibility to either create an entry locally in the directory specified by
01467 DirFid or to invalidate this directory's cache entry. 
01468 \par
01469 Rx connection information for the related File Server is contained in a
01470 rxConnP. Volume version information is returned for synchronization purposes in
01471 a volSyncP. 
01472 \par Error Codes 
01473 EACCES The caller is not permitted to perform this operation. 
01474 \n EINVAL An internal error in looking up the client record was encountered, or
01475 an invalid fid or name was provided. 
01476 \n ENOTDIR The DirFid parameter references an object which is not a directory. 
01477 \n VICETOKENDEAD Caller's authentication token has expired. 
01478 
01479         \subsubsection sec5-1-3-7 Section 5.1.3.7: RXAFS Rename - Rename the
01480 specified file in the given directory 
01481 
01482 \code
01483 int RXAFS Rename(IN struct rx connection *a rxConnP, 
01484                         IN AFSFid *a origDirFidP, 
01485                         IN char *a origNameP, 
01486                         IN AFSFid *a newDirFidP, 
01487                         IN char *a newNameP, 
01488                         OUT AFSFetchStatus *a origDirStatusP, 
01489                         OUT AFSFetchStatus *a newDirStatusP, 
01490                         OUT AFSVolSync *a volSyncP) 
01491 \endcode
01492 \par Description 
01493 [Opcode 138] Rename file a origNameP in the directory identified by a
01494 origDirFidP. Its new name is to be a newNameP, and it will reside in the
01495 directory identified by a newDirFidP. Each of these names must be no more than
01496 AFSNAMEMAX (256) characters long. The status of the original and new
01497 directories after the rename operation completes are deposited in a
01498 origDirStatusP and a newDirStatusP respectively. Existing callbacks are broken
01499 for all files and directories involved in the operation. 
01500 \par
01501 Rx connection information for the related File Server is contained in a
01502 rxConnP. Volume version information is returned for synchronization purposes in
01503 a volSyncP. 
01504 \par Error Codes 
01505 EACCES New file exists but user doesn't have Delete rights in the directory. 
01506 \n EINVAL Name provided is invalid. 
01507 \n EISDIR Original object is a file and new object is a directory. 
01508 \n ENOENT The object to be renamed doesn't exist in the parent directory. 
01509 \n ENOTDIR Original object is a directory and new object is a file. 
01510 \n EXDEV Rename attempted across a volume boundary, or create a pathname loop,
01511 or hard links exist to the file. 
01512 
01513         \subsubsection sec5-1-3-8 Section 5.1.3.8: RXAFS Symlink - Create a
01514 symbolic link 
01515 
01516 \code
01517 int RXAFS Symlink(IN struct rx connection *a rxConnP, 
01518                         IN AFSFid *a dirFidP, 
01519                         IN char *a nameP, 
01520                         IN char *a linkContentsP, 
01521                         IN AFSStoreStatus *a origDirStatP, 
01522                         OUT AFSFid *a newFidP, 
01523                         OUT AFSFetchStatus *a newFidStatP, 
01524                         OUT AFSFetchStatus *a newDirStatP, 
01525                         OUT AFSVolSync *a volSyncP) 
01526 \endcode
01527 \par Description 
01528 [Opcode 139] Create a symbolic link named a nameP in the directory identified
01529 by a dirFidP. The text of the symbolic link is provided in a linkContentsP, and
01530 the desired status fields for the symbolic link given by a origDirStatP. The
01531 name offered in a nameP must be less than AFSNAMEMAX (256) characters long, and
01532 the text of the link to which a linkContentsP points must be less than
01533 AFSPATHMAX (1,024) characters long. Once the symbolic link has been
01534 successfully created, its file identifier is returned in a newFidP. Existing
01535 callbacks to the a dirFidP directory are broken before the symbolic link
01536 creation completes. The status fields for the symbolic link itself and its
01537 parent's directory are returned in a newFidStatP and a newDirStatP
01538 respectively. 
01539 \par
01540 Rx connection information for the related File Server is contained in a
01541 rxConnP. Volume version information is returned for synchronization purposes in
01542 a volSyncP. 
01543 \par Error Codes 
01544 EACCES The caller does not have the necessary access rights. 
01545 \n EINVAL Illegal symbolic link name provided. 
01546 
01547         \subsubsection sec5-1-3-9 Section 5.1.3.9: RXAFS Link - Create a hard
01548 link 
01549 
01550 \code
01551 int RXAFS Link(IN struct rx connection *a rxConnP, 
01552                 IN AFSFid *a dirFidP, 
01553                 IN char *a nameP, 
01554                 IN AFSFid *a existingFidP, 
01555                 OUT AFSFetchStatus *a newFidStatP, 
01556                 OUT AFSFetchStatus *a newDirStatP, 
01557                 OUT AFSVolSync *a volSyncP) 
01558 \endcode
01559 \par Description 
01560 [Opcode 140] Create a hard link named a nameP in the directory identified by a
01561 dirFidP. The file serving as the basis for the hard link is identified by
01562 existingFidP. The name offered in a nameP must be less than AFSNAMEMAX (256)
01563 characters long. Existing callbacks to the a dirFidP directory are broken
01564 before the hard link creation completes. The status fields for the file itself
01565 and its parent's directory are returned in a newFidStatP and a newDirStatP
01566 respectively. 
01567 Rx connection information for the related File Server is contained in a
01568 rxConnP. Volume version information is returned for synchronization purposes in
01569 a volSyncP. 
01570 \par Error Codes 
01571 EACCES The caller does not have the necessary access rights. 
01572 \n EISDIR An attempt was made to create a hard link to a directory. 
01573 \n EXDEV Hard link attempted across directories. 
01574 
01575         \subsubsection sec5-1-3-10 Section 5.1.3.10: RXAFS MakeDir - Create a
01576 directory 
01577 
01578 \code
01579 int RXAFS MakeDir(IN struct rx connection *a rxConnP, 
01580                         IN AFSFid *a parentDirFid,P 
01581                         IN char *a newDirNameP, 
01582                         IN AFSStoreStatus *a currStatP, 
01583                         OUT AFSFid *a newDirFidP, 
01584                         OUT AFSFetchStatus *a dirFidStatP, 
01585                         OUT AFSFetchStatus *a parentDirStatP, 
01586                         OUT AFSCallBack *a newDirCallBackP, 
01587                         OUT AFSVolSync *a volSyncP) 
01588 \endcode
01589 \par Description 
01590 [Opcode 141] Create a directory named a newDirNameP within the directory
01591 identified by a parentDirFidP. The initial status fields for the new directory
01592 are provided in a currStatP. The new directory's name must be less than
01593 AFSNAMEMAX (256) characters long. The new directory's ACL is inherited from its
01594 parent. Existing callbacks on the parent directory are broken before the
01595 creation completes. Upon successful directory creation, the new directory's
01596 file identifier is returned in a newDirFidP, and the resulting status
01597 information for the new and parent directories are stored in a dirFidStatP and
01598 a parentDirStatP respectively. In addition, a callback for the new directory is
01599 returned in a newDirCallBackP. 
01600 \par
01601 Rx connection information for the related File Server is contained in a
01602 rxConnP. Volume version information is returned for synchronization purposes in
01603 a volSyncP. 
01604 \par Error Codes 
01605 EACCES The caller does not have the necessary access rights. 
01606 \n EINVAL The directory name provided is unacceptable. 
01607 
01608         \subsubsection sec5-1-3-11 Section 5.1.3.11: RXAFS RemoveDir - Remove a
01609 directory 
01610 
01611 \code
01612 int RXAFS RemoveDir(IN struct rx connection *a rxConnP, 
01613                         IN AFSFid *a parentDirFidP, 
01614                         IN char *a dirNameP, 
01615                         OUT AFSFetchStatus *a newParentDirStatP, 
01616                         OUT AFSVolSync *a volSyncP) 
01617 \endcode
01618 \par Description 
01619 [Opcode 142] Remove the directory named a dirNameP from within its parent
01620 directory, identified by a parentDirFid. The directory being removed must be
01621 empty, and its name must be less than AFSNAMEMAX (256) characters long.
01622 Existing callbacks to the directory being removed and its parent directory are
01623 broken before the deletion completes. Upon successful deletion, the status
01624 fields for the parent directory are returned in a newParentDirStatP. 
01625 \par
01626 Rx connection information for the related File Server is contained in a
01627 rxConnP. Volume version information is returned for synchronization purposes in
01628 a volSyncP. 
01629 \par Error Codes 
01630 EACCES The caller does not have the necessary access rights. 
01631 
01632         \subsubsection sec5-1-3-12 Section 5.1.3.12: RXAFS GetStatistics - Get
01633 common File Server statistics 
01634 
01635 \code
01636 int RXAFS GetStatistics(IN struct rx connection *a rxConnP, 
01637                         OUT ViceStatistics *a FSInfoP) 
01638 \endcode
01639 \par Description 
01640 [Opcode 146] Fetch the structure containing a set of common File Server
01641 statistics. These numbers represent accumulated readings since the time the
01642 File Server last restarted. For a full description of the individual fields
01643 contained in this structure, please see Section 5.1.2.6. 
01644 \par
01645 Rx connection information for the related File Server is contained in a
01646 rxConnP. 
01647 \par Error Codes 
01648 ---No error codes generated. 
01649 
01650         \subsubsection sec5-1-3-13 Section 5.1.3.13: RXAFS GiveUpCallBacks -
01651 Ask the File Server to break the given set of callbacks on the corresponding
01652 set of file identifiers 
01653 
01654 \code
01655 int RXAFS GiveUpCallBacks(IN struct rx connection *a rxConnP, 
01656                                 IN AFSCBFids *a fidArrayP, 
01657                                 IN AFSCBs *a callBackArrayP) 
01658 \endcode
01659 \par Description 
01660 [Opcode 147] Given an array of up to AFSCBMAX file identifiers in a fidArrayP
01661 and a corresponding number of callback structures in a callBackArrayP, ask the
01662 File Server to remove these callbacks from its register. Note that this routine
01663 only affects callbacks outstanding on the given set of files for the host
01664 issuing the RXAFS GiveUpCallBacks call. Callback promises made to other
01665 machines on any or all of these files are not affected. 
01666 \par
01667 Rx connection information for the related File Server is contained in a
01668 rxConnP. 
01669 \par Error Codes 
01670 EINVAL More file identifiers were provided in the a fidArrayP than callbacks in
01671 the a callBackArray. 
01672 
01673         \subsubsection sec5-1-3-14 Section 5.1.3.14: RXAFS GetVolumeInfo - Get
01674 information about a volume given its name 
01675 
01676 \code
01677 int RXAFS GetVolumeInfo(IN struct rx connection *a rxConnP, 
01678                         IN char *a volNameP, 
01679                         OUT VolumeInfo *a volInfoP) 
01680 \endcode
01681 \par Description 
01682 [Opcode 148] Ask the given File Server for information regarding a volume whose
01683 name is a volNameP. The volume name must be less than AFSNAMEMAX characters
01684 long, and the volume itself must reside on the File Server being probed. 
01685 \par
01686 Rx connection information for the related File Server is contained in a
01687 rxConnP. Please note that definitions for the error codes with VL prefixes may
01688 be found in the vlserver.h include file 
01689 \par Error Codes 
01690 Could not contact any of the corresponding Volume Location Servers. 
01691 VL BADNAME An improperly-formatted volume name provided. 
01692 \n VL ENTDELETED An entry was found for the volume, reporting that the volume
01693 has been deleted. 
01694 \n VL NOENT The given volume was not found. 
01695 
01696         \subsubsection sec5-1-3-15 Section 5.1.3.15: RXAFS GetVolumeStatus -
01697 Get basic status information for the named volume 
01698 
01699 \code
01700 int RXAFS GetVolumeStatus(IN struct rx connection *a rxConnP, 
01701                                 IN long a volIDP, 
01702                                 OUT AFSFetchVolumeStatus *a volFetchStatP, 
01703                                 OUT char *a volNameP, 
01704                                 OUT char *a offLineMsgP, 
01705                                 OUT char *a motdP) 
01706 \endcode
01707 \par Description 
01708 [Opcode 149] Given the numeric volume identifier contained in a volIDP, fetch
01709 the basic status information corresponding to that volume. This status
01710 information is stored into a volFetchStatP. A full description of this status
01711 structure is found in Section 5.1.2.8. In addition, three other facts about the
01712 volume are returned. The volume's character string name is placed into a
01713 volNameP. This name is guaranteed to be less than AFSNAMEMAX characters long.
01714 The volume's offline message, namely the string recording why the volume is
01715 off-line (if it is), is stored in a offLineMsgP . Finally, the volume's
01716 "Message of the Day" is placed in a motdP. Each of the character strings
01717 deposited into a offLineMsgP and a motdP is guaranteed to be less than
01718 AFSOPAQUEMAX (1,024) characters long. 
01719 \par
01720 Rx connection information for the related File Server is contained in a
01721 rxConnP. 
01722 \par Error Codes 
01723 EACCES The caller does not have the necessary access rights. 
01724 \n EINVAL A volume identifier of zero was specified. 
01725 
01726         \subsubsection sec5-1-3-16 Section 5.1.3.16: RXAFS SetVolumeStatus -
01727 Set the basic status information for the named volume
01728 
01729 \code
01730 int RXAFS SetVolumeStatus(struct rx connection *a rxConnP,
01731                                 long avolIDP, 
01732                                 AFSStoreVolumeStatus *a volStoreStatP, 
01733                                 char *a volNameP, 
01734                                 char *a offLineMsgP, 
01735                                 char *a motdP) 
01736 /* for the named volume */
01737 \endcode
01738 \par Description
01739 [Opcode 150] Given the numeric volume identifier contained in a volIDP, set
01740 that volume's basic status information to the values contained in a
01741 volStoreStatP. A full description of the fields settable by this call,
01742 including the necessary masking, is found in Section 5.1.2.9. In addition,
01743 three other items relating to the volume may be set. Non-null character strings
01744 found in a volNameP, a offLineMsgP, and a motdP will be stored in the volume's
01745 printable name, off-line message, and "Message of the Day" fields respectively.
01746 The volume name provided must be less than AFSNAMEMAX (256) characters long,
01747 and the other two strings must be less than AFSOPAQUEMAX (1,024) characters
01748 long each. 
01749 \par
01750 Rx connection information for the related File Server is contained in a
01751 rxConnP. 
01752 \par Error Codes 
01753 EACCES The caller does not have the necessary access rights. 
01754 \n EINVAL A volume identifier of zero was specified. 
01755 
01756         \subsubsection sec5-1-3-17 Section 5.1.3.17: RXAFS GetRootVolume -
01757 Return the name of the root volume for the file system 
01758 
01759 \code
01760 int RXAFS GetRootVolume(IN struct rx connection *a rxConnP, 
01761                         OUT char *a rootVolNameP) 
01762 \endcode
01763 \par Description 
01764 [Opcode 151] Fetch the name of the volume which serves as the root of the AFS
01765 file system and place it into a rootVolNameP. This name will always be less
01766 than AFSNAMEMAX characters long. Any File Server will respond to this call, not
01767 just the one hosting the root volume. The queried File Server first tries to
01768 discover the name of the root volume by reading from the
01769 /usr/afs/etc/RootVolume file on its local disks. If that file doesn't exist,
01770 then it will return the default value, namely "root.afs". 
01771 \par
01772 Rx connection information for the related File Server is contained in a
01773 rxConnP. Volume version information is returned for synchronization purposes in
01774 a volSyncP. 
01775 \par Error Codes 
01776 ---No error codes generated. 
01777 
01778         \subsubsection sec5-1-3-18 5.1.3.18: RXAFS CheckToken - (Obsolete)
01779 Check that the given user identifier matches the one in the supplied
01780 authentication token 
01781 
01782 \code
01783 int RXAFS CheckToken(IN struct rx connection *a rxConnP, 
01784                         IN long ViceId, 
01785                         IN AFSOpaque *token) 
01786 \endcode
01787 \par Description 
01788 [Opcode 152] This function only works for the now-obsolete RPC facility used by
01789 AFS, R. For modern systems using the Rx RPC mechanism, we always get an error
01790 return from this routine. 
01791 \par
01792 Rx connection information for the related File Server is contained in a
01793 rxConnP. 
01794 \par Error Codes 
01795 ECONNREFUSED Always returned on Rx connections. 
01796 
01797         \subsubsection sec5-1-3-19 Section 5.1.3.19: RXAFS GetTime - Get the
01798 File Server's time of day 
01799 
01800 \code
01801 int RXAFS GetTime(IN struct rx connection *a rxConnP, 
01802                         OUT unsigned long *a secondsP, 
01803                         OUT unsigned long *a uSecondsP) 
01804 \endcode
01805 \par Description 
01806 [Opcode 153] Get the current time of day from the File Server specified in the
01807 Rx connection information contained in a rxConnP. The time is returned in
01808 elapsed seconds (a secondsP) and microseconds (a uSecondsP) since that standard
01809 unix "start of the world". 
01810 \par Error Codes 
01811 ---No error codes generated. 
01812 
01813         \subsubsection sec5-1-3-20 Section 5.1.3.20: RXAFS NGetVolumeInfo - Get
01814 information about a volume given its name 
01815 
01816 \code
01817 int RXAFS NGetVolumeInfo(IN struct rx connection *a rxConnP, 
01818                                 IN char *a volNameP, 
01819                                 OUT AFSVolumeInfo *a volInfoP) 
01820 \endcode
01821 \par Description 
01822 [Opcode 154] This function is identical to RXAFS GetVolumeInfo() (see Section
01823 5.1.3.14), except that it returns a struct AFSVolumeInfo instead of a struct
01824 VolumeInfo. The basic difference is that struct AFSVolumeInfo also carries an
01825 accompanying UDP port value for each File Server listed in the record. 
01826 
01827         \subsubsection sec5-1-3-21 Section 5.1.3.21: RXAFS BulkStatus - Fetch
01828 the status information regarding a set of given file system objects 
01829 
01830 \code
01831 int RXAFS BulkStatus(IN struct rx connection *a rxConnP, 
01832                         IN AFSCBFids *a fidToStatArrayP, 
01833                         OUT AFSBulkStats *a currStatArrayP, 
01834                         OUT AFSCBs *a callBackArrayP, 
01835                         OUT AFSVolSync *a volSyncP) 
01836 \endcode
01837 \par Description 
01838 [Opcode 155] This routine is identical to RXAFS FetchStatus() as described in
01839 Section 5.1.3.2, except for the fact that it allows the caller to ask for the
01840 current status fields for a set of up to AFSCBMAX (50) file identifiers at
01841 once. 
01842 \par
01843 Rx connection information for the related File Server is contained in a
01844 rxConnP. Volume version information is returned for synchronization purposes in
01845 a volSyncP. 
01846 \par Error Codes 
01847 EACCES The caller does not have the necessary access rights. 
01848 \n EINVAL The number of file descriptors for which status information was
01849 requested is illegal. 
01850 
01851         \subsubsection sec5-1-3-22 Section 5.1.3.22: RXAFS SetLock - Set an
01852 advisory lock on the given file identifier 
01853 
01854 \code
01855 int RXAFS SetLock(IN struct rx connection *a rxConnP, 
01856                         IN AFSFid *a fidToLockP, 
01857                         IN ViceLockType a lockType, 
01858                         OUT AFSVolSync *a volSyncP) 
01859 \endcode
01860 \par Description 
01861 [Opcode 156] Set an advisory lock on the file identified by a fidToLockP. There
01862 are two types of locks that may be specified via a lockType: LockRead and
01863 LockWrite. An advisory lock times out after AFS LOCKWAIT (5) minutes, and must
01864 be extended in order to stay in force (see RXAFS ExtendLock(), Section
01865 5.1.3.23). 
01866 \par
01867 Rx connection information for the related File Server is contained in a
01868 rxConnP. Volume version information is returned for synchronization purposes in
01869 a volSyncP. 
01870 \par Error Codes 
01871 EACCES The caller does not have the necessary access rights. 
01872 \n EINVAL An illegal lock type was specified. 
01873 \n EWOULDBLOCK The lock was already incompatibly granted to another party. 
01874 
01875         \subsubsection sec5-1-3-23 Section 5.1.3.23: RXAFS ExtendLock - Extend
01876 an advisory lock on a file 
01877 
01878 \code
01879 int RXAFS ExtendLock(IN struct rx connection *a rxConnP, 
01880                         IN AFSFid *a fidToBeExtendedP, 
01881                         OUT AFSVolSync *a volSyncP) 
01882 \endcode
01883 \par Description 
01884 [Opcode 157] Extend the advisory lock that has already been granted to the
01885 caller on the file identified by a fidToBeExtendedP. 
01886 \par
01887 Rx connection information for the related File Server is contained in a
01888 rxConnP. Volume version information is returned for synchronization purposes in
01889 a volSyncP. 
01890 \par Error Codes 
01891 EINVAL The caller does not already have the given file locked. 
01892 
01893         \subsubsection sec5-1-3-24 Section 5.1.3.24: RXAFS ReleaseLock -
01894 Release the advisory lock on a file 
01895 
01896 \code
01897 int RXAFS ReleaseLock(IN struct rx connection *a rxConnP, 
01898                         IN AFSFid *a fidToUnlockP, 
01899                         OUT AFSVolSync *a volSyncP) 
01900 \endcode
01901 \par Description 
01902 [Opcode 158] Release the advisory lock held on the file identified by a
01903 fidToUnlockP. If this was the last lock on this file, the File Server will
01904 break all existing callbacks to this file. 
01905 \par 
01906 Rx connection information for the related File Server is contained in a
01907 rxConnP. Volume version information is returned for synchronization purposes in
01908 a volSyncP. 
01909 \par Error Codes 
01910 EACCES The caller does not have the necessary access rights. 
01911 
01912         \subsubsection sec5-1-3-25 Section 5.1.3.25: RXAFS XStatsVersion - Get
01913 the version number associated with the File Server's extended statistics
01914 structure 
01915 
01916 \code
01917 int RXAFS XStatsVersion(IN struct rx connection *a rxConnP, 
01918                         OUT long *a versionNumberP) 
01919 \endcode
01920 \par Description 
01921 [Opcode 159] This call asks the File Server for the current version number of
01922 the extended statistics structures it exports (see RXAFS GetXStats(), Section
01923 5.1.3.26). The version number is placed into a versionNumberP. 
01924 \par
01925 Rx connection information for the related File Server is contained in a
01926 rxConnP. 
01927 \par Error Codes 
01928 ---No error codes generated. 
01929 
01930         \subsubsection sec5-1-3-26 Section 5.1.3.26: RXAFS GetXStats - Get the
01931 current contents of the specified extended statistics structure 
01932 
01933 \code
01934 int RXAFS GetXStats(IN struct rx connection *a rxConnP, 
01935                         IN long a clientVersionNumber, 
01936                         IN long a collectionNumber, 
01937                         OUT long *a srvVersionNumberP, 
01938                         OUT long *a timeP, 
01939                         OUT AFS CollData *a dataP) 
01940 \endcode
01941 \par Description 
01942 [Opcode 160] This function fetches the contents of the specified File Server
01943 extended statistics structure. The caller provides the version number of the
01944 data it expects to receive in a clientVersionNumber. Also provided in a
01945 collectionNumber is the numerical identifier for the desired data collection.
01946 There are currently two of these data collections defined: AFS XSTATSCOLL CALL
01947 INFO, which is the list of tallies of the number of invocations of internal
01948 File Server procedure calls, and AFS XSTATSCOLL PERF INFO, which is a list of
01949 performance-related numbers. The precise contents of these collections are
01950 described in Sections 5.1.2.7. The current version number of the File Server
01951 collections is returned in a srvVersionNumberP, and is always set upon return,
01952 even if the caller has asked for a difierent version. If the correct version
01953 number has been specified, and a supported collection number given, then the
01954 collection data is returned in a dataP. The time of collection is also
01955 returned, being placed in a timeP. 
01956 \par
01957 Rx connection information for the related File Server is contained in a
01958 rxConnP. 
01959 \par Error Codes 
01960 ---No error codes are generated. 
01961 
01962         \subsection sec5-1-4 Section 5.1.4: Streamed Function Calls 
01963 
01964 \par
01965 There are two streamed functions in the File Server RPC interface, used to
01966 fetch and store arbitrary amounts of data from a file. While some non-streamed
01967 calls pass such variable-length objects as struct AFSCBFids, these objects have
01968 a pre-determined maximum size. 
01969 \par
01970 The two streamed RPC functions are also distinctive in that their single Rxgen
01971 declarations generate not one but two client-side stub routines. The first is
01972 used to ship the IN parameters off to the designated File Server, and the
01973 second to gather the OUT parameters and the error code. If a streamed
01974 definition declares a routine named X YZ(), the two resulting stubs will be
01975 named StartX YZ() and EndX YZ(). It is the application programmer's job to
01976 first invoke StartX YZ(), then manage the unbounded data transfer, then finish
01977 up by calling EndX YZ(). The first longword in the unbounded data stream being
01978 fetched from a File Server contains the number of data bytes to follow. The
01979 application then reads the specified number of bytes from the stream. 
01980 \par
01981 The following sections describe the four client-side functions resulting from
01982 the Fetch-Data() and StoreData() declarations in the Rxgen interface definition
01983 file. These are the actual routines the application programmer will include in
01984 the client code. For reference, here are the interface definitions that
01985 generate these functions. Note that the split keyword is what causes Rxgen to
01986 generate the separate start and end routines. In each case, the number after
01987 the equal sign specifies the function's identifying opcode number. The opcode
01988 is passed to the File Server by the StartRXAFS FetchData() and StartRXAFS
01989 StoreData() stub routines. 
01990 
01991 \code
01992 FetchData(IN AFSFid *a_fidToFetchP, 
01993                 IN long a_offset, 
01994                 IN long a_lenInBytes, 
01995                 OUT AFSFetchStatus *a_fidStatP, 
01996                 OUT AFSCallBack *a_callBackP, 
01997                 OUT AFSVolSync *a_volSyncP) split = 130; 
01998 
01999 StoreData(IN AFSFid *Fid, 
02000                 IN AFSStoreStatus *InStatus, 
02001                 IN long Pos, 
02002                 IN long Length, 
02003                 IN long FileLength, 
02004                 OUT AFSFetchStatus *OutStatus, 
02005                 OUT AFSVolSync *a_volSyncP) split = 133; 
02006 \endcode
02007 
02008         \subsubsection sec5-1-4-1 Section 5.1.4.1: StartRXAFS FetchData - Begin
02009 a request to fetch file data 
02010 
02011 \code
02012 int StartRXAFS FetchData(IN struct rx call *a rxCallP, 
02013                                 IN AFSFid *a fidToFetchP, 
02014                                 IN long a offset, 
02015                                 IN long a lenInBytes) 
02016 \endcode
02017 
02018 \par Description
02019 Begin a request for a lenInBytes bytes of data starting at byte offset a offset
02020 from the file identified by a fidToFetchP. After successful completion of this
02021 call, the data stream will make the desired bytes accessible. The first
02022 longword in the stream contains the number of bytes to actually follow. 
02023 \par
02024 Rx call information to the related File Server is contained in a rxCallP. 
02025 \par Error Codes 
02026 ---No error codes generated. 
02027 
02028         \subsubsection sec5-1-4-2 Section 5.1.4.2: EndRXAFS FetchData -
02029 Conclude a request to fetch file data 
02030 
02031 \code
02032 int EndRXAFS FetchData(IN struct rx call *a rxCallP, 
02033                         OUT AFSFetchStatus *a fidStatP, 
02034                         OUT AFSCallBack *a callBackP, 
02035                         OUT AFSVolSync *a volSyncP) 
02036 \endcode
02037 \par Description
02038 Conclude a request to fetch file data, as commenced by an StartRXAFS
02039 FetchData() invocation. By the time this routine has been called, all of the
02040 desired data has been read off the data stream. The status fields for the file
02041 from which the data was read are stored in a fidStatP. If the file was from a
02042 read/write volume, its callback information is placed in a callBackP. 
02043 \par
02044 Rx call information to the related File Server is contained in a rxCallP.
02045 Volume version information is returned for synchronization purposes in a
02046 volSyncP. 
02047 \par Error Codes 
02048 EACCES The caller does not have the necessary access rights. EIO Given file
02049 could not be opened or statted on the File Server, or there was an error
02050 reading the given data off the File Server's disk. 
02051 \n -31 An Rx write into the stream ended prematurely. 
02052 
02053         \subsubsection sec5-1-4-3 Section 5.1.4.3: StartRXAFS StoreData - Begin
02054 a request to store file data 
02055 
02056 \code
02057 int StartRXAFS StoreData(IN struct rx call *a rxCallP, 
02058                                 IN AFSFid *a fidToStoreP, 
02059                                 IN reStatus *a fidStatusP, 
02060                                 IN AFSStolong a offset, 
02061                                 IN long a lenInBytes, 
02062                                 IN long a fileLenInBytes) 
02063 \endcode
02064 \par Description
02065 Begin a request to write a lenInBytes of data starting at byte offset a offset
02066 to the file identified by a fidToStoreP, causing that file's length to become a
02067 fileLenInBytes bytes. After successful completion of this call, the data stream
02068 will be ready to begin accepting the actual data being written. 
02069 \par
02070 Rx call information to the related File Server is contained in a rxCallP. 
02071 \par Error Codes 
02072 ---No error codes generated. 
02073 
02074         \subsubsection sec5-1-4-4 Section 5.1.4.4: EndRXAFS StoreData -
02075 Conclude a request to store file data 
02076 
02077 \code
02078 int EndRXAFS StoreData(IN struct rx call *a rxCallP, 
02079                         OUT AFSFetchStatus *a fidStatP, 
02080                         OUT AFSCallBack *a callBackP, 
02081                         OUT AFSVolSync *a volSyncP) 
02082 \endcode
02083 \par Description 
02084 Conclude a request to store file data, as commenced by a StartRXAFS StoreData()
02085 invocation. By the time this routine has been called, all of the file data has
02086 been inserted into the data stream. The status fields for the file to which the
02087 data was written are stored in a fidStatP. All existing callbacks to the given
02088 file are broken before the store concludes. 
02089 \par
02090 Rx call information to the related File Server is contained in a rxCallP.
02091 Volume version information is returned for synchronization purposes in a
02092 volSyncP. 
02093 \par Error Codes 
02094 EACCES The caller does not have the necessary access rights. 
02095 \n EISDIR The file being written to is a symbolic link. 
02096 \n ENOSPEC A write to the File Server's file on local disk failed. 
02097 \n -32 A short read was encountered by the File Server on the data stream. 
02098 
02099         \subsection sec5-1-5 Section 5.1.5: Example of Streamed Function Call
02100 Usage 
02101 
02102         \subsubsection sec5-1-5-1 Section 5.1.5.1: Preface 
02103 
02104 \par
02105 The following code fragment is offered as an example of how to use the streamed
02106 File Server RPC calls. In this case, a client fetches some amount of data from
02107 the given File Server and writes it to a local file it uses to cache the
02108 information. For simplicity, many issues faced by a true application programmer
02109 are not addressed here. These issues include locking, managing file chunking,
02110 data version number mismatches, volume location, Rx connection management,
02111 defensive programming (e.g., checking parameters before using them),
02112 client-side cache management algorithms, callback management, and full error
02113 detection and recovery. Pseudocode is incorporated when appropriate to keep the
02114 level of detail reasonable. For further descriptions of some of these details
02115 and issues, the reader is referred to such companion documents as AFS-3
02116 Programmer's Reference: Specification for the Rx Remote Procedure Call
02117 Facility, AFS-3 Programmer's Reference:Volume Server/Volume Location Server
02118 Interface, and AFS-3 Programmer's Reference: Architectural Overview. 
02119 \par
02120 A discussion of the methods used within the example code fragment follows
02121 immediately afterwards in Section 5.1.5.3. 
02122 
02123         \subsubsection sec5-1-5-2 Section 5.1.5.2: Code Fragment Illustrating
02124 Fetch Operation 
02125 
02126 \code
02127 int code; /*Return code*/ 
02128 long bytesRead; /*Num bytes read from Rx*/ 
02129 struct myConnInfo *connP; /*Includes Rx conn info*/ 
02130 struct rx_call *rxCallP; /*Rx call ptr*/ 
02131 struct AFSFid *afsFidP; /*Fid for file to fetch*/ 
02132 int lclFid; /*Fid for local cache file*/ 
02133 long offsetBytes; /*Starting fetch offset*/ 
02134 long bytesToFetch; /*Num bytes to fetch*/ 
02135 long bytesFromFS; /*Num bytes FileServer returns*/ 
02136 char *fetchBuffP; /*Buffer to hold stream data*/ 
02137 int currReadBytes; /*Num bytes for current read*/ 
02138 /* 
02139 * Assume that connP, afsFidP, offsetBytes, lclFid,and 
02140 * bytesToFetch have all been given their desired values. 
02141 */ . . . 
02142 rxCallP = rx_NewCall(connP->rxConnP); 
02143 code = StartRXAFS_FetchData( rxCallP, /*Rx call to use*/ 
02144                         afsFidP, /*Fid being fetched from*/ 
02145                         offsetBytes, /*Offset in bytes*/ 
02146                         bytesToFetch); /*Num bytes wanted*/ 
02147 if (code == 0) 
02148 { 
02149         bytesRead = rx_Read(rxCallP, &bytesFromFS, sizeof(long)); 
02150         if (bytesRead != sizeof(long)) ExitWithError(SHORT_RX_READ); 
02151         bytesFromFS = ntohl(bytesFromFS); 
02152         xmitBuffer = malloc(FETCH_BUFF_BYTES); 
02153         lclFid = open(CacheFileName, O_RDWR, mode); 
02154         pos = lseek(lclFid, offsetBytes, L_SET); 
02155         while (bytesToFetch > 0) { 
02156                 currReadBytes = (bytesToFetch > FETCH_BUFF_BYTES) ?  
02157                                 FETCH_BUFF_BYTES : bytesToFetch; 
02158                 bytesRead = rx_Read(rxCallP, fetchBuffP, currReadBytes); 
02159                 if (bytesRead != currReadBytes) ExitWithError(SHORT_RX_READ); 
02160                 code = write(lclFid, fetchBuffP, currReadBytes); 
02161                 if (code) ExitWithError(LCL_WRITE_FAILED); 
02162                 bytesToFetch -= bytesRead; 
02163         } /*Read from the Rx stream*/ 
02164         close(lclFid); 
02165 } else ExitWithError(code); 
02166 code = EndRXAFS_FetchData( rxCallP, /*Rx call to use*/ 
02167                                 fidStatP, /*Resulting stat fields*/ 
02168                                 fidCallBackP, /*Resulting callback info*/ 
02169                                 volSynchP); /*Resulting volume sync info*/ 
02170                                 code = rx_EndCall(rxCallP, code); 
02171 return(code); . . . 
02172 \endcode
02173 
02174         \subsubsection sec5-1-5-3 Section 5.1.5.3: Discussion and Analysis 
02175 
02176 \par
02177 The opening assumption in this discussion is that all the information required
02178 to do the fetch has already been set up. These mandatory variables are the
02179 client-side connection information for the File Server hosting the desired
02180 file, the corresponding AFS file identifier, the byte offset into the file, the
02181 number of bytes to fetch, and the identifier for the local file serving as a
02182 cached copy. 
02183 \par
02184 Given the Rx connection information stored in the client's connP record, rx
02185 NewCall() is used to create a new Rx call to handle this fetch operation. The
02186 structure containing this call handle is placed into rxCallP. This call handle
02187 is used immediately in the invocation of StartRXAFS FetchData(). If this setup
02188 call fails, the fragment exits. Upon success, though, the File Server will
02189 commence writing the desired data into the Rx data stream. The File Server
02190 first writes a single longword onto the stream announcing to the client how
02191 many bytes of data will actually follow. The fragment reads this number with
02192 its first rx Read() call. Since all Rx stream data is written in network byte
02193 order, the fragment translates the byte count to its own host byte order first
02194 to properly interpret it. Once the number of bytes to appear on the stream is
02195 known, the client code proceeds to open the appropriate cache file on its own
02196 local disk and seeks to the appropriate spot within it. A buffer into which the
02197 stream data will be placed is also created at this time. 
02198 \par
02199 The example code then falls into a loop where it reads all of the data from the
02200 File Server and stores it in the corresponding place in the local cache file.
02201 For each iteration, the code decides whether to read a full buffer's worth or
02202 the remaining number of bytes, whichever is smaller. After all the data is
02203 pulled off the Rx stream, the local cache file is closed. At this point, the
02204 example finishes off the RPC by calling EndRXAFS FetchData(). This gathers in
02205 the required set of OUT parameters, namely the status fields for the file just
02206 fetched, callback and volume synchronization information, and the overall error
02207 code for the streamed routine. The Rx call created to perform the fetch is then
02208 terminated and cleaned up by invoking rx EndCall(). 
02209 
02210         \subsection sec5-1-6 Section 5.1.6: Required Caller Functionality 
02211 
02212 \par
02213 The AFS File Server RPC interface was originally designed to interact only with
02214 Cache Manager agents, and thus made some assumptions about its callers. In
02215 particular, the File Server expected that the agents calling it would
02216 potentially have stored callback state on file system objects, and would have
02217 to be periodically pinged in order to garbage-collect its records, removing
02218 information on dead client machines. Thus, any entity making direct calls to
02219 this interface must mimic certain Cache Manager actions, and respond to certain
02220 Cache Manager RPC interface calls. 
02221 \par
02222 To be safe, any application calling the File Server RPC interface directly
02223 should export the entire Cache Manager RPC interface. Realistically, though, it
02224 will only need to provide stubs for the three calls from this interface that
02225 File Servers know how to make: RXAFSCB InitCallBackState(), RXAFSCB Probe() and
02226 RXAFSCB CallBack(). The very first File Server call made by this application
02227 will prompt the given File Server to call RXAFSCB InitCallBackState(). This
02228 informs the application that the File Server has no record of its existence and
02229 hence this "Cache Manager" should clear all callback information for that
02230 server. Once the application responds positively to the inital RXAFSCB
02231 InitCallBackState(), the File Server will treat it as a bona fide,
02232 fully-fledged Cache Manager, and probe it every so often with RXAFSCB Probe()
02233 calls to make sure it is still alive. 
02234 
02235         \section sec5-2 Section 5.2: Signal Interface 
02236 
02237 \par
02238 While the majority of communication with AFS File Servers occurs over the RPC
02239 interface, some important operations are invoked by sending unix signals to the
02240 process. This section describes the set of signals recognized by the File
02241 Server and the actions they trigger upon receipt, as summarized below: 
02242 \li SIGQUIT: Shut down a File Server. 
02243 \li SIGTSTP: Upgrade debugging output level. 
02244 \li SIGHUP: Reset debugging output level. 
02245 \li SIGTERM: Generate debugging output specifically concerning open files
02246 within the File Server process. 
02247 
02248         \subsection sec5-2-1 Section 5.2.1: SIGQUIT: Server Shutdown 
02249 
02250 \par
02251 Upon receipt of this signal, the File Server shuts itself down in an orderly
02252 fashion. It first writes a message to the console and to its log file
02253 (/usr/afs/logs/FileLog) stating that a shutdown has commenced. The File Server
02254 then flushes all modified buffers and prints out a set of internal statistics,
02255 including cache and disk numbers. Finally, each attached volume is taken
02256 offline, which means the volume header is written to disk with the appropriate
02257 bits set. 
02258 \par
02259 In typical usage, human operators do not send the SIGQUIT signal directly to
02260 the File Server in order to affect an orderly shutdown. Rather, the BOS Server
02261 managing the server processes on that machine issues the signal upon receipt of
02262 a properly-authorized shutdown RPC request. 
02263 
02264         \subsection sec5-2-2 Section 5.2.2: SIGTSTP: Upgrade Debugging Level 
02265 
02266 \par
02267 Arrival of a SIGTSTP signal results in an increase of the debugging level used
02268 by the File Server. The routines used for writing to log files are sensitive to
02269 this debugging level, as recorded in the global LogLevel variable.
02270 Specifically, these routines will only generate output if the value of LogLevel
02271 is greater than or equal to the value of its threshold parameter. By default,
02272 the File Server sets LogLevel to zero upon startup. If a SIGTSTP signal is
02273 received when the debugging level is zero, it will be bumped to 1. If the
02274 signal arrives when the debugging level is positive, its value will be
02275 multiplied by 5. Thus, as more SIGTSTPs are received, the set of debugging
02276 messages eligible to be delivered to log files grows. 
02277 \par
02278 Since the SIGTSTP signal is not supported under IBM's AIX 2.2.1 operating
02279 system, this form of debugging output manipulation is not possible on those
02280 platforms. 
02281 
02282         \subsection sec5-2-3 Section 5.2.3: SIGHUP: Reset Debugging Level 
02283 
02284 \par
02285 Receiving a SIGHUP signal causes a File Server to reset its debugging level to
02286 zero. This effectively reduces the set of debugging messages eligible for
02287 delivery to log files to a bare minimum. This signal is used in conjunction
02288 with SIGTSTP to manage the verbosity of log information. 
02289 \par
02290 Since the SIGHUP signal is not supported under IBM's AIX 2.2.1 operating
02291 system, this form of debugging output manipulation is not possible on those
02292 platforms. 
02293 
02294         \subsection sec5-2-4 Section 5.2.4: SIGTERM: File Descriptor Check 
02295 
02296 \par
02297 Receipt of a SIGTERM signal triggers a routine which sweeps through the given
02298 File Server's unix file descriptors. For each possible unix fid slot, an
02299 fstat() is performed on that descriptor, and the particulars of each open file
02300 are printed out. This action is designed solely for debugging purposes. 
02301 
02302         \section sec5-3 Section 5.3: Command Line Interface 
02303 
02304 \par
02305 Another interface exported by the File Server is the set of command line
02306 switches it accepts. Using these switches, many server parameters and actions
02307 can be set. Under normal conditions, the File Server process is started up by
02308 the BOS Server on that machine, as described in AFS-3 Programmer's Reference:
02309 BOS Server Interface. So, in order to utilize any combination of these
02310 command-line options, the system administrator must define the File Server
02311 bnode in such a way that these parameters are properly included. Note that the
02312 switch names must be typed exactly as listed, and that abbreviations are not
02313 allowed. Thus, specifying -b 300 on the command line is unambiguous, directing
02314 that 300 buffers are to be allocated. It is not an abbreviation for the -banner
02315 switch, asking that a message is to be printed to the console periodically. 
02316 \par
02317 A description of the set of currently-supported command line switches follows. 
02318 \li -b <# buffers> Choose the number of 2,048-byte data buffers to allocate at
02319 system startup. If this switch is not provided, the File Server will operate
02320 with 70 such buffers by default. 
02321 \li -banner This switch instructs the File Server to print messages to the
02322 console every 10 minutes to demonstrate it is still running correctly. The text
02323 of the printed message is: File Server is running at <time>. 
02324 \li -cb <# callbacks stored> Specify the maximum number of callback records
02325 stored simultaneously by the File Server. The default pool size is 20,000
02326 records. 
02327 \li -d <debug level> Set the debugging output level at which File Server runs
02328 to the value provided. Specifically, the LogLevel global variable is set to the
02329 given value (See Section 5.2.2). If this switch is not provided, the default
02330 initial File Server debugging level is set to zero, producing the minimal
02331 debugging output to the log files. 
02332 \li -k <stack size> Set the stack size to provide server LWPs upon creation,
02333 measured in 1,024-byte blocks. The default LWP stack size is 24 blocks, or
02334 24,576 bytes. 
02335 \li -l <large (directory) vnodes> Select the number of "large" vnodes the File
02336 Server will cache. These vnodes are suitable for recording information about
02337 AFS directories. The extra space in the vnode allows ACL information to be
02338 stored along with the directory. The default allocation value is 200 directory
02339 vnodes. 
02340 \li -pctspare <percent overrun blocks past quota> Similar to the -spare switch,
02341 except that the number of allowable overrun blocks is expressed as a percentage
02342 of the given volume's quota. Note: this switch cannot be used in combination
02343 with the -spare switch. 
02344 \li -rxdbg Instruct the File Server to open a file named rx dbg in the current
02345 directory, into which the Rx package will write general debugging information.
02346 If the file is already open (due to the appearance of the -rxdbge switch
02347 earlier in the command line), this results in a no-op. 
02348 \li -rxdbge Instruct the File Server to open a file named rx dbg in the current
02349 directory, into which the Rx package will write debugging information related
02350 to its event-scheduling activities. If the file is already open (due to the
02351 appearance of the -rxdbg switch earlier in the command line), this results in a
02352 no-op. 
02353 \li -rxpck <# packets> Set the number of extra Rx packet buffers to hold in
02354 reserve. These pre-allocated buffers assist in responding to spikes in network
02355 traffic demands. By default, 100 such packet buffers are maintained. 
02356 \li -s <small (file) vnodes> Select the number of "small" vnodes the File
02357 Server will cache. These vnodes are suitable for recording information about
02358 non-directory files. As with directory vnodes, the File Server will allocate
02359 200 small vnodes by default. 
02360 \li -spare <# overrun blocks to allow> Tell the File Server to allow users
02361 performing a store operation to overrun the host volume's disk quota by a
02362 certain number of (1,024-byte) blocks. In other words, the first store
02363 resulting in a quota overrun will be allowed to succeed if and only if it uses
02364 no more than these many blocks beyond the quota. Further store operations will
02365 be rejected until the volume's storage is once again reduced below quota. By
02366 default, overruns of 1,024 blocks of 1,024 bytes each (1 megabyte total) are
02367 tolerated. Note: this switch cannot be used in combination with the -pctspare
02368 switch. 
02369 \li -w <callback wait interval in seconds> This switch determines how often the
02370 File Server periodic daemon lightweight processes run. Among other things,
02371 these daemon LWPs check on the validity of callback records, keep disk usage
02372 statistics up to date, and check the health of the various client machines that
02373 have previously interacted with the File Server. For a full description of
02374 these daemon LWPs, consult Section 2.3. The associated argument specifies the
02375 number of seconds to sleep between daemon invocations. By default, these
02376 periodic daemons run every 300 seconds (5 minutes). 
02377 
02378         \page chap6 Chapter 6: Cache Manager Interfaces 
02379 
02380         \section sec6-1 Section 6.1: Overview 
02381 
02382 \par
02383 There are several interfaces offered by the Cache Manager, allowing clients to
02384 access the files stored by the community of AFS File Servers, to configure the
02385 Cache Manager's behavior and resources, to store and retrieve authentication
02386 information, to specify the location of community Authentication Server and
02387 Volume Location Server services, and to observe and debug the Cache Manager's
02388 state and actions. This chapter will cover the following five interfaces to the
02389 Cache Manager: 
02390 \li     ioctl(): The standard unix ioctl() system call has been extended to
02391 include more operations, namely waiting until data stores to a File Server
02392 complete before returning to the caller (VIOCCLOSEWAIT) and getting the name of
02393 the cell in which an open file resides (VIOCIGETCELL). 
02394 \li     pioctl(): An additional system call is provided through which
02395 applications can access operations specific to AFS, which are often tied to a
02396 particular pathname. These operations include Access Control List (ACL) and
02397 mount point management, Kerberos ticket management, cache configuration, cell
02398 configuration, and status of File Servers. 
02399 \li     RPC: Interface by which outside servers and investigators can
02400 manipulate the Cache Manager. There are two main categories of routines:
02401 callback management, typically called by the File Server, and
02402 debugging/statistics, called by programs such as cmdebug and via the xstat
02403 user-level library for collection of extended statistics. 
02404 \li     Files: Much of the Cache Manager's configuration information, as well
02405 as its view of the AFS services available from the outside world, is obtained
02406 from parsing various files. One set of these files is typically located in
02407 /usr/vice/etc, and includes CellServDB, ThisCell, and cacheinfo. Another set is
02408 usually found in /usr/vice/cache, namely CacheItems, VolumeItems, and AFSLog. 
02409 \li     Mariner: This is the interface by which file transfer activity between
02410 the Cache Manager and File Servers may be monitored. Specifically, it is used
02411 to monitor the names of the files and directories being fetched and/or stored
02412 over the network. 
02413 \par
02414 Another important component not described in this document is the afsd program.
02415 It is afsd's job to initialize the Cache Manager on a given machine and to
02416 start up its related daemon threads. It accepts a host of configuration
02417 decisions via its command-line interface. In addition, it parses some of the
02418 information kept in the configuration files mentioned above and passes that
02419 information to the Cache Manager. The reader may find a full description of
02420 afsd in the AFS 3.0 Command Reference Manual[2]. 
02421 
02422         \section sec6-2 Section 6.2: Definitions 
02423 
02424 \par
02425 This section defines data structures that are used by the pioctl() calls. 
02426 
02427         \subsection sec6-2-1 Section 6.2.1: struct VenusFid 
02428 
02429 \par
02430 The Cache Manager is the sole active AFS agent aware of the cellular
02431 architecture of the system. Since AFS file identifiers are not guaranteed to be
02432 unique across cell boundaries, it must further qualify them for its own
02433 internal bookkeeping. The struct VenusFid provides just such additional
02434 qualification, attaching the Cache Manager's internal cell identifier to the
02435 standard AFS fid. 
02436 \n \b Fields 
02437 \li long Cell - The internal identifier for the cell in which the file resides. 
02438 \li struct ViceFid Fid - The AFS file identifier within the above cell. 
02439 
02440         \subsection sec6-2-2 Section 6.2.2: struct ClearToken 
02441 
02442 \par
02443 This is the clear-text version of an AFS token of identity. Its fields are
02444 encrypted into the secret token format, and are made easily available to the
02445 Cache Manager in this structure. 
02446 \n \b Fields 
02447 \li long AuthHandle - Key version number. 
02448 \li char HandShakeKey[8] - Session key. 
02449 \li long ViceId - Identifier for the AFS principal represented by this token. 
02450 \li long BeginTimestamp - Timestamp of when this token was minted, and hence
02451 came into effect. 
02452 \li long EndTimestamp - Timestamp of when this token is considered to be
02453 expired, and thus disregarded. 
02454 
02455         \section sec6-3 Section 6.3: ioctl() Interface 
02456 
02457 \par
02458 The standard unix ioctl() system call performs operations on file system
02459 objects referenced with an open file descriptor. AFS has augmented this system
02460 call with two additional operations, one to perform "safe stores", and one to
02461 get the name of the cell in which a file resides. A third ioctl() extension is
02462 now obsolete, namely aborting a store operation currently in progress. 
02463 
02464         \subsection sec6-3-1 Section 6.3.1: VIOCCLOSEWAIT 
02465 
02466 \par
02467 [Opcode 1] Normally, a client performing a unix close() call on an AFS file
02468 resumes once the store operation on the given file data to the host File Server
02469 has commenced but before it has completed. Thus, it is possible that the store
02470 could actually fail (say, because of network partition or server crashes)
02471 without the client's knowledge. This new ioctl opcode specifies to the Cache
02472 Manager that all future close() operations will wait until the associated store
02473 operation to the File Server has completed fully before returning. 
02474 
02475         \subsection sec6-3-2 Section 6.3.2: VIOCABORT 
02476 
02477 \par
02478 [Opcode 2] This ioctl() extension is now obsolete. This call results in a noop.
02479 The original intention of this call was to allow a store operation currently in
02480 progress to a File Server on the named fid to be aborted. 
02481 
02482         \subsection sec6-3-3 Section 6.3.3: VIOIGETCELL 
02483 
02484 \par
02485 [Opcode 3] Get the name of the cell in which the given fid resides. If the file
02486 is not an AFS file, then ENOTTY is returned. The output buffer specified in the
02487 data area must be large enough to hold the null-terminated string representing
02488 the file's cell, otherwise EFAULT is returned. However, an out size value of
02489 zero specifies that the cell name is not to be copied into the output buffer.
02490 In this case, the caller is simply interested in whether the file is in AFS,
02491 and not its exact cell of residence. 
02492 
02493         \section sec6-4 Section 6.4: pioctl() Interface 
02494 
02495         \subsection sec6-4-1 Section 6.4.1: Introduction 
02496 
02497 \par
02498 There is a new unix system call, pioctl(), which has been defined especially to
02499 support the AFS Cache Manager. Its functional definition is as follows: 
02500 \code
02501 int afs syscall pioctl(IN char *a pathP, 
02502                         IN int a opcode, 
02503                         IN struct ViceIoctl *a paramsP, 
02504                         IN int a followSymLinks) 
02505 \endcode
02506 \par
02507 This new call is much like the standard ioctl() call, but differs in that the
02508 affected file (when applicable) is specified by its path, not by a file
02509 descriptor. Another difference is the fourth parameter, a followSymLinks,
02510 determines which file should be used should a pathP be a symbolic link. If a
02511 followSymLinks be set to 1, then the symbolic link is followed to its target,
02512 and the pioctl() is applied to that resulting file. If a followSymLinks is set
02513 to 0, then the pioctl() applies to the symbolic link itself. 
02514 \par
02515 Not all pioctl() calls affect files. In those cases, the a pathP parameter
02516 should be set to a null pointer. The second parameter to pioctl(), a opcode,
02517 specifies which operation is to be performed. The opcode for each of these
02518 operations is included in the text of the description. Note that not all
02519 pioctl() opcodes are in use. These unused values correspond to obsolete
02520 operations. 
02521 \par
02522 The descriptions that follow identify some of the possible error codes for each
02523 pioctl() opcode, but do not offer a comprehensive lists. All pioctl() calls
02524 return 0 upon success. 
02525 \par
02526 The rest of this section proceeds to describe the individual opcodes available.
02527 First, though, one asymmetry in this opcode set is pointed out, namely that
02528 while various operations are defined on AFS mount points, there is no direct
02529 way to create a mount point. 
02530 \par
02531 This documentation partitions the pioctl() into several groups: 
02532 \li Volume operations 
02533 \li File Server operations 
02534 \li Cell Operations 
02535 \li Authentication Operations 
02536 \li ACL Operations 
02537 \li Cache operations 
02538 \li Miscellaneous operations 
02539 
02540 \par
02541 For all pioctl()s, the fields within the a paramsP parameter will be referred
02542 to directly. Thus, the values of in, in size, out, and out size are discussed,
02543 rather than the settings for a paramsP->in, a paramsP->in size, a paramsP->out,
02544 and a paramsP->out size. 
02545 \par
02546 For convenience of reference, a list of the actively-supported pioctl()s, their
02547 opcodes, and brief description appears (in opcode order) below. 
02548 \li [1] VIOCSETAL : Set the ACL on a directory 
02549 \li [2] VIOCGETAL : Get the ACL for a directory 
02550 \li [3] VIOCSETTOK : Set the caller's token for a cell 
02551 \li [4] VIOCGETVOLSTAT : Get volume status 
02552 \li [5] VIOCSETVOLSTAT : Set volume status 
02553 \li [6] VIOCFLUSH : Flush an object from the cache 
02554 \li [8] VIOCGETTOK : Get the caller's token for a cell 
02555 \li [9] VIOCUNLOG : Discard authentication information 
02556 \li [10] VIOCCKSERV : Check the status of one or more File Servers 
02557 \li [11] VIOCCKBACK : Mark cached volume info as stale 
02558 \li [12] VIOCCKCONN : Check caller's tokens/connections 
02559 \li [14] VIOCWHEREIS : Find host(s) for a volume 
02560 \li [20] VIOCACCESS : Check caller's access on object 
02561 \li [21] VIOCUNPAG : See [9] VIOCUNLOG 
02562 \li [22] VIOCGETFID : Get fid for named object 
02563 \li [24] VIOCSETCACHESIZE : Set maximum cache size in blocks 
02564 \li [25] VIOCFLUSHCB : Unilaterally drop a callback 
02565 \li [26] VIOCNEWCELL : Set cell service information 
02566 \li [27] VIOCGETCELL : Get cell configuration entry 
02567 \li [28] VIOCAFS DELETE MT PT : Delete a mount point 
02568 \li [29] VIOC AFS STAT MT PT : Get the contents of a mount point 
02569 \li [30] VIOC FILE CELL NAME : Get cell hosting a given object 
02570 \li [31] VIOC GET WS CELL : Get caller's home cell name 
02571 \li [32] VIOC AFS MARINER HOST : Get/set file transfer monitoring output 
02572 \li [33] VIOC GET PRIMARY CELL : Get the caller's primary cell 
02573 \li [34] VIOC VENUSLOG : Enable/disable Cache Manager logging 
02574 \li [35] VIOC GETCELLSTATUS : Get status info for a cell entry 
02575 \li [36] VIOC SETCELLSTATUS : Set status info for a cell entry 
02576 \li [37] VIOC FLUSHVOLUME : Flush cached data from a volume 
02577 \li [38] VIOC AFS SYSNAME : Get/set the @sys mapping 
02578 \li [39] VIOC EXPORTAFS : Enable/disable NFS/AFS translation 
02579 \li [40] VIOCGETCACHEPARAMS : Get current cache parameter values 
02580 
02581         \subsection sec6-4-2 Section 6.4.2: Mount Point Asymmetry 
02582 
02583 \par
02584 There is an irregularity which deserves to be mentioned regarding the pioctl()
02585 interface. There are pioctl() operations for getting information about a mount
02586 point (VIOC AFS STAT MT PT) and for deleting a mount point (VIOC AFS DELETE MT
02587 PT), but no operation for creating mount points. To create a mount point, a
02588 symbolic link obeying a particular format must be created. The first character
02589 must be either a "%" or a "#", depending on the type of mount point being
02590 created (see the discussion in Section 6.4.4.4). If the mount point carries the
02591 name of the cell explicitly, the full cell name will appear next, followed by a
02592 colon. In all cases, the next portion of the mount point is the volume name. By
02593 convention, the last character of a mount point must always be a period (".").
02594 This trailing period is not visible in the output from fs lsmount. 
02595 
02596         \subsection sec6-4-3 Section 6.4.3: Volume Operations 
02597 
02598 \par
02599 There are several pioctl() opcodes dealing with AFS volumes. It is possible to
02600 get and set volume information (VIOCGETVOLSTAT, VIOCSETVOLSTAT), discover which
02601 volume hosts a particular file system object (VIOCWHEREIS), remove all objects
02602 cached from a given volume (VIOC FLUSHVOLUME), and revalidate cached volume
02603 information (VIOCCKBACK). 
02604 
02605         \subsubsection sec6-4-3-1 Section 6.4.3.1: VIOCGETVOLSTAT: Get volume
02606 status for pathname 
02607 
02608 \par
02609 [Opcode 4] Fetch information concerning the volume that contains the file
02610 system object named by a pathP. There is no other input for this call, so in
02611 size should be set to zero. The status information is placed into the buffer
02612 named by out, if out size is set to a value of sizeof(struct VolumeStatus) or
02613 larger. Included in the volume information are the volume's ID, quota, and
02614 number of blocks used in the volume as well as the disk partition on which it
02615 resides. Internally, the Cache Manager calls the RXAFS GetVolumeInfo() RPC (See
02616 Section 5.1.3.14) to fetch the volume status. 
02617 \par
02618 Among the possible error returns, EINVAL indicates that the object named by a
02619 pathP could not be found. 
02620 
02621         \subsubsection sec6-4-3-2 Section 6.4.3.2: VIOCSETVOLSTAT: Set volume
02622 status for pathname 
02623 
02624 \par
02625 [Opcode 5] Set the status fields for the volume hosting the file system object
02626 named by a pathP. The first object placed into the input buffer in is the new
02627 status image. Only those fields that may change, namely MinQuota and MaxQuota
02628 fields, are interpreted upon receipt by the File Server, and are set to the
02629 desired values. Immediately after the struct VolumeStatus image, the caller
02630 must place the null-terminated string name of the volume involved in the input
02631 buffer. New settings for the offline message and MOTD (Message of the Day)
02632 strings may appear after the volume name. If there are no changes in the
02633 offline and/or MOTD messages, a null string must appear for that item. The in
02634 size parameter must be set to the total number of bytes so inserted, including
02635 the nulls after each string. Internally, the Cache Manager calls the RXAFS
02636 SetVolumeStatus() RPC (See Section 5.1.3.16) to store the new volume status. 
02637 \par
02638 Among the possible error returns, EINVAL indicates that the object named by a
02639 pathP could not be found. 
02640 
02641         \subsubsection sec6-4-3-3 Section 6.4.3.3: VIOCWHEREIS: Find the
02642 server(s) hosting the pathname's volume 
02643 
02644 \par
02645 [Opcode 14] Find the set of machines that host the volume in which the file
02646 system object named by a pathP resides. The input buffer in is not used by this
02647 call, so in size should be set to zero. The output buffer indicated by out is
02648 filled with up to 8 IP addresses, one for each File Server hosting the
02649 indicated volume. Thus, out size should be set to at least (8*sizeof(long)).
02650 This group of hosts is terminated by the first zeroed IP address that appears
02651 in the list, but under no circumstances are more than 8 host IP addresses
02652 returned. 
02653 \par
02654 Among the possible error returns is EINVAL, indicating that the pathname is not
02655 in AFS, hence is not contained within a volume. If ENODEV is returned, the
02656 associated volume information could not be obtained. 
02657 
02658         \subsubsection sec6-4-3-4 Section 6.4.3.4: VIOC FLUSHVOLUME: Flush all
02659 data cached from the pathname's volume 
02660 
02661 \par
02662 [Opcode 37] Determine the volume in which the file system object named by a
02663 pathP resides, and then throw away all currently cached copies of files that
02664 the Cache Manager has obtained from that volume. This call is typically used
02665 should a user suspect there is some cache corruption associated with the files
02666 from a given volume. 
02667 
02668         \subsubsection sec6-4-3-5 Section 6.4.3.5: VIOCCKBACK: Check validity
02669 of all cached volume information 
02670 
02671 \par
02672 [Opcode 11] Ask the Cache Manager to check the validity of all cached volume
02673 information. None of the call's parameters are referenced in this call, so a
02674 pathP and in should be set to the null pointer, and in size and out size should
02675 be set to zero. 
02676 \par
02677 This operation is performed in two steps: 
02678 \li 1 The Cache Manager first refreshes its knowledge of the root volume,
02679 usually named root.afs. On success, it wakes up any of its own threads waiting
02680 on the arrival of this information, should it have been previously unreachable.
02681 This typically happens should the Cache Manager discover in its startup
02682 sequence that information on the root volume is unavailable. Lacking this
02683 knowledge at startup time, the Cache Manager settles into a semi-quiescent
02684 state, checking every so often to see if volume service is available and thus
02685 may complete its own initialization. 
02686 \li 2 Each cached volume record is flagged as being stale. Any future attempt
02687 to access information from these volumes will result in the volume record's
02688 data first being refreshed from the Volume Location Server. 
02689 
02690         \subsection sec6-4-4 Section 6.4.4: File Server Operations 
02691 
02692 \par
02693 One group of pioctl() opcodes is aimed at performing operations against one or
02694 more File Servers directly. Specifically, a caller may translate a pathname
02695 into the corresponding AFS fid (VIOCGETFID), unilaterally discard a set of
02696 callback promises (VIOCFLUSHCB), get status on mount points (VIOC AFS STAT MT
02697 PT), delete unwanted mount points (VIOC AFS DELETE MT PT), and check the health
02698 of a group of File Servers(VIOCCKSERV). 
02699 
02700         \subsubsection sec6-4-4-1 Section 6.4.4.1: VIOCGETFID: Get augmented
02701 fid for named file system object 
02702 
02703 \par
02704 [Opcode 22] Return the augmented file identifier for the file system object
02705 named by a pathP. The desired struct VenusFid is placed in the output buffer
02706 specified by out. The output buffer size, as indicated by the out size
02707 parameter, must be set to the value of sizeof(struct VenusFid) or greater. The
02708 input buffer is not referenced in this call, so in should be set to the null
02709 pointer and in size set to zero. 
02710 \par
02711 Among the possible error returns, EINVAL indicates that the object named by a
02712 pathP was not found. 
02713 
02714         \subsubsection sec6-4-4-2 Section 6.4.4.2: VIOCFLUSHCB: Unilaterally
02715 drop a callback 
02716 
02717 \par
02718 [Opcode 25] Remove any callback information kept by the Cache Manager on the
02719 file system object named by a pathP. Internally, the Cache Manager executes a
02720 call to the RXAFS GiveUpCallBacks() RPC (See Section 5.1.3.13) to inform the
02721 appropriate File Server that it is being released from its particular callback
02722 promise. Note that if the named file resides on a read-only volume, then the
02723 above call is not made, and success is returned immediately. This optimization
02724 is possible because AFS File Servers do not grant callbacks on files from
02725 read-only volumes. 
02726 \par
02727 Among the possible error returns is EINVAL, which indicates that the object
02728 named by a pathP was not found. 
02729 
02730         \subsubsection sec6-4-4-3 Section 6.4.4.3: VIOC AFS DELETE MT PT:
02731 Delete a mount point 
02732 
02733 \par
02734 [Opcode 28] Remove an AFS mount point. The name of the directory in which the
02735 mount point exists is specified by a pathP, and the string name of the mount
02736 point within this directory is provided through the in parameter. The input
02737 buffer length, in size, is set to the length of the mount point name itself,
02738 including the trailing null. The output buffer is not accessed by this call, so
02739 out should be set to the null pointer and out size to zero. 
02740 \par
02741 One important note is that the a followSymLinks argument must be set to zero
02742 for correct operation. This is counter-intuitive, since at first glance it
02743 seems that a symbolic link that resolves to a directory should be a valid
02744 pathname parameter. However, recall that mount points are implemented as
02745 symbolic links that do not actually point to another file system object, but
02746 rather simply contain cell and volume information (see the description in
02747 Section 6.4.2). This "special" symbolic link must not be resolved by the
02748 pioctl(), but rather presented as-is to the Cache Manager, which then properly
02749 interprets it and generates a reference to the given volume's root directory.
02750 As an unfortunate side-effect, a perfectly valid symbolic link referring to a
02751 directory will be rejected out of hand by this operation as a value for the a
02752 pathP parameter. 
02753 \par
02754 Among the possible error returns, EINVAL reports that the named directory was
02755 not found, and ENOTDIR indicates that the pathname contained within a pathP is
02756 not a directory. 
02757 
02758         \subsubsection sec6-4-4-4 Section 6.4.4.4: VIOC AFS STAT MT PT: Get the
02759 contents of a mount point 
02760 
02761 \par
02762 [Opcode 29] Return the contents of the given mount point. The directory in
02763 which the mount point in question resides is provided via the a pathP argument,
02764 and the in buffer contains the name of the mount point object within this
02765 directory. As usual, in size is set to the length of the input buffer,
02766 including the trailing null. If the given object is truly a mount point and the
02767 out buffer is large enough (its length appears in out size), the mount point's
02768 contents are stored into out. 
02769 \par
02770 The mount point string returned obeys a stylized format, as fully described in
02771 Section 5.6.2 of the AFS 3.0 System Administrator's Guide[1]. Briefly, a
02772 leading pound sign ("#") indicates a standard mount point, inheriting the
02773 read-only or read-write preferences of the mount point's containing volume. On
02774 the other hand, a leading percent sign ("%") advises the Cache Manager to cross
02775 into the read-write version of the volume, regardless of the existence of
02776 read-only clones. If a colon (":") separator occurs, the portion up to the
02777 colon itself denotes the fully-qualified cell name hosting the volume. The rest
02778 of the string is the volume name itself. 
02779 \par
02780 Among the possible error codes is EINVAL, indicating that the named object is
02781 not an AFS mount point. Should the name passed in a pathP be something other
02782 than a directory, then ENOTDIR is returned. 
02783 
02784         \subsubsection sec6-4-4-5 Section 6.4.4.5: VIOCCKSERV: Check the status
02785 of one or more File Servers 
02786 
02787 \par
02788 [Opcode 10] Check the status of the File Servers that have been contacted over
02789 the lifetime of the Cache Manager. The a pathP parameter is ignored by this
02790 call, so it should be set to the null pointer. The input parameters as
02791 specified by in are completely optional. If something is placed in the input
02792 buffer, namely in size is not zero, then the first item stored there is a
02793 longword used as a bit array of flags. These flags carry instructions as to the
02794 domain and the "thoroughness" of this check. 
02795 \par
02796 Only the settings of the least-significant two bits are recognized. Enabling
02797 the lowest bit tells the Cache Manager not to ping its list of servers, but
02798 simply report their status as contained in the internal server records.
02799 Enabling the next-higher bit limits the search to only those File Servers in a
02800 given cell. If in size is greater than sizeof(long),a null-terminated cell name
02801 string follows the initial flag array, specifying the cell to check. If this
02802 search bit is set but no cell name string follows the longword of flags, then
02803 the search is restricted to those servers contacted from the same cell as the
02804 caller. 
02805 \par
02806 This call returns at least one longword into the output buffer out, specifying
02807 the number of hosts it discovered to be down. If this number is not zero, then
02808 the longword IP address for each dead (or unreachable) host follows in the
02809 output buffer. At most 16 server addresses will be returned, as this is the
02810 maximum number of servers for which the Cache Manager keeps information. 
02811 \par
02812 Among the possible error returns is ENOENT, indicating that the optional cell
02813 name string input value is not known to the Cache Manager. 
02814 
02815         \subsection sec6-4-5 Section 6.4.5: Cell Operations 
02816 
02817 \par
02818 The Cache Manager is the only active AFS agent that understands the system's
02819 cellular architecture. Thus, it keeps important information concerning the
02820 identities of the cells in the community, which cell is in direct
02821 administrative control of the machine upon which it is running, status and
02822 configuration of its own cell, and what cell-specific operations may be legally
02823 executed. The following pioctl()s allow client processes to access and update
02824 this cellular information. Supported operations include adding or updating
02825 knowledge of a cell, including the cell overseeing the caller's machine
02826 (VIOCNEWCELL), fetching the contents of a cell configuration entry
02827 (VIOCGETCELL), finding out which cell hosts a given file system object (VIOC
02828 FILE CELL NAME), discovering the cell to which the machine belongs (VIOC GET WS
02829 CELL), finding out the caller's "primary" cell (VIOC GET PRIMARY CELL), and
02830 getting/setting certain other per-cell system parameters (VIOC GETCELLSTATUS,
02831 VIOC SETCELLSTATUS). 
02832 
02833         \subsubsection sec6-4-5-1 Section 6.4.5.1: VIOCNEWCELL: Set cell
02834 service information 
02835 
02836 \par
02837 [Opcode 26] Give the Cache Manager all the information it needs to access an
02838 AFS cell. Exactly eight longwords are placed at the beginning of the in input
02839 buffer. These specify the IP addresses for the machine providing AFS
02840 authentication and volume location authentication services. The first such
02841 longword set to zero will signal the end of the list of server IP addresses.
02842 After these addresses, the input buffer hosts the null-terminated name of the
02843 cell to which the above servers belong. The a pathP parameter is not used, and
02844 so should be set to the null pointer. 
02845 \par
02846 Among the possible error returns is EACCES, indicating that the caller does not
02847 have the necessary rights to perform the operation. Only root is allowed to set
02848 cell server information. If either the IP address array or the server name is
02849 unacceptable, EINVAL will be returned. 
02850 
02851         \subsubsection sec6-4-5-2 Section 6.4.5.2: VIOCGETCELL: Get cell
02852 configuration entry 
02853 
02854 \par
02855 [Opcode 27] Get the i'th cell configuration entry known to the Cache Manager.
02856 The index of the desired entry is placed into the in input buffer as a
02857 longword, with the first legal value being zero. If there is a cell associated
02858 with the given index, the output buffer will be filled with an array of 8
02859 longwords, followed by a null-terminated string. 
02860 \par
02861 The longwords correspond to the list of IP addresses of the machines providing
02862 AFS authentication and volume location services. The string reflects the name
02863 of the cell for which the given machines are operating. There is no explicit
02864 count returned of the number of valid IP addresses in the longword array.
02865 Rather, the list is terminated by the first zero value encountered, or when the
02866 eighth slot is filled. 
02867 \par
02868 This routine is intended to be called repeatedly, with the index starting at
02869 zero and increasing each time. The array of cell information records is kept
02870 compactly, without holes. A return value of EDOM indicates that the given index
02871 does not map to a valid entry, and thus may be used as the terminating
02872 condition for the iteration. 
02873 
02874         \subsubsection sec6-4-5-3 Section 6.4.5.3: VIOC FILE CELL NAME: Get
02875 cell hosting a given object 
02876 
02877 \par
02878 [Opcode 30] Ask the Cache Manager to return the name of the cell in which the
02879 file system object named by a pathP resides. The input arguments are not used,
02880 so in should be set to the null pointer and in size should be set to zero. The
02881 null-terminated cell name string is returned in the out output buffer. 
02882 \par
02883 Among the possible error values, EINVAL indicates that the pathname provided in
02884 a pathP is illegal.  If there is no cell information associated with the given
02885 object, ESRCH is returned.
02886 
02887         \subsubsection sec6-4-5-4 Section 6.4.5.4: VIOC GET WS CELL: Get
02888 caller's home cell name 
02889 
02890 \par
02891 [Opcode 31] Return the name of the cell to which the caller's machine belongs.
02892 This cell name is returned as a null-terminated string in the output buffer.
02893 The input arguments are not used, so in should be set to the null pointer and
02894 in size should be set to zero. 
02895 \par
02896 Among the possible error returns is ESRCH, stating that the caller's home cell
02897 information was not available. 
02898 
02899         \subsubsection sec6-4-5-5 Section 6.4.5.5: VIOC GET PRIMARY CELL: Get
02900 the caller's primary cell 
02901 
02902 \par
02903 [Opcode 33] Ask the Cache Manager to return the name of the caller's primary
02904 cell. Internally, the Cache Manager scans its user records, and the cell
02905 information referenced by that record is used to extract the cell's string
02906 name. The input arguments are not used, so in should be set to the null pointer
02907 and in size should be set to zero. The a pathP pathname argument is not used
02908 either, and should similarly be set to the null pointer. The null-terminated
02909 cell name string is placed into the output buffer pointed to by out if it has
02910 suffcient room. 
02911 \par
02912 Among the possible error returns is ESRCH, stating that the caller's primary
02913 cell information was not available. 
02914 
02915         \subsubsection sec6-4-5-6 Section 6.4.5.6: VIOC GETCELLSTATUS: Get
02916 status info for a cell entry 
02917 
02918 \par
02919 [Opcode 35] Given a cell name, return a single longword of status flags from
02920 the Cache Manager's entry for that cell. The null-terminated cell name string
02921 is expected to be in the in parameter, with in size set to its length plus one
02922 for the trailing null. The status flags are returned in the out buffer, which
02923 must have out size set to sizeof(long) or larger. 
02924 \par
02925 The Cache Manager defines the following output flag values for this operation: 
02926 \li 0x1 This entry is considered the caller's primary cell. 
02927 \li 0x2 The unix setuid() operation is not honored. 
02928 \li 0x4 An obsolete version of the Volume Location Server's database is being
02929 used. While defined, this flag should no longer be set in modern systems. 
02930 
02931 \par
02932 Among the possible error returns is ENOENT, informing the caller that the Cache
02933 Manager has no knowledge of the given cell name. 
02934 
02935         \subsubsection sec6-4-5-7 Section 6.4.5.7: VIOC SETCELLSTATUS: Set
02936 status info for a cell entry 
02937 
02938 \par
02939 [Opcode 36] Given a cell name and an image of the cell status bits that should
02940 be set, record the association in the Cache Manager. The input buffer in must
02941 be set up as follows. The first entry is the longword containing the cell
02942 status bits to be set (see the VIOC GETCELLSTATUS description above for valid
02943 flag definitions). The next entry is another longword, ignored by the Cache
02944 Manager. The third and final entry in the input buffer is a null-terminated
02945 string containing the name of the cell for which the status flags are to be
02946 applied. 
02947 \par
02948 Among the possible error returns is ENOENT, reflecting the Cache Manager's
02949 inability to locate its record for the given cell. Only root is allowed to
02950 execute this operation, and an EACCES return indicates the caller was not
02951 effectively root when the call took place. 
02952 
02953         \subsection sec6-4-6 Section 6.4.6: Authentication Operations 
02954 
02955 \par
02956 The Cache Manager serves as the repository for authentication information for
02957 AFS clients. Each client process belongs to a single Process Authentication
02958 Group (PAG). Each process in a given PAG shares authentication information with
02959 the other members, and thus has the identical rights with respect to AFS Access
02960 Control Lists (ACLs) as all other processes in the PAG. As the Cache Manager
02961 interacts with File Servers as a client process' agent, it automatically and
02962 transparently presents the appropriate authentication information as required
02963 in order to gain the access to which the caller is entitled. Each PAG can host
02964 exactly one token per cell. These tokens are objects that unequivocally codify
02965 the principal's identity, and are encrypted for security. Token operations
02966 between a Cache Manager and File Server are also encrypted, as are the
02967 interchanges between clients and the Authentication Servers that generate these
02968 tokens. 
02969 \par
02970 There are actually two different flavors of tokens, namely clear and secret.
02971 The data structure representing clear tokens is described in Section 6.2.2, and
02972 the secret token appears as an undifferentiated byte stream. 
02973 \par
02974 This section describes the operations involving these tokens, namely getting
02975 and setting the caller's token for a particular cell (VIOCGETTOK, VIOCSETTOK),
02976 checking a caller's access on a specified file system object (VIOCACCESS),
02977 checking the status of caller's tokens associated with the set of File Server
02978 connections maintained on its behalf (VIOCCKCONN), and discarding tokens
02979 entirely (VIOCUNLOG, VIOCUNPAG). These abilities are used by such programs as
02980 login, klog, unlog, and tokens, which must generate, manipulate, and/or destroy
02981 AFS tokens. 
02982 
02983         \subsubsection sec6-4-6-1 Section 6.4.6.1: VIOCSETTOK: Set the caller's
02984 token for a cell 
02985 
02986 \par
02987 [Opcode 3] Store the caller's secret and clear tokens within the Cache Manager.
02988 The input buffer is used to hold the following quantities, laid out end to end.
02989 The first item placed in the buffer is a longword, specifying the length in
02990 bytes of the secret token, followed by the body of the secret token itself. The
02991 next field is another longword, this time describing the length in bytes of the
02992 struct ClearToken, followed by the structure. These are all required fields.
02993 The caller may optionally include two additional fields, following directly
02994 after the required ones. The first optional field is a longword which is set to
02995 a non-zero value if the cell in which these tokens were generated is to be
02996 marked as the caller's primary cell. The second optional argument is a
02997 null-terminated string specifying the cell in which these tokens apply. If
02998 these two optional arguments do not appear, the Cache Manager will default to
02999 using its home cell and marking the entry as non-primary. The a pathP pathname
03000 parameter is not used, and thus should be set to the null pointer. 
03001 \par
03002 If the caller does not have any tokens registered for the cell, the Cache
03003 Manager will store them. If the caller already has tokens for the cell, the new
03004 values will overwrite their old values. Because these are stored per PAG, the
03005 new tokens will thus determine the access rights of all other processes
03006 belonging to the PAG. 
03007 \par
03008 Among the possible error returns is ESRCH, indicating the named cell is not
03009 recognized, and EIO, if information on the local cell is not available. 
03010 
03011         \subsubsection sec6-4-6-2 Section 6.4.6.2: VIOCGETTOK: Get the caller's
03012 token for a cell 
03013 
03014 \par
03015 [Opcode 8] Get the specified authentication tokens associated with the caller.
03016 The a pathP parameter is not used, so it should be set to the null pointer.
03017 Should the input parameter in be set to a null pointer, then this call will
03018 place the user's tokens for the machine's home cell in the out output buffer,
03019 if such tokens exist. In this case, the following objects are placed in the
03020 output buffer. First, a longword specifying the number of bytes in the body of
03021 the secret token is delivered, followed immediately by the secret token itself.
03022 Next is a longword indicating the length in bytes of the clear token, followed
03023 by the clear token. The input parameter may also consist of a single longword,
03024 indicating the index of the token desired. Since the Cache Manager is capable
03025 of storing multiple tokens per principal, this allows the caller to iteratively
03026 extract the full set of tokens stored for the PAG. The first valid index value
03027 is zero. The list of tokens is kept compactly, without holes. A return value of
03028 EDOM indicates that the given index does not map to a valid token entry, and
03029 thus may be used as the terminating condition for the iteration. 
03030 \par
03031 Other than EDOM, another possible error return is ENOTCONN, specifying that the
03032 caller does not have any AFS tokens whatsoever. 
03033 
03034         \subsubsection sec6-4-6-3 Section 6.4.6.3: VIOCACCESS: Check caller's
03035 access on object 
03036 
03037 \par
03038 [Opcode 20] This operation is used to determine whether the caller has specific
03039 access rights on a particular file system object. A single longword is placed
03040 into the input buffer, in, representing the set of rights in question. The
03041 acceptable values for these access rights are listen in Section 6.4.5. The
03042 object to check is named by the a pathP parameter. The output parameters are
03043 not accessed, so out should be set to the null pointer, and out size set to
03044 zero. 
03045 If the call returns successfully, the caller has at least the set of rights
03046 denoted by the bits set in the input buffer. Otherwise, EACCESS is returned. 
03047 
03048         \subsubsection sec6-4-6-4 Section 6.4.6.4: VIOCCKCONN: Check status of
03049 caller's tokens/connections 
03050 
03051 \par
03052 [Opcode 12] Check whether the suite of File Server connections maintained on
03053 behalf of the caller by the Cache Manager has valid authentication tokens. This
03054 function always returns successfully, communicating the health of said
03055 connections by writing a single longword value to the specified output buffer
03056 in out. If zero is returned to the output buffer, then two things are true.
03057 First, the caller has tokens for at least one cell. Second, all tokens
03058 encountered upon a review of the caller's connections have been properly minted
03059 (i.e., have not been generated fraudulently), and, in addition, have not yet
03060 expired. If these conditions do not currently hold for the caller, then the
03061 output buffer value will be set to EACCES. Neither the a pathP nor input
03062 parameters are used by this call. 
03063 
03064         \subsubsection sec6-4-6-5 Section 6.4.6.5: VIOCUNLOG: Discard
03065 authentication information 
03066 
03067 \par
03068 [Opcode 9] Discard all authentication information held in trust for the caller.
03069 The Cache Manager sweeps through its user records, destroying all of the
03070 caller's associated token information. This results in reducing the rights of
03071 all processes within the caller's PAG to the level of file system access
03072 granted to the special system:anyuser group. 
03073 \par
03074 This operation always returns successfully. None of the parameters are
03075 referenced, so they should all be set to null pointers and zeroes as
03076 appropriate. 
03077 
03078         \subsubsection sec6-4-6-6 Section 6.4.6.6: VIOCUNPAG: Discard
03079 authentication information 
03080 
03081 \par
03082 [Opcode 21] This call is essentially identical to the VIOCUNLOG operation, and
03083 is in fact implemented internally by the same code for VIOCUNLOG. 
03084 
03085         \subsection sec6-4-7 Section 6.4.7: ACL Operations 
03086 
03087 \par
03088 This set of opcodes allows manipulation of AFS Access Control Lists (ACLs).
03089 Callers are allowed to fetch the ACL on a given directory, or to set the ACL on
03090 a directory. In AFS-3, ACLs are only maintained on directories, not on
03091 individual files. Thus, a directory ACL determines the allowable accesses on
03092 all objects within that directory in conjunction with their normal unix mode
03093 (owner) bits. Should the a pathP parameter specify a file instead of a
03094 directory, the ACL operation will be performed on the directory in which the
03095 given file resides. 
03096 \par
03097 These pioctl() opcodes deal only in external formats for ACLs, namely the
03098 actual text stored in an AFS ACL container. This external format is a character
03099 string, composed of a descriptive header followed by some number of individual
03100 principal-rights pairs. AFS ACLs actually specify two sublists, namely the
03101 positive and negative rights lists. The positive list catalogues the set of
03102 rights that certain principals (individual users or groups of users) have,
03103 while the negative list contains the set of rights specifically denied to the
03104 named parties. 
03105 \par
03106 These external ACL representations differ from the internal format generated by
03107 the Cache Manager after a parsing pass. The external format may be easily
03108 generated from the internal format as follows. The header format is expressed
03109 with the following printf() statement: 
03110 \code
03111 printf("%d\n%d\n", NumPositiveEntries, NumNegativeEntries); 
03112 \endcode
03113 \par
03114 The header first specifies the number of entries on the positive rights list,
03115 which appear first in the ACL body. The number of entries on the negative list
03116 is the second item in the header. The negative entries appear after the last
03117 positive entry. 
03118 \par
03119 Each entry in the ACL proper obeys the format imposed by the following printf()
03120 statement: 
03121 \code
03122 printf("%s\t%d\n", UserOrGroupName, RightsMask); 
03123 \endcode
03124 \par
03125 Note that the string name for the user or group is stored in an externalized
03126 ACL entry. The Protection Server stores the mappings between the numerical
03127 identifiers for AFS principals and their character string representations.
03128 There are cases where there is no mapping from the numerical identifier to a
03129 string name. For example, a user or group may have been deleted sometime after
03130 they were added to the ACL and before the Cache Manager externalized the ACL
03131 for storage. In this case, the Cache Manager sets UserOrGroupName to the string
03132 version of the principal's integer identifier. Should the erz principal be
03133 deleted from the Protection Server's database in the above scenario, then the
03134 string '1019' will be stored, since it corresponded to erz's former numerical
03135 identifier. 
03136 \par
03137 The RightsMask parameter to the above call represents the set of rights the
03138 named principal may exercise on the objects covered by the ACL. The following
03139 flags may be OR'ed together to construct the desired access rights placed in
03140 RightsMask: 
03141 \code
03142 #define PRSFS_READ 1 /*Read files*/ 
03143 #define PRSFS_WRITE 2 /*Write & write-lock existing files*/ 
03144 #define PRSFS_INSERT 4 /*Insert & write-lock new files*/ 
03145 #define PRSFS_LOOKUP 8 /*Enumerate files and examine ACL*/ 
03146 #define PRSFS_DELETE 16 /*Remove files*/ 
03147 #define PRSFS_LOCK 32 /*Read-lock files*/ 
03148 #define PRSFS_ADMINISTER 64 /*Set access list of directory*/ 
03149 \endcode
03150 
03151         \subsubsection sec6-4-7-1 Section 6.4.7.1: VIOCSETAL: Set the ACL on a
03152 directory 
03153 
03154 \par
03155 [Opcode 1] Set the contents of the ACL associated with the file system object
03156 named by a pathP. Should this pathname indicate a file and not a directory, the
03157 Cache Manager will apply this operation to the file's parent directory. The new
03158 ACL contents, expressed in their externalized form, are made available in in,
03159 with in size set to its length in characters, including the trailing null.
03160 There is no output from this call, so out size should be set to zero.
03161 Internally, the Cache Manager will call the RXAFS StoreACL() RPC (see Section
03162 5.1.3.3 to store the new ACL on the proper File Server. 
03163 \par
03164 Possible error codes include EINVAL, indicating that one of three things may be
03165 true: the named path is not in AFS, there are too many entries in the specified
03166 ACL, or a non-existent user or group appears on the ACL. 
03167 
03168         \subsubsection sec6-4-7-2 Section 6.4.7.2: VIOCGETAL: Get the ACL for a
03169 directory 
03170 
03171 \par
03172 [Opcode 2] Get the contents of the ACL associated with the file system object
03173 named by a pathP. Should this pathname indicate a file and not a directory, the
03174 Cache Manager will apply this operation to the file's parent directory. The ACL
03175 contents, expressed in their externalized form, are delivered into the out
03176 buffer if out size has been set to a value which indicates that there is enough
03177 room for the specified ACL. This ACL string will be null-terminated. There is
03178 no input to this call, so in size should be set to zero. Internally, the Cache
03179 Manager will call the RXAFS FetchACL() RPC (see Section 5.1.3.1) to fetch the
03180 ACL from the proper File Server. 
03181 \par
03182 Possible error codes include EINVAL, indicating that the named path is not in
03183 AFS. 
03184 
03185         \subsection sec6-4-8 Section 6.4.8: Cache Operations 
03186 
03187 \par
03188 It is possible to inquire about and affect various aspects of the cache
03189 maintained locally by the Cache Manager through the group of pioctl()s
03190 described below. Specifically, one may force certain file system objects to be
03191 removed from the cache (VIOCFLUSH), set the maximum number of blocks usable by
03192 the cache (VIOCSETCACHESIZE), and ask for information about the cache's current
03193 state (VIOCGETCACHEPARAMS). 
03194 
03195         \subsubsection sec6-4-8-1 Section 6.4.8.1: VIOCFLUSH: Flush an object
03196 from the cache 
03197 
03198 \par
03199 [Opcode 6] Flush the file system object specified by a pathP out of the local
03200 cache. The other parameters are not referenced, so they should be set to the
03201 proper combination of null pointers and zeroes. 
03202 \par
03203 Among the possible error returns is EINVAL, indicating that the value supplied
03204 in the a pathP parameter is not acceptable. 
03205 
03206         \subsubsection sec6-4-8-2 Section 6.4.8.2: VIOCSETCACHESIZE: Set
03207 maximum cache size in blocks 
03208 
03209 \par
03210 [Opcode 24] Instructs the Cache Manager to set a new maximum size (in 1 Kbyte
03211 blocks) for its local cache. The input buffer located at in contains the new
03212 maximum block count. If zero is supplied for this value, the Cache Manager will
03213 revert its cache limit to its value at startup time. Neither the a pathP nor
03214 output buffer parameters is referenced by this operation. The Cache Manager
03215 recomputes its other cache parameters based on this new value, including the
03216 number of cache files allowed to be dirty at once and the total amount of space
03217 filled with dirty chunks. Should the new setting be smaller than the number of
03218 blocks currently being used, the Cache Manager will throw things out of the
03219 cache until it obeys the new limit. 
03220 \par
03221 The caller is required to be effectively running as root, or this call will
03222 fail, returning EACCES. If the Cache Manager is configured to run with a memory
03223 cache instead of a disk cache, this operation will also fail, returning EROF. 
03224 
03225         \subsubsection sec6-4-8-3 Section 6.4.8.3: VIOCGETCACHEPARAMS: Get
03226 current cache parameter values 
03227 
03228 \par
03229 [Opcode 40] Fetch the current values being used for the cache parameters. The
03230 output buffer is filled with MAXGCSTATS (16) longwords, describing these
03231 parameters. Only the first two longwords in this array are currently set. The
03232 first contains the value of afs cacheBlocks, or the maximum number of 1 Kbyte
03233 blocks which may be used in the cache (see Section 6.4.8.2 for how this value
03234 may be set). The second longword contains the value of the Cache Manager's
03235 internal afs blocksUsed variable, or the number of these cache blocks currently
03236 in use. All other longwords in the array are set to zero. Neither the a pathP
03237 nor input buffer arguments are referenced by this call. 
03238 \par
03239 This routine always returns successfully. 
03240 
03241         \subsection sec6-4-9 Section 6.4.9: Miscellaneous Operations 
03242 
03243 \par
03244 There are several other AFS-specific operations accessible via the pioctl()
03245 interface that don't fit cleanly into the above categories. They are described
03246 in this section, and include manipulation of the socket-based Mariner file
03247 trace interface (VIOC AFS MARINER HOST), enabling and disabling of the
03248 file-based AFSLog output interface for debugging (VIOC VENUSLOG), getting and
03249 setting the value of the special @sys pathname component mapping (VIOC AFS
03250 SYSNAME), and turning the NFS-AFS translator service on and off (VIOC
03251 EXPORTAFS). 
03252 
03253         \subsubsection sec6-4-9-1 Section 6.4.9.1: VIOC AFS MARINER HOST:
03254 Get/set file transfer monitoring output 
03255 
03256 \par
03257 [Opcode 32] This operation is used to get or set the IP address of the host
03258 destined to receive Mariner output. A detailed description of the Cache Manager
03259 Mariner interface may be found in Section 6.7. 
03260 \par
03261 The input buffer located at in is used to pass a single longword containing the
03262 IP address of the machine to receive output regarding file transfers between
03263 the Cache Manager and any File Server. If the chosen host IP address is
03264 0xffffffff, the Cache Manager is prompted to turn off generation of Mariner
03265 output entirely. If the chosen host IP address is zero, then the Cache Manager
03266 will not set the Mariner host, but rather return the current Mariner host as a
03267 single longword written to the out output buffer. Any other value chosen for
03268 the host IP address enables Mariner output (if it was not already enabled) and
03269 causes all further traffic to be directed to the given machine. 
03270 \par
03271 This function always returns successfully. 
03272 
03273         \subsubsection sec6-4-9-2 Section 6.4.9.2: VIOC VENUSLOG:
03274 Enable/disable Cache Manager logging 
03275 
03276 \par
03277 [Opcode 34] Tell the Cache Manager whether to generate debugging information,
03278 and what kind of debugging output to enable. The input buffer located at in is
03279 used to transmit a single longword to the Cache Manager, expressing the
03280 caller's wishes. Of the four bytes making up the longword, the highest byte
03281 indicates the desired value for the internal afsDebug variable, enabling or
03282 disabling general trace output. The next highest byte indicates the desired
03283 value for the internal netDebug variable, enabling or disabling network-level
03284 debugging traces. The third byte is unused, and the low-order byte represents
03285 an overall on/off value for the functionality. There is a special value for the
03286 low-order byte, 99, which instructs the Cache Manager to return the current
03287 debugging setting as a single longword placed into the output buffer pointed to
03288 by out. The a pathP parameter is not referenced by this routine. 
03289 \par
03290 Trace output is delivered to the AFSLog file, typically located in the
03291 /usr/vice/etc directory. When this form of debugging output is enabled, the
03292 existing AFSLog file is truncated, and its file descriptor is stored for future
03293 use. When this debugging is disabled, a close() is done on the file, forcing
03294 all its data to disk. For additional information on the AFSLog file for
03295 collecting Cache Manager traces, please see the description in Section 6.6.2.1. 
03296 \par
03297 This call will only succeed if the caller is effectively running as root. If
03298 this is not the case, an error code of EACCES is returned. 
03299 
03300         \subsubsection sec6-4-9-3 Section 6.4.9.3: VIOC AFS SYSNAME: Get/set
03301 the @sys mapping 
03302 
03303 \par
03304 [Opcode 38] Get or set the value of the special @sys pathname component
03305 understood by the Cache Manager. The input buffer pointed to by in is used to
03306 house a longword whose value determines whether the @sys value is being set (1)
03307 or whether the current value is being fetched (0). If it is being set, then a
03308 null-terminated string is expected to follow in the input buffer, specifying
03309 the new value of @sys. Otherwise, if we are asking the Cache Manager for the
03310 current @sys setting, a null-terminated string bearing that value will be
03311 placed in the out output buffer. The a pathP parameter is not used by this
03312 call, and thus should be set to a null pointer. 
03313 \par
03314 There are no special privileges required of the caller to fetch the value of
03315 the current @sys mapping. However, a native caller must be running effectively
03316 as root in order to successfully alter the mapping. An unauthorized attempt to
03317 change the @sys setting will be ignored, and cause this routine to return
03318 EACCES. This requirement is relaxed for VIOC AFS SYSNAME pioctl() calls
03319 emanating from foreign file systems such as NFS and accessing AFS files through
03320 the NFS-AFS translator. Each such remote caller may set its own notion of what
03321 the @sys mapping is without affecting native AFS clients. Since the uid values
03322 received in calls from NFS machines are inherently insecure, it is impossible
03323 to enforce the fact that the caller is truly root on the NFS machine. This,
03324 while any principal running on an NFS machine may change that foreign machine's
03325 perception of @sys, it does not impact native AFS users in any way. 
03326 
03327         \subsubsection sec6-4-9-4 Section 6.4.9.4: VIOC EXPORTAFS:
03328 Enable/disable NFS/AFS translation 
03329 
03330 \par
03331 [Opcode 39] Enable or disable the ability of an AFS-capable machine to export
03332 AFS access to NFS clients. Actually, this is a general facility allowing
03333 exportation of AFS service to any number of other file systems, but the only
03334 support currently in place is for NFS client machines. A single longword is
03335 expected in the input buffer in. This input longword is partitioned into
03336 individual bytes, organized as follows. The high-order byte communicates the
03337 type of foreign client to receive AFS file services. There are currently two
03338 legal values for this field, namely 0 for the null foreign file system and 1
03339 for NFS. The next byte determines whether the Cache Manager is being asked to
03340 get or set this information. A non-zero value here is interpreted as a command
03341 to set the export information according to what's in the input longword, and a
03342 zero-valued byte in this position instructs the Cache Manager to place a
03343 longword in the output buffer out, which contains the current export settings
03344 for the foreign system type specified in the high-order byte. The third input
03345 byte is not used, and the lowest-order input buffer byte determines whether
03346 export services for the specified system are being enabled or disabled. A
03347 non-zero value will turn on the services, and a zero value will shut them down.
03348 The a pathP pathname parameter is not used by this call, and the routine
03349 generates output only if the export information is being requested instead of
03350 being set. 
03351 \par
03352 The caller must be effectively running as root in order for this operation to
03353 succeed. The call returns EACCES if the caller is not so authorized. If the
03354 caller specifies an illegal foreign system type in the high-order byte of the
03355 input longword, then ENODEV is returned. Again, NFS is the only foreign file
03356 system currently supported. 
03357 \par
03358 Practically speaking, the machine providing NFS-AFS translation services must
03359 enable this service with this pioctl() before any NFS client machines may begin
03360 accessing AFS files. Conversely, if an administrator turns off this export
03361 facility, the export code on the translator machine will immediately stop
03362 responding to traffic from its active NFS clients. 
03363 
03364         \section sec6-5 Section 6.5: RPC Interface 
03365 
03366         \subsection sec6-5-1 Section 6.5.1: Introduction 
03367 
03368 \par
03369 This section covers the structure and workings of the Cache Manager's RPC
03370 interface. Typically, these calls are made by File Server processes. However,
03371 some of the calls are designed specifically for debugging programs (e.g., the
03372 cmdebug facility) and for collection of statistical and performance information
03373 from the Cache Manager. Any client application that makes direct calls on the
03374 File Server RPC interface must be prepared to export a subset of the Cache
03375 Manager RPC interface, as discussed in Section 5.1.6. 
03376 \par
03377 This section will first examine the Cache Manager's use of locks, whose
03378 settings may be observed via one of the RPC interface calls. Next, it will
03379 present some definitions and data structures used in the RPC interface, and
03380 finally document the individual calls available through this interface. 
03381 
03382         \subsection sec6-5-2 Section 6.5.2: Locks 
03383 
03384 \par
03385 The Cache Manager makes use of locking to insure its internal integrity in the
03386 face of its multi-threaded design. A total of 11 locks are maintained for this
03387 purpose, one of which is now obsolete and no longer used (see below). These
03388 locks are strictly internal, and the Cache Manager itself is the only one able
03389 to manipulate them. The current settings for these system locks are externally
03390 accessible for debugging purposes via the AFSRXCB GetLock() RPC interface call,
03391 as described in Section 6.5.5.4. For each lock, its index in the locking table
03392 is given in the following text. 
03393 \li afs xvcache [Index 0]: This lock controls access to the status cache
03394 entries maintained by the Cache Manager. This stat cache keeps stat()-related
03395 information for AFS files it has dealt with. The stat information is kept
03396 separate from actual data contents of the related file, since this information
03397 may change independently (say, as a result of a unix chown() call. 
03398 \li afs xdcache [Index 1]: This lock moderates access to the Cache Manager's
03399 data cache, namely the contents of the file system objects it has cached
03400 locally. As stated above, this data cache is separate from the associated
03401 stat() information. 
03402 \li afs xserver [Index 2]: This lock controls access to the File Server machine
03403 description table, which keeps tabs on all File Servers contacted in recent
03404 history. This lock thus indirectly controls access to the set of per-server RPC
03405 connection descriptors the File Server table makes visible. 
03406 \li afs xvcb [Index 3]: This lock supervises access to the volume callback
03407 information kept by the Cache Manager. This table is referenced, for example,
03408 when a client decides to remove one or more callbacks on files from a given
03409 volume (see the RXAFS GiveUpCallBacks() description on Section 5.1.3.13). 
03410 \li afs xbrs [Index 4]: This lock serializes the actions of the Cache Manager's
03411 background daemons, which perform prefetching and background file storage
03412 duties. 
03413 \li afs xcell [Index 5]: This lock controls the addition, deletion, and update
03414 of items on the linked list housing information on cells known to the Cache
03415 Manager. 
03416 \li afs xconn [Index 6]: This lock supervises operations concerning the set of
03417 RPC connection structures kept by the system. This lock is used in combination
03418 with the 
03419 \li afs xserver lock described above. In some internal Cache Manager code
03420 paths, the File Server description records are first locked, and then the afs
03421 xconn lock is used to access the associated Rx connection records. afs xuser
03422 [Index 7]: This lock serializes access to the per-user structures maintained by
03423 the Cache Manager. 
03424 \li afs xvolume [Index 8]: This lock is used to control access to the Cache
03425 Manager's volume information cache, namely the set of entries currently in
03426 memory, a subset of those stably housed in the VolumeItems disk file (see
03427 Section 6.6.2.3). 
03428 \li afs puttofileLock [Index 9]: This lock is obsolete, and while still defined
03429 by the system is no longer used. It formerly serialized writes to a debugging
03430 output interface buffer, but the internal mechanism has since been updated and
03431 improved. 
03432 \li afs ftf [Index 10]: This lock is used when flushing cache text pages from
03433 the machine's virtual memory tables. For each specific machine architecture on
03434 which the Cache Manager runs, there is a set of virtual memory operations which
03435 must be invoked to perform this operation. The result of such activities is to
03436 make sure that the latest contents of new incarnations of binaries are used,
03437 instead of outdated copies of previous versions still resident in the virtual
03438 memory system. 
03439 
03440         \subsection sec6-5-3 Section 6.5.3: Definitions and Typedefs 
03441 
03442 \par
03443 This section documents some macro definitions and typedefs referenced by the
03444 Cache Manager's RPC interface. Specifically, these definitions and typedefs are
03445 used in the RXAFSCB GetXStats() and RXAFSCB XStatsVersion calls as described in
03446 Sections 6.5.5.6 and 6.5.5.7. 
03447 
03448 \code
03449 /* 
03450 * Define the version of CacheManager and FileServer extended 
03451 * statistics being implemented. 
03452 */ 
03453 const AFSCB_XSTAT_VERSION = 1; 
03454 
03455 /* 
03456 * Define the maximum arrays for passing extended statistics 
03457 * info for the CacheManager and FileServer back to our caller. 
03458 */ 
03459 const AFSCB_MAX_XSTAT_LONGS = 2048; 
03460 typedef long AFSCB_CollData<AFSCB_MAX_XSTAT_LONGS>; 
03461 
03462 /* 
03463 * Define the identifiers for the accessible extended stats data 
03464 * collections. 
03465 */ 
03466 const AFSCB_XSTATSCOLL_CALL_INFO = 0; /*CM call counting & info*/ 
03467 const AFSCB_XSTATSCOLL_PERF_INFO = 1; /*CM performance info*/ 
03468 \endcode
03469 
03470         \subsection sec6-5-4 Section 6.5.4: Structures 
03471 
03472 \par
03473 This section documents some structures used in the Cache Manager RPC interface.
03474 As with the constants and typedefs in the previous section, these items are
03475 used in the RXAFSCB GetXStats() and RXAFSCB XStatsVersion calls as described in
03476 Sections 6.5.5.6 and 6.5.5.7. 
03477 
03478         \subsubsection sec6-5-4-1 Section 6.5.4.1: struct afs MeanStats 
03479 
03480 \par
03481 This structure may be used to collect a running average figure. It is included
03482 in some of the statistics structures described below. 
03483 \n \b Fields 
03484 \li long average - The computed average. 
03485 \li long elements - The number of elements sampled for the above aveage. 
03486 
03487         \subsubsection sec6-5-4-2 Section 6.5.4.2: struct afs CMCallStats 
03488 
03489 \par
03490 This structure maintains profiling information, communicating the number of
03491 times internal Cache Manager functions are invoked. Each field name has a "C "
03492 prefix, followed by the name of the function being watched. As this structure
03493 has entries for over 500 functions, it will not be described further here.
03494 Those readers who wish to see the full layout of this structure are referred to
03495 Appendix A. 
03496 \par
03497 The AFSCB XSTATSCOLL CALL INFO data collection includes the information in this
03498 structure. 
03499 
03500         \subsubsection sec6-5-4-3 Section 6.5.4.3: struct afs CMMeanStats 
03501 
03502 \par
03503 This is the other part of the information (along with the struct afs
03504 CMCallStats construct described above) returned by the AFSCB XSTATSCOLL CALL
03505 INFO data collection defined by the Cache Manager (see Section 6.5.3). It is
03506 accessible via the RXAFSCB GetXStats() interface routine, as defined in Section
03507 6.5.5.7. 
03508 \par
03509 This structure represents the beginning of work to compute average values for
03510 some of the extended statistics collected by the Cache Manager. 
03511 \n \b Fields 
03512 \li struct afs MeanStats something - Intended to collect averages for some of
03513 the Cache Manager extended statistics; not yet implemented. 
03514 
03515         \subsubsection sec6-5-4-4 Section 6.5.4.4: struct afs CMStats 
03516 
03517 \par
03518 This structure defines the information returned by the AFSCB XSTATSCOLL CALL
03519 INFO data collection defined by the Cache Manager (see Section 6.5.3). It is
03520 accessible via the RXAFSCB GetXStats() interface routine, as defined in Section
03521 6.5.5.7. 
03522 \n \b Fields 
03523 \li struct afs CallStats callInfo - Contains the counts on the number of times
03524 each internal Cache Manager function has been called. 
03525 \li struct afs MeanStats something - Intended to collect averages for some of
03526 the Cache Manager extended statistics; not yet implemented. 
03527 
03528         \subsubsection sec6-5-4-5 Section 6.5.4.5: struct afs CMPerfStats 
03529 
03530 \par
03531 This is the information returned by the AFSCB XSTATSCOLL PERF INFO data
03532 collection defined by the Cache Manager (see Section 6.5.3). It is accessible
03533 via the RXAFSCB GetXStats() interface routine, as defined in Section 6.5.5.7. 
03534 \n \b Fields 
03535 \li long numPerfCalls - Number of performance calls received. 
03536 \li long epoch - Cache Manager epoch time. 
03537 \li long numCellsContacted - Number of cells contacted. 
03538 \li long dlocalAccesses - Number of data accesses to files within the local
03539 cell. 
03540 \li long vlocalAccesses - Number of stat accesses to files within the local
03541 cell. 
03542 \li long dremoteAccesses - Number of data accesses to files outside of the
03543 local cell. 
03544 \li long vremoteAccesses - Number of stat accesses to files outside of the
03545 local cell. 
03546 \li long cacheNumEntries - Number of cache entries. 
03547 \li long cacheBlocksTotal - Number of (1K) blocks configured for the AFS cache. 
03548 \li long cacheBlocksInUse - Number of cache blocks actively in use. 
03549 \li long cacheBlocksOrig - Number of cache blocks configured at bootup. 
03550 \li long cacheMaxDirtyChunks - Maximum number of dirty cache chunks tolerated. 
03551 \li long cacheCurrDirtyChunks - Current count of dirty cache chunks. 
03552 \li long dcacheHits - Number of data file requests satisfied by the local
03553 cache. 
03554 \li long vcacheHits - Number of stat entry requests satisfied by the local
03555 cache. 
03556 \li long dcacheMisses - Number of data file requests not satisfied by the local
03557 cache. 
03558 \li long vcacheMisses - Number of stat entry requests not satisfied by the
03559 local cache. 
03560 \li long cacheFlushes - Number of files flushed from the cache. 
03561 \li long cacheFilesReused - Number of cache files reused. 
03562 \li long numServerRecords - Number of records used for storing information
03563 concerning File Servers. 
03564 \li long ProtServerAddr - IP addres of the Protection Server used (not
03565 implemented). 
03566 \li long spare[32] - A set of longword spares reserved for future use. 
03567 
03568         \subsection sec6-5-5 Section 6.5.5: Function Calls 
03569 
03570 \par
03571 This section discusses the Cache Manager interface calls. No special
03572 permissions are required of the caller for any of these operations. A summary
03573 of the calls making up the interface appears below: 
03574 \li RXAFSCB Probe() "Are-you-alive" call. 
03575 \li RXAFSCB CallBack() Report callbacks dropped by a File Server. 
03576 \li RXAFSCB InitCallBackState() Purge callback state from a File Server. 
03577 \li RXAFSCB GetLock() Get contents of Cache Manager lock table. 
03578 \li RXAFSCB GetCE() Get cache file description. 
03579 \li RXAFSCB XStatsVersion() Get version of extended statistics package. 
03580 \li RXAFSCB GetXStats() Get contents of extended statistics data collection. 
03581 
03582         \subsubsection sec6-5-5-1 Section 6.5.5.1: RXAFSCB Probe - Acknowledge
03583 that the underlying callback service is still operational 
03584 
03585 \code
03586 int RXAFSCB Probe(IN struct rx call *a rxCallP) 
03587 \endcode
03588 \par Description 
03589 [Opcode 206] This call simply implements an "are-you-alive" operation, used to
03590 determine if the given Cache Manager is still running. Any File Server will
03591 probe each of the Cache Managers with which it has interacted on a regular
03592 basis, keeping track of their health. This information serves an important
03593 purpose for a File Server. In particular, it is used to trigger purging of
03594 deceased Cache Managers from the File Server's callback records, and also to
03595 instruct a new or "resurrected" Cache Manager to purge its own callback state
03596 for the invoking File Server. 
03597 \par
03598 Rx call information for the related Cache Manager is contained in a rxCallP. 
03599 \par Error Codes 
03600 ---No error codes are generated. 
03601 
03602         \subsubsection sec6-5-5-2 Section 6.5.5.2: RXAFSCB CallBack - Report
03603 callbacks dropped by a File Server 
03604 
03605 \code
03606 int RXAFSCB CallBack(IN struct rx call *a rxCallP,
03607                         IN AFSCBFids *a fidArrayP,
03608                         IN AFSCBs *a callBackArrayP)
03609 \endcode
03610 \par Description 
03611 [Opcode 204] Provide information on dropped callbacks to the Cache Manager for
03612 the calling File Server. The number of fids involved appears in a
03613 fidArrayP->AFSCBFids len, with the fids themselves located at a
03614 fidArrayP->AFSCBFids val. Similarly, the number of associated callbacks is
03615 placed in a callBackArrayP->AFSCBs len, with the callbacks themselves located
03616 at a callBackArrayP->AFSCBs val. 
03617 \par
03618 Rx call information for the related Cache Manager is contained in a rxCallP. 
03619 \par Error Codes 
03620 ---No error codes are generated. 
03621 
03622         \subsubsection sec6-5-5-3 Section 6.5.5.3: RXAFSCB InitCallBackState -
03623 Purge callback state from a File Server 
03624 
03625 \code
03626 int RXAFSCB InitCallBackState(IN struct rx call *a rxCallP) 
03627 \endcode
03628 \par Description 
03629 [Opcode 205] This routine instructs the Cache Manager to purge its callback
03630 state for all files and directories that live on the calling host. This
03631 function is typically called by a File Server when it gets a request from a
03632 Cache Manager that does not appear in its internal records. This handles
03633 situations where Cache Managers survive a File Server, or get separated from it
03634 via a temporary network partition. This also happens upon bootup, or whenever
03635 the File Server must throw away its record of a Cache Manager because its
03636 tables have been filled. 
03637 \par
03638 Rx call information for the related Cache Manager is contained in a rxCallP. 
03639 \par Error Codes 
03640 ---No error codes are generated. 
03641 
03642         \subsubsection sec6-5-5-4 Section 6.5.5.4: RXAFSCB GetLock - Get
03643 contents of Cache Manager lock table 
03644 
03645 \code
03646 int RXAFSCB GetLock(IN struct rx call *a rxCall, 
03647                         IN long a index, 
03648                         OUT AFSDBLock *a lockP) 
03649 \endcode
03650 \par Description 
03651 [Opcode 207] Fetch the contents of entry a index in the Cache Manager lock
03652 table. There are 11 locks in the table, as described in Section 6.5.2. The
03653 contents of the desired lock, including a string name representing the lock,
03654 are returned in a lockP. 
03655 \par
03656 This call is not used by File Servers, but rather by debugging tools such as
03657 cmdebug. 
03658 \par
03659 Rx call information for the related Cache Manager is contained in a rxCallP. 
03660 \par Error Codes 
03661 The index value supplied in a index is out of range; it must be between 0 and
03662 10. 
03663 
03664         \subsubsection sec6-5-5-5 Section 6.5.5.5: RXAFSCB GetCE - Get cache
03665 file description 
03666 
03667 \code
03668 int RXAFSCB GetCE(IN struct rx call *a rxCall, 
03669                         IN long a index, 
03670                         OUT AFSDBCacheEntry *a ceP) 
03671 \endcode
03672 \par Description 
03673 [Opcode 208] Fetch the description for entry a index in the Cache Manager file
03674 cache, storing it into the buffer to which a ceP points. The structure returned
03675 into this pointer variable is described in Section 4.3.2. 
03676 \par
03677 This call is not used by File Servers, but rather by debugging tools such as
03678 cmdebug. 
03679 \par
03680 Rx call information for the related Cache Manager is contained in a rxCallP. 
03681 \par Error Codes 
03682 The index value supplied in a index is out of range. 
03683 
03684         \subsubsection sec6-5-5-6 Section 6.5.5.6: RXAFSCB XStatsVersion - Get
03685 version of extended statistics package 
03686 
03687 \code
03688 int RXAFSCB XStatsVersion(IN struct rx call *a rxCall, 
03689                                 OUT long *a versionNumberP) 
03690 \endcode
03691 \par Description 
03692 [Opcode 209] This call asks the Cache Manager for the current version number of
03693 the extended statistics structures it exports (see RXAFSCB GetXStats(), Section
03694 6.5.5.7). The version number is placed in a versionNumberP. 
03695 \par
03696 Rx call information for the related Cache Manager is contained in a rxCallP. 
03697 \par Error Codes 
03698 ---No error codes are generated. 
03699 
03700         \subsubsection sec6-5-5-7 Section 6.5.5.7: RXAFSCB GetXStats - Get
03701 contents of extended statistics data collection 
03702 
03703 \code
03704 int RXAFSCB GetXStats(IN struct rx call *a rxCall, 
03705                         IN long a clientVersionNumber, 
03706                         IN long a collectionNumber, 
03707                         OUT long *a srvVersionNumberP, 
03708                         OUT long *a timeP, 
03709                         OUT AFSCB CollData *a dataP) 
03710 \endcode
03711 \par Description 
03712 [Opcode 210] This function fetches the contents of the specified Cache Manager
03713 extended statistics structure. The caller provides the version number of the
03714 data it expects to receive in a clientVersionNumber. Also provided in a
03715 collectionNumber is the numerical identifier for the desired data collection.
03716 There are currently two of these data collections defined: AFSCB XSTATSCOLL
03717 CALL INFO, which is the list of tallies of the number of invocations of
03718 internal Cache Manager procedure calls, and AFSCB XSTATSCOLL PERF INFO, which
03719 is a list of performance-related numbers. The precise contents of these
03720 collections are described in Section 6.5.4. The current version number of the
03721 Cache Manager collections is returned in a srvVersionNumberP, and is always set
03722 upon return, even if the caller has asked for a different version. If the
03723 correct version number has been specified, and a supported collection number
03724 given, then the collection data is returned in a dataP. The time of collection
03725 is also returned, being placed in a timeP. 
03726 \par
03727 Rx call information for the related Cache Manager is contained in a rxCallP. 
03728 \par Error Codes 
03729 The collection number supplied in a collectionNumber is out of range. 
03730 
03731         \section sec6-6 Section 6.6: Files 
03732 
03733 \par
03734 The Cache Manager gets some of its start-up configuration information from
03735 files located on the client machine's hard disk. Each client is required to
03736 supply a /usr/vice/etc directory in which this configuration data is kept.
03737 Section 6.6.1 describes the format and purpose of the three files contributing
03738 this setup information: ThisCell, CellServDB, and cacheinfo. 
03739 
03740         \subsection sec6-6-1 Section 6.6.1: Configuration Files 
03741 
03742         \subsubsection sec6-6-1-1 Section 6.6.1.1: ThisCell 
03743 
03744 \par
03745 The Cache Manager, along with various applications, needs to be able to
03746 determine the cell to which its client machine belongs. This information is
03747 provided by the ThisCell file. It contains a single line stating the machine's
03748 fully-qualified cell name. 
03749 \par
03750 As with the CellServDB configuration file, the Cache Manager reads the contents
03751 of ThisCell exactly once, at start-up time. Thus, an incarnation of the Cache
03752 Manager will maintain precisely one notion of its home cell for its entire
03753 lifetime. Thus, changes to the text of the ThisCell file will be invisible to
03754 the running Cache Manager. However, these changes will affect such application
03755 programs as klog, which allows a user to generate new authentication tickets.
03756 In this example, klog reads ThisCell every time it is invoked, and then
03757 interacts with the set of Authentication Servers running in the given home
03758 cell, unless the caller specifies the desired cell on the command line. 
03759 \par
03760 The ThisCell file is not expected to be changed on a regular basis. Client
03761 machines are not imagined to be frequently traded between different
03762 administrative organizations. The Unix mode bits are set to specify that while
03763 everyone is allowed to read the file, only root is allowed to modify it. 
03764 
03765         \subsubsection sec6-6-1-2 Section 6.6.1.2: CellServDB 
03766 
03767 \par
03768 To conduct business with a given AFS cell, a Cache Manager must be informed of
03769 the cell's name and the set of machines running AFS database servers within
03770 that cell. Such servers include the Volume Location Server, Authentication
03771 Server, and Protection Server. This particular cell information is obtained
03772 upon startup by reading the CellServDB file. Thus, when the Cache Manager
03773 initialization is complete, it will be able to communicate with the cells
03774 covered by CellServDB. 
03775 \par
03776 The following is an excerpt from a valid CellServDB file, demonstrating the
03777 format used. 
03778 
03779 \code
03780 ... 
03781 >transarc.com   #Transarc Corporation 
03782 192.55.207.7    #henson.transarc.com 
03783 192.55.207.13   #bigbird.transarc.com 
03784 192.55.207.22   #ernie.transarc.com 
03785 >andrew.cmu.edu #Carnegie Mellon University 
03786 128.2.10.2      #vice2.fs.andrew.cmu.edu 
03787 128.2.10.7      #vice7.fs.andrew.cmu.edu 
03788 128.2.10.10     #vice10.fs.andrew.cmu.edu 
03789 ...     
03790 \endcode
03791 \par
03792 There are four rules describing the legal CellServDB file format: 
03793 \li 1. Each cell has a separate entry.  The entries may appear in any order. It
03794 may be convenient, however, to have the workstation's local cell be the first
03795 to appear. 
03796 \li 2. No blank lines should appear in the file, even at the end of the last
03797 entry. 
03798 \li 3. The first line of each cell's entry begins with the '>' character, and
03799 specifies the cell's human-readable, Internet Domain-style name. Optionally,
03800 some white space and a comment (preceded by a '#') may follow, briefly
03801 describing the specified cell. 
03802 \li 4. Each subsequent line in a cell's entry names one of the cell's database
03803 server machines. The following must appear on the line, in the order given: 
03804 \li The Internet address of the server, in the standard 4-component dot
03805 notation. 
03806 \li Some amount of whitespace. 
03807 \li A '#', followed by the machine's complete Internet host name. In this
03808 instance, the '#' sign and the text beyond it specifying the machine name are
03809 NOT treated as a comment. This is required information. 
03810 \par
03811 The Cache Manager will use the given host name to determine its current address
03812 via an Internet Domain lookup. If and only if this lookup fails does the Cache
03813 Manager fall back to using the dotted Internet address on the first part of the
03814 line. This dotted address thus appears simply as a hint in case of Domain
03815 database downtime. 
03816 \par
03817 The CellServDB file is only parsed once, when the Cache Manager first starts.
03818 It is possible, however, to amend existing cell information records or add
03819 completely new ones at any time after Cache Manager initialization completes.
03820 This is accomplished via the VIOCNEWCELL pioctl() (see Section 6.4.5.1. 
03821 
03822         \subsubsection sec6-6-1-3 Section 6.6.1.3: cacheinfo 
03823 
03824 \par
03825 This one-line file contains three fields separated by colons: 
03826 \li AFS Root Directory: This is the directory where the Cache Manager mounts
03827 the AFS root volume. Typically, this is specified to be /afs. 
03828 \li Cache Directory: This field names the directory where the Cache Manager is
03829 to create its local cache files. This is typically set to /usr/vice/cache. 
03830 \li Cache Blocks: The final field states the upper limit on the number of
03831 1,024-byte blocks that the Cache Manager is allowed to use in the partition
03832 hosting the named cache directory. 
03833 \par
03834 Thus, the following cacheinfo file would instruct the Cache Manager to mount
03835 the AFS filespace at /afs, and inform it that it may expect to be able to use
03836 up to 25,000 blocks for the files in its cache directory, /usr/vice/cache. 
03837 \code
03838 /afs:/usr/vice/cache:25000 
03839 \endcode
03840 
03841         \subsection sec6-6-2 Section 6.6.2: Cache Information Files 
03842 
03843         \subsubsection sec6-6-2-1 Section 6.6.2.1: AFSLog 
03844 
03845 \par
03846 This is the AFS log file used to hold Cache Manager debugging output. The file
03847 is set up when the Cache Manager first starts. If it already exists, it is
03848 truncated. If it doesn't, it is created. Output to this file is enabled and
03849 disabled via the the VIOC VENUSLOG pioctl() (see Section 6.4.9.2). Normal text
03850 messages are written to this file by the Cache Manager when output is enabled.
03851 Each time logging to this file is enabled, the AFSLog file is truncated. Only
03852 root can read and write this file. 
03853 
03854         \subsubsection sec6-6-2-2 Section 6.6.2.2: CacheItems 
03855 
03856 \par
03857 The Cache Manager only keeps a subset of its data cache entry descriptors in
03858 memory at once. The number of these in-memory descriptors is determined by
03859 afsd. All of the data cache entry descriptors are kept on disk, in the
03860 CacheItems file. The file begins with a header region, taking up four
03861 longwords: 
03862 \code 
03863 struct fheader { long magic AFS_FHMAGIC 0x7635fab8 long firstCSize: First chunk
03864 size long otherCSize: Next chunk sizes long spare } 
03865 \endcode
03866 \par
03867 The header is followed by one entry for each cache file. Each is: 
03868 \code
03869 struct fcache { 
03870         short hvNextp; /* Next in vnode hash table, or freeDCList */ 
03871         short hcNextp; /* Next index in [fid, chunk] hash table */ 
03872         short chunkNextp; /* File queue of all chunks for a single vnode */ 
03873         struct VenusFid fid; /* Fid for this file */ 
03874         long modTime; /* last time this entry was modified */ 
03875         long versionNo; /* Associated data version number */ 
03876         long chunk; /* Relative chunk number */ 
03877         long inode; /* Unix inode for this chunk */ 
03878         long chunkBytes; /* Num bytes in this chunk */ 
03879         char states; /* Has this chunk been modified? */ 
03880 }; 
03881 \endcode
03882 
03883         \subsubsection sec6-6-2-3 Section 6.6.2.3: VolumeItems 
03884 
03885 \par
03886 The Cache Manager only keeps at most MAXVOLS (50) in-memory volume
03887 descriptions. However, it records all volume information it has obtained in the
03888 VolumeItems file in the chosen AFS cache directory. This file is truncated when
03889 the Cache Manager starts. Each volume record placed into this file has the
03890 following struct fvolume layout: 
03891 \code
03892 struct fvolume { 
03893         long cell; /*Cell for this entry*/ 
03894         long volume; /*Numerical volume ID */ 
03895         long next; /*Hash index*/ 
03896         struct VenusFid dotdot; /*Full fid for .. dir */ 
03897         struct VenusFid mtpoint; /*Full fid for mount point*/ 
03898 }; 
03899 \endcode
03900 
03901         \section sec6-7 Section 6.7: Mariner Interface 
03902 
03903 \par
03904 The Cache Manager Mariner interface allows interested parties to be advised in
03905 real time as to which files and/or directories are being actively transferred
03906 between the client machine and one or more File Servers. If enabled, this
03907 service delivers messages of two different types, as exemplified below: 
03908 \code
03909 Fetching myDataDirectory 
03910 Fetching myDataFile.c 
03911 Storing myDataObj.o 
03912 \endcode
03913 \par
03914 In the first message, the myDataDirectory directory is shown to have just been
03915 fetched from a File Server. Similarly, the second message indicates that the C
03916 program myDataFile.c had just been fetched from its File Server of residence.
03917 Finally, the third message reveals that the myDataObj.o object file has just
03918 been written out over the network to its respective server. 
03919 \par
03920 In actuality, the text of the messages carries a string prefix to indicate
03921 whether a Fetch or Store operation had been performed. So, the full contents of
03922 the above messages are as follows: 
03923 \code
03924 fetch$Fetching myDataDirectory 
03925 fetch$Fetching myDataFile.c 
03926 store$Storing myDataObj.o 
03927 \endcode
03928 The Mariner service may be enabled or disabled for a particular machine by
03929 using the VIOC AFS MARINER HOST pioctl() (see Section 6.4.9.1). This operation
03930 allows any host to be specified as the recipient of these messages. A potential
03931 recipient must have its host be declared the target of such messages, then
03932 listen to a socket on port 2106. 
03933 \par
03934 Internally, the Cache Manager maintains a cache of NMAR (10) vnode structure
03935 pointers and the string name (up to 19 characters) of the associated file or
03936 directory. This cache is implemented as an array serving as a circular buffer.
03937 Each time a file is involved in a create or lookup operation on a File Server,
03938 the current slot in this circular buffer is filled with the relevant vnode and
03939 string name information, and the current position is advanced. If Mariner
03940 output is enabled, then an actual network fetch or store operation will trigger
03941 messages of the kind shown above. Since a fetch or store operation normally
03942 occurs shortly after the create or lookup, the mapping of vnode to name is
03943 likely to still be in the Mariner cache when it comes time to generate the
03944 appropriate message. However, since an unbounded number of other lookups or
03945 creates could have been performed in the interim, there is no guarantee that
03946 the mapping entry will not have been overrun. In these instances, the Mariner
03947 message will be a bit vaguer. Going back to our original example, 
03948 \code
03949 Fetching myDataDirectory 
03950 Fetching a file 
03951 Storing myDataObj.o 
03952 \endcode
03953 In this case, the cached association between the vnode containing myDataFile.c
03954 and its string name was thrown out of the Mariner cache before the network
03955 fetch operation could be performed. Unable to find the mapping, the generic
03956 phrase "a file" was used to identify the object involved. 
03957 \par
03958 Mariner messages only get generated when RPC traffic for fetching or storing a
03959 file system object occurs between the Cache Manager and a File Server. Thus,
03960 file accesses that are handled by the Cache Manager's on-board data cache do
03961 not trigger such announcements. 
03962 
03963         \page biblio Bibliography 
03964 
03965 \li [1] Transarc Corporation. AFS 3.0 System Administrator's Guide,
03966 F-30-0-D102, Pittsburgh, PA, April 1990. 
03967 \li [2] Transarc Corporation. AFS 3.0 Command Reference Manual, F-30-0-D103,
03968 Pittsburgh, PA, April 1990. 
03969 \li [3] CMU Information Technology Center. Synchronization and Caching Issues
03970 in the Andrew File System, USENIX Proceedings, Dallas, TX, Winter 1988. 
03971 \li [4] Sun Microsystems, Inc. NFS: Network File System Protocol Specification,
03972 RFC 1094, March 1989. 
03973 \li [5] Sun Microsystems, Inc. Design and Implementation of the Sun Network
03974 File System, USENIX Summer Conference Proceedings, June 1985. 
03975 \li [6] S.P. Miller, B.C. Neuman, J.I. Schiller, J.H. Saltzer. Kerberos
03976 Authentication and Authorization System, Project Athena Technical Plan, Section
03977 E.2.1, M.I.T., December 1987. 
03978 \li [7] Bill Bryant. Designing an Authentication System: a Dialogue in Four
03979 Scenes, Project Athena internal document, M.I.T, draft of 8 February 1988. 
03980 
03981 */
 All Data Structures Files Functions Variables