The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/nfs/nfsv2.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1989, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * This code is derived from software contributed to Berkeley by
    6  * Rick Macklem at The University of Guelph.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by the University of
   19  *      California, Berkeley and its contributors.
   20  * 4. Neither the name of the University nor the names of its contributors
   21  *    may be used to endorse or promote products derived from this software
   22  *    without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  *      @(#)nfsv2.h     8.1 (Berkeley) 6/10/93
   37  * $FreeBSD: src/sys/nfs/nfsv2.h,v 1.5.4.1 1999/09/05 08:19:54 peter Exp $
   38  */
   39 
   40 #include <nfs/nfsproto.h>
   41 
   42 #if 0
   43 
   44 
   45 /*
   46  * nfs definitions as per the Version 2 and 3 specs
   47  */
   48 
   49 /*
   50  * Constants as defined in the Sun NFS Version 2 and 3 specs.
   51  * "NFS: Network File System Protocol Specification" RFC1094
   52  * and in the "NFS: Network File System Version 3 Protocol
   53  * Specification"
   54  */
   55 
   56 #define NFS_PORT        2049
   57 #define NFS_PROG        100003
   58 #define NFS_VER2        2
   59 #define NFS_VER3        3
   60 #define NFS_MAXDGRAMDATA 8192
   61 #define NFS_MAXDATA     32768
   62 #define NFS_MAXPATHLEN  1024
   63 #define NFS_MAXNAMLEN   255
   64 #define NFS_MAXPKTHDR   404
   65 #define NFS_MAXPACKET   (NFS_MAXPKTHDR + NFS_MAXDATA)
   66 #define NFS_MINPACKET   20
   67 #define NFS_FABLKSIZE   512     /* Size in bytes of a block wrt fa_blocks */
   68 
   69 /* Stat numbers for rpc returns (version 2 and 3) */
   70 #define NFS_OK                  0
   71 #define NFSERR_PERM             1
   72 #define NFSERR_NOENT            2
   73 #define NFSERR_IO               5
   74 #define NFSERR_NXIO             6
   75 #define NFSERR_ACCES            13
   76 #define NFSERR_EXIST            17
   77 #define NFSERR_XDEV             18      /* Version 3 only */
   78 #define NFSERR_NODEV            19
   79 #define NFSERR_NOTDIR           20
   80 #define NFSERR_ISDIR            21
   81 #define NFSERR_INVAL            22      /* Version 3 only */
   82 #define NFSERR_FBIG             27
   83 #define NFSERR_NOSPC            28
   84 #define NFSERR_ROFS             30
   85 #define NFSERR_MLINK            31      /* Version 3 only */
   86 #define NFSERR_NAMETOL          63
   87 #define NFSERR_NOTEMPTY         66
   88 #define NFSERR_DQUOT            69
   89 #define NFSERR_STALE            70
   90 #define NFSERR_REMOTE           71      /* Version 3 only */
   91 #define NFSERR_WFLUSH           99      /* Version 2 only */
   92 #define NFSERR_BADHANDLE        10001   /* The rest Version 3 only */
   93 #define NFSERR_NOT_SYNC         10002
   94 #define NFSERR_BAD_COOKIE       10003
   95 #define NFSERR_NOTSUPP          10004
   96 #define NFSERR_TOOSMALL         10005
   97 #define NFSERR_SERVERFAULT      10006
   98 #define NFSERR_BADTYPE          10007
   99 #define NFSERR_JUKEBOX          10008
  100 
  101 /* Sizes in bytes of various nfs rpc components */
  102 #define NFSX_UNSIGNED   4
  103 
  104 /* specific to NFS Version 2 */
  105 #define NFSX_V2FH       32
  106 #define NFSX_V2FATTR    68
  107 #define NFSX_V2SATTR    32
  108 #define NFSX_V2COOKIE   4
  109 #define NFSX_V2STATFS   20
  110 
  111 /* specific to NFS Version 3 */
  112 #define NFSX_V3FH       16      /* size this server uses */
  113 #define NFSX_V3FHMAX    64      /* max. allowed by protocol */
  114 #define NFSX_V3FATTR    84
  115 #define NFSX_V3SATTR    60      /* max. all fields filled in */
  116 #define NFSX_V3COOKIEVERF 8
  117 
  118 /* variants for both versions */
  119 #define NFSX_FH(v3)             ((v3) ? (NFSX_V3FHMAX + NFSX_UNSIGNED) : \
  120                                         NFSX_V2FH)
  121 #define NFSX_SRVFH(v3)          ((v3) ? NFSX_V3FH : NFSX_V2FH)
  122 #define NFSX_FATTR(v3)          ((v3) ? NFSX_V3FATTR : NFSX_V2FATTR)
  123 #define NFSX_POSTOPATTR(v3)     ((v3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : 0)
  124 #define NFSX_POSTOPORFATTR(v3)  ((v3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : \
  125                                         NFSX_V2FATTR)
  126 #define NFSX_WCCDATA(v3)        ((v3) ? (NFSX_V3FATTR + 32) : 0)
  127 #define NFSX_WCCORFATTR(v3)     ((v3) ? (NFSX_V3FATTR + 32) : NFSX_V2FATTR)
  128 #define NFSX_SATTR(v3)          ((v3) ? NFSX_V3SATTR : NFSX_V2SATTR)
  129 #define NFSX_COOKIEVERF(v3)     ((v3) ? NFSX_V3COOKIEVERF : 0)
  130 #define NFSX_STATFS(isv3)       ((isv3) ? NFSX_NFSV3STATFS : NFSX_NFSSTATFS)
  131 
  132 /* nfs rpc procedure numbers (before version mapping) */
  133 #define NFSPROC_NULL            0
  134 #define NFSPROC_GETATTR         1
  135 #define NFSPROC_SETATTR         2
  136 #define NFSPROC_LOOKUP          3
  137 #define NFSPROC_ACCESS          4
  138 #define NFSPROC_READLINK        5
  139 #define NFSPROC_READ            6
  140 #define NFSPROC_WRITE           7
  141 #define NFSPROC_CREATE          8
  142 #define NFSPROC_MKDIR           9
  143 #define NFSPROC_SYMLINK         10
  144 #define NFSPROC_MKNOD           11
  145 #define NFSPROC_REMOVE          12
  146 #define NFSPROC_RMDIR           13
  147 #define NFSPROC_RENAME          14
  148 #define NFSPROC_LINK            15
  149 #define NFSPROC_READDIR         16
  150 #define NFSPROC_READDIRPLUS     17
  151 #define NFSPROC_FSSTAT          18
  152 #define NFSPROC_FSINFO          19
  153 #define NFSPROC_PATHCONF        20
  154 #define NFSPROC_COMMIT          21
  155 
  156 /* And leasing (nqnfs) procedure numbers */
  157 #define NQNFSPROC_GETLEASE      22
  158 #define NQNFSPROC_VACATED       23
  159 #define NQNFSPROC_EVICTED       24
  160 
  161 #define NFS_NPROCS              25
  162 
  163 /* Actual Version 2 procedure numbers */
  164 #define NFSV2PROC_NULL          0
  165 #define NFSV2PROC_GETATTR       1
  166 #define NFSV2PROC_SETATTR       2
  167 #define NFSV2PROC_NOOP          3
  168 #define NFSV2PROC_ROOT          NFSV2PROC_NOOP  /* Obsolete */
  169 #define NFSV2PROC_LOOKUP        4
  170 #define NFSV2PROC_READLINK      5
  171 #define NFSV2PROC_READ          6
  172 #define NFSV2PROC_WRITECACHE    NFSV2PROC_NOOP  /* Obsolete */
  173 #define NFSV2PROC_WRITE         8
  174 #define NFSV2PROC_CREATE        9
  175 #define NFSV2PROC_REMOVE        10
  176 #define NFSV2PROC_RENAME        11
  177 #define NFSV2PROC_LINK          12
  178 #define NFSV2PROC_SYMLINK       13
  179 #define NFSV2PROC_MKDIR         14
  180 #define NFSV2PROC_RMDIR         15
  181 #define NFSV2PROC_READDIR       16
  182 #define NFSV2PROC_STATFS        17
  183 
  184 /* Conversion macros */
  185 extern int              vttoif_tab[];
  186 #define vtonfsv2_mode(t,m) \
  187                 txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \
  188                                 MAKEIMODE((t), (m)))
  189 #define vtonfsv3_mode(m)        txdr_unsigned((m) & 07777)
  190 #define nfstov_mode(a)          (fxdr_unsigned(u_short, (a))&07777)
  191 #define vtonfsv2_type(a)        txdr_unsigned(nfsv2_type[((long)(a))])
  192 #define vtonfsv3_type(a)        txdr_unsigned(nfsv3_type[((long)(a))])
  193 #define nfsv2tov_type(a)        nv2tov_type[fxdr_unsigned(u_long,(a))&0x7]
  194 #define nfsv3tov_type(a)        nv3tov_type[fxdr_unsigned(u_long,(a))&0x7]
  195 
  196 /* File types */
  197 typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5,
  198         NFSOCK=6, NFFIFO=7 } nfstype;
  199 
  200 /* Structs for common parts of the rpc's */
  201 struct nfsv2_time {
  202         u_long  nfsv2_sec;
  203         u_long  nfsv2_usec;
  204 };
  205 typedef struct nfsv2_time       nfstime2;
  206 
  207 struct nfsv3_time {
  208         u_long  nfsv3_sec;
  209         u_long  nfsv3_nsec;
  210 };
  211 typedef struct nfsv3_time       nfstime3;
  212 
  213 /*
  214  * Quads are defined as arrays of 2 longs to ensure dense packing for the
  215  * protocol and to facilitate xdr conversion.
  216  */
  217 struct nfs_uquad {
  218         u_long  nfsuquad[2];
  219 };
  220 typedef struct nfs_uquad        nfsuint64;
  221 
  222 /*
  223  * File attributes and setable attributes. These structures cover both
  224  * NFS version 2 and the version 3 protocol. Note that the union is only
  225  * used so that one pointer can refer to both variants. These structures
  226  * go out on the wire and must be densely packed, so no quad data types
  227  * are used. (all fields are longs or u_longs or structures of same)
  228  * NB: You can't do sizeof(struct nfs_fattr), you must use the
  229  *     NFSX_FATTR(v3) macro.
  230  */
  231 struct nfs_fattr {
  232         u_long  fa_type;
  233         u_long  fa_mode;
  234         u_long  fa_nlink;
  235         u_long  fa_uid;
  236         u_long  fa_gid;
  237         union {
  238                 struct {
  239                         u_long          nfsv2fa_size;
  240                         u_long          nfsv2fa_blocksize;
  241                         u_long          nfsv2fa_rdev;
  242                         u_long          nfsv2fa_blocks;
  243                         u_long          nfsv2fa_fsid;
  244                         u_long          nfsv2fa_fileid;
  245                         nfstime2        nfsv2fa_atime;
  246                         nfstime2        nfsv2fa_mtime;
  247                         nfstime2        nfsv2fa_ctime;
  248                 } fa_nfsv2;
  249                 struct {
  250                         nfsuint64       nfsv3fa_size;
  251                         nfsuint64       nfsv3fa_used;
  252                         nfsuint64       nfsv3fa_rdev;
  253                         nfsuint64       nfsv3fa_fsid;
  254                         nfsuint64       nfsv3fa_fileid;
  255                         nfstime3        nfsv3fa_atime;
  256                         nfstime3        nfsv3fa_mtime;
  257                         nfstime3        nfsv3fa_ctime;
  258                 } fa_nfsv3;
  259         } fa_un;
  260 };
  261 
  262 /* and some ugly defines for accessing union components */
  263 #define fa2_size                fa_un.fa_nfsv2.nfsv2fa_size
  264 #define fa2_blocksize           fa_un.fa_nfsv2.nfsv2fa_blocksize
  265 #define fa2_rdev                fa_un.fa_nfsv2.nfsv2fa_rdev
  266 #define fa2_blocks              fa_un.fa_nfsv2.nfsv2fa_blocks
  267 #define fa2_fsid                fa_un.fa_nfsv2.nfsv2fa_fsid
  268 #define fa2_fileid              fa_un.fa_nfsv2.nfsv2fa_fileid
  269 #define fa2_atime               fa_un.fa_nfsv2.nfsv2fa_atime
  270 #define fa2_mtime               fa_un.fa_nfsv2.nfsv2fa_mtime
  271 #define fa2_ctime               fa_un.fa_nfsv2.nfsv2fa_ctime
  272 #define fa3_size                fa_un.fa_nfsv3.nfsv3fa_size
  273 #define fa3_used                fa_un.fa_nfsv3.nfsv3fa_used
  274 #define fa3_rdev                fa_un.fa_nfsv3.nfsv3fa_rdev
  275 #define fa3_fsid                fa_un.fa_nfsv3.nfsv3fa_fsid
  276 #define fa3_fileid              fa_un.fa_nfsv3.nfsv3fa_fileid
  277 #define fa3_atime               fa_un.fa_nfsv3.nfsv3fa_atime
  278 #define fa3_mtime               fa_un.fa_nfsv3.nfsv3fa_mtime
  279 #define fa3_ctime               fa_un.fa_nfsv3.nfsv3fa_ctime
  280 
  281 struct nfsv2_sattr {
  282         u_long          sa_mode;
  283         u_long          sa_uid;
  284         u_long          sa_gid;
  285         u_long          sa_size;
  286         nfstime2        sa_atime;
  287         nfstime2        sa_mtime;
  288 };
  289 
  290 struct nfsv2_statfs {
  291         u_long  sf_tsize;
  292         u_long  sf_bsize;
  293         u_long  sf_blocks;
  294         u_long  sf_bfree;
  295         u_long  sf_bavail;
  296 };
  297 
  298 struct nfsv3_fsstat {
  299         nfsuint64       sf_tbytes;
  300         nfsuint64       sf_fbytes;
  301         nfsuint64       sf_abytes;
  302         nfsuint64       sf_tfiles;
  303         nfsuint64       sf_ffiles;
  304         nfsuint64       sf_afiles;
  305         u_long          sf_invarsec;
  306 };
  307 
  308 struct nfsv3_fsinfo {
  309         u_long          fs_rtmax;
  310         u_long          fs_rtpref;
  311         u_long          fs_rtmult;
  312         u_long          fs_wtmax;
  313         u_long          fs_wtpref;
  314         u_long          fs_wtmult;
  315         u_long          fs_dtpref;
  316         nfsuint64       fs_maxfilesize;
  317         nfstime3        fs_time_delta;
  318         u_long          fs_properties;
  319 };
  320 #endif

Cache object: 119247d2f33bf4c9d51bfb23fc028402


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.