home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / nfs / nfsv2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  5.8 KB  |  194 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    nfsv2.h,v $
  29.  * Revision 2.1  92/04/21  17:15:17  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1989 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * This code is derived from software contributed to Berkeley by
  40.  * Rick Macklem at The University of Guelph.
  41.  *
  42.  * Redistribution and use in source and binary forms, with or without
  43.  * modification, are permitted provided that the following conditions
  44.  * are met:
  45.  * 1. Redistributions of source code must retain the above copyright
  46.  *    notice, this list of conditions and the following disclaimer.
  47.  * 2. Redistributions in binary form must reproduce the above copyright
  48.  *    notice, this list of conditions and the following disclaimer in the
  49.  *    documentation and/or other materials provided with the distribution.
  50.  * 3. All advertising materials mentioning features or use of this software
  51.  *    must display the following acknowledgement:
  52.  *    This product includes software developed by the University of
  53.  *    California, Berkeley and its contributors.
  54.  * 4. Neither the name of the University nor the names of its contributors
  55.  *    may be used to endorse or promote products derived from this software
  56.  *    without specific prior written permission.
  57.  *
  58.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  59.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  60.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  61.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  62.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  63.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  64.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  65.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  66.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  67.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  68.  * SUCH DAMAGE.
  69.  *
  70.  *    @(#)nfsv2.h    7.8 (Berkeley) 6/28/90
  71.  */
  72.  
  73. /*
  74.  * nfs definitions as per the version 2 specs
  75.  */
  76.  
  77. /*
  78.  * Constants as defined in the Sun NFS Version 2 spec.
  79.  * "NFS: Network File System Protocol Specification" RFC1094
  80.  */
  81.  
  82. #define NFS_PORT    2049
  83. #define    NFS_PROG    100003
  84. #define NFS_VER2    2
  85. #define    NFS_MAXDGRAMDATA 8192
  86. #define    NFS_MAXDATA    32768
  87. #define    NFS_MAXPATHLEN    1024
  88. #define    NFS_MAXNAMLEN    255
  89. #define    NFS_FHSIZE    32
  90. #define    NFS_MAXPKTHDR    404
  91. #define NFS_MAXPACKET    (NFS_MAXPKTHDR+NFS_MAXDATA)
  92. #define    NFS_NPROCS    18
  93. #define    NFS_FABLKSIZE    512    /* Size in bytes of a block wrt fa_blocks */
  94.  
  95. /* Stat numbers for rpc returns */
  96. #define    NFS_OK        0
  97. #define    NFSERR_PERM    1
  98. #define    NFSERR_NOENT    2
  99. #define    NFSERR_IO    5
  100. #define    NFSERR_NXIO    6
  101. #define    NFSERR_ACCES    13
  102. #define    NFSERR_EXIST    17
  103. #define    NFSERR_NODEV    19
  104. #define    NFSERR_NOTDIR    20
  105. #define    NFSERR_ISDIR    21
  106. #define    NFSERR_FBIG    27
  107. #define    NFSERR_NOSPC    28
  108. #define    NFSERR_ROFS    30
  109. #define    NFSERR_NAMETOOLONG    63
  110. #define    NFSERR_NOTEMPTY    66
  111. #define    NFSERR_DQUOT    69
  112. #define    NFSERR_STALE    70
  113. #define    NFSERR_WFLUSH    99
  114.  
  115. /* Sizes in bytes of various nfs rpc components */
  116. #define    NFSX_FH        32
  117. #define    NFSX_UNSIGNED    4
  118. #define    NFSX_FATTR    68
  119. #define    NFSX_SATTR    32
  120. #define    NFSX_COOKIE    4
  121. #define NFSX_STATFS    20
  122.  
  123. /* nfs rpc procedure numbers */
  124. #define    NFSPROC_NULL        0
  125. #define    NFSPROC_GETATTR        1
  126. #define    NFSPROC_SETATTR        2
  127. #define    NFSPROC_ROOT        3        /* Obsolete */
  128. #define    NFSPROC_LOOKUP        4
  129. #define    NFSPROC_READLINK    5
  130. #define    NFSPROC_READ        6
  131. #define    NFSPROC_WRITECACHE    7        /* Obsolete */
  132. #define    NFSPROC_WRITE        8
  133. #define    NFSPROC_CREATE        9
  134. #define    NFSPROC_REMOVE        10
  135. #define    NFSPROC_RENAME        11
  136. #define    NFSPROC_LINK        12
  137. #define    NFSPROC_SYMLINK        13
  138. #define    NFSPROC_MKDIR        14
  139. #define    NFSPROC_RMDIR        15
  140. #define    NFSPROC_READDIR        16
  141. #define    NFSPROC_STATFS        17
  142.  
  143. /* Conversion macros */
  144. extern int        vttoif_tab[];
  145. #define    vtonfs_mode(t,m) \
  146.         txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \
  147.                 MAKEIMODE((t), (m)))
  148. #define    nfstov_mode(a)    (fxdr_unsigned(u_short, (a))&07777)
  149. #define    vtonfs_type(a)    txdr_unsigned(nfs_type[((long)(a))])
  150. #define    nfstov_type(a)    ntov_type[fxdr_unsigned(u_long,(a))&0x7]
  151.  
  152. /* File types */
  153. typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 } nfstype;
  154.  
  155. /* Structs for common parts of the rpc's */
  156. struct nfsv2_time {
  157.     u_long    tv_sec;
  158.     u_long    tv_usec;
  159. };
  160.  
  161. struct nfsv2_fattr {
  162.     u_long    fa_type;
  163.     u_long    fa_mode;
  164.     u_long    fa_nlink;
  165.     u_long    fa_uid;
  166.     u_long    fa_gid;
  167.     u_long    fa_size;
  168.     u_long    fa_blocksize;
  169.     u_long    fa_rdev;
  170.     u_long    fa_blocks;
  171.     u_long    fa_fsid;
  172.     u_long    fa_fileid;
  173.     struct nfsv2_time fa_atime;
  174.     struct nfsv2_time fa_mtime;
  175.     struct nfsv2_time fa_ctime;
  176. };
  177.  
  178. struct nfsv2_sattr {
  179.     u_long    sa_mode;
  180.     u_long    sa_uid;
  181.     u_long    sa_gid;
  182.     u_long    sa_size;
  183.     struct nfsv2_time sa_atime;
  184.     struct nfsv2_time sa_mtime;
  185. };
  186.  
  187. struct nfsv2_statfs {
  188.     u_long    sf_tsize;
  189.     u_long    sf_bsize;
  190.     u_long    sf_blocks;
  191.     u_long    sf_bfree;
  192.     u_long    sf_bavail;
  193. };
  194.