Home | History | Annotate | Line # | Download | only in libsa
nfsv2.h revision 1.2
      1 /*	$NetBSD: nfsv2.h,v 1.2 1996/02/26 23:05:23 gwr Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1989, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * This code is derived from software contributed to Berkeley by
      8  * Rick Macklem at The University of Guelph.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *	This product includes software developed by the University of
     21  *	California, Berkeley and its contributors.
     22  * 4. Neither the name of the University nor the names of its contributors
     23  *    may be used to endorse or promote products derived from this software
     24  *    without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  * SUCH DAMAGE.
     37  *
     38  *	@(#)nfsv2.h	8.1 (Berkeley) 6/10/93
     39  */
     40 
     41 /*
     42  * nfs definitions as per the version 2 specs
     43  */
     44 
     45 /*
     46  * Constants as defined in the Sun NFS Version 2 spec.
     47  * "NFS: Network File System Protocol Specification" RFC1094
     48  */
     49 
     50 #define NFS_PORT	2049
     51 #define	NFS_PROG	100003
     52 #define NFS_VER2	2
     53 #define	NFS_MAXDGRAMDATA 8192
     54 #define	NFS_MAXDATA	32768
     55 #define	NFS_MAXPATHLEN	1024
     56 #define	NFS_MAXNAMLEN	255
     57 #define	NFS_FHSIZE	32
     58 #define	NFS_MAXPKTHDR	404
     59 #define NFS_MAXPACKET	(NFS_MAXPKTHDR+NFS_MAXDATA)
     60 #define	NFS_MINPACKET	20
     61 #define	NFS_FABLKSIZE	512	/* Size in bytes of a block wrt fa_blocks */
     62 
     63 /* Stat numbers for rpc returns */
     64 #define	NFS_OK		0
     65 #define	NFSERR_PERM	1
     66 #define	NFSERR_NOENT	2
     67 #define	NFSERR_IO	5
     68 #define	NFSERR_NXIO	6
     69 #define	NFSERR_ACCES	13
     70 #define	NFSERR_EXIST	17
     71 #define	NFSERR_NODEV	19
     72 #define	NFSERR_NOTDIR	20
     73 #define	NFSERR_ISDIR	21
     74 #define	NFSERR_FBIG	27
     75 #define	NFSERR_NOSPC	28
     76 #define	NFSERR_ROFS	30
     77 #define	NFSERR_NAMETOL	63
     78 #define	NFSERR_NOTEMPTY	66
     79 #define	NFSERR_DQUOT	69
     80 #define	NFSERR_STALE	70
     81 #define	NFSERR_WFLUSH	99
     82 
     83 /* Sizes in bytes of various nfs rpc components */
     84 #define	NFSX_FH		32
     85 #define	NFSX_UNSIGNED	4
     86 #define	NFSX_FATTR	68
     87 #define	NFSX_SATTR	32
     88 #define NFSX_STATFS	20
     89 #define	NFSX_COOKIE	4
     90 
     91 /* nfs rpc procedure numbers */
     92 #define	NFSPROC_NULL		0
     93 #define	NFSPROC_GETATTR		1
     94 #define	NFSPROC_SETATTR		2
     95 #define	NFSPROC_NOOP		3
     96 #define	NFSPROC_ROOT		NFSPROC_NOOP	/* Obsolete */
     97 #define	NFSPROC_LOOKUP		4
     98 #define	NFSPROC_READLINK	5
     99 #define	NFSPROC_READ		6
    100 #define	NFSPROC_WRITECACHE	NFSPROC_NOOP	/* Obsolete */
    101 #define	NFSPROC_WRITE		8
    102 #define	NFSPROC_CREATE		9
    103 #define	NFSPROC_REMOVE		10
    104 #define	NFSPROC_RENAME		11
    105 #define	NFSPROC_LINK		12
    106 #define	NFSPROC_SYMLINK		13
    107 #define	NFSPROC_MKDIR		14
    108 #define	NFSPROC_RMDIR		15
    109 #define	NFSPROC_READDIR		16
    110 #define	NFSPROC_STATFS		17
    111 
    112 #define	NFS_NPROCS		18
    113 
    114 
    115 /* File types */
    116 typedef enum {
    117 	NFNON=0,
    118 	NFREG=1,
    119 	NFDIR=2,
    120 	NFBLK=3,
    121 	NFCHR=4,
    122 	NFLNK=5
    123 } nfstype;
    124 
    125 /* Structs for common parts of the rpc's */
    126 struct nfsv2_time {
    127 	n_long	nfs_sec;
    128 	n_long	nfs_usec;
    129 };
    130 
    131 /*
    132  * File attributes and setable attributes.
    133  */
    134 struct nfsv2_fattr {
    135 	n_long	fa_type;
    136 	n_long	fa_mode;
    137 	n_long	fa_nlink;
    138 	n_long	fa_uid;
    139 	n_long	fa_gid;
    140 	n_long	fa_size;
    141 	n_long	fa_blocksize;
    142 	n_long	fa_rdev;
    143 	n_long	fa_blocks;
    144 	n_long	fa_fsid;
    145 	n_long	fa_fileid;
    146 	struct nfsv2_time fa_atime;
    147 	struct nfsv2_time fa_mtime;
    148 	struct nfsv2_time fa_ctime;
    149 };
    150 
    151 struct nfsv2_sattr {
    152 	n_long	sa_mode;
    153 	n_long	sa_uid;
    154 	n_long	sa_gid;
    155 	n_long	sa_size;
    156 	struct nfsv2_time sa_atime;
    157 	struct nfsv2_time sa_mtime;
    158 };
    159 
    160 struct nfsv2_statfs {
    161 	n_long	sf_tsize;
    162 	n_long	sf_bsize;
    163 	n_long	sf_blocks;
    164 	n_long	sf_bfree;
    165 	n_long	sf_bavail;
    166 };
    167