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