Merge branch 'vendor/OPENSSL'
[dragonfly.git] / lib / libstand / nfsv2.h
1 /* $FreeBSD: src/lib/libstand/nfsv2.h,v 1.1.1.1.6.1 2000/05/04 13:47:51 ps Exp $ */
2 /* $DragonFly: src/lib/libstand/nfsv2.h,v 1.2 2003/06/17 04:26:51 dillon Exp $ */
3 /*      $NetBSD: nfsv2.h,v 1.2 1996/02/26 23:05:23 gwr Exp $    */
4
5 /*
6  * Copyright (c) 1989, 1993
7  *      The Regents of the University of California.  All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * Rick Macklem at The University of Guelph.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. 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  */
38
39 /*
40  * nfs definitions as per the version 2 specs
41  */
42
43 /*
44  * Constants as defined in the Sun NFS Version 2 spec.
45  * "NFS: Network File System Protocol Specification" RFC1094
46  */
47
48 #define NFS_PORT        2049
49 #define NFS_PROG        100003
50 #define NFS_VER2        2
51 #define NFS_MAXDGRAMDATA 8192
52 #define NFS_MAXDATA     32768
53 #define NFS_MAXPATHLEN  1024
54 #define NFS_MAXNAMLEN   255
55 #define NFS_FHSIZE      32
56 #define NFS_MAXPKTHDR   404
57 #define NFS_MAXPACKET   (NFS_MAXPKTHDR+NFS_MAXDATA)
58 #define NFS_MINPACKET   20
59 #define NFS_FABLKSIZE   512     /* Size in bytes of a block wrt fa_blocks */
60 #define NFS_READDIRSIZE 1024
61
62 /* Stat numbers for rpc returns */
63 #define NFS_OK          0
64 #define NFSERR_PERM     1
65 #define NFSERR_NOENT    2
66 #define NFSERR_IO       5
67 #define NFSERR_NXIO     6
68 #define NFSERR_ACCES    13
69 #define NFSERR_EXIST    17
70 #define NFSERR_NODEV    19
71 #define NFSERR_NOTDIR   20
72 #define NFSERR_ISDIR    21
73 #define NFSERR_FBIG     27
74 #define NFSERR_NOSPC    28
75 #define NFSERR_ROFS     30
76 #define NFSERR_NAMETOL  63
77 #define NFSERR_NOTEMPTY 66
78 #define NFSERR_DQUOT    69
79 #define NFSERR_STALE    70
80 #define NFSERR_WFLUSH   99
81
82 /* Sizes in bytes of various nfs rpc components */
83 #define NFSX_FH         32
84 #define NFSX_UNSIGNED   4
85 #define NFSX_FATTR      68
86 #define NFSX_SATTR      32
87 #define NFSX_STATFS     20
88 #define NFSX_COOKIE     4
89
90 /* nfs rpc procedure numbers */
91 #define NFSPROC_NULL            0
92 #define NFSPROC_GETATTR         1
93 #define NFSPROC_SETATTR         2
94 #define NFSPROC_NOOP            3
95 #define NFSPROC_ROOT            NFSPROC_NOOP    /* Obsolete */
96 #define NFSPROC_LOOKUP          4
97 #define NFSPROC_READLINK        5
98 #define NFSPROC_READ            6
99 #define NFSPROC_WRITECACHE      NFSPROC_NOOP    /* Obsolete */
100 #define NFSPROC_WRITE           8
101 #define NFSPROC_CREATE          9
102 #define NFSPROC_REMOVE          10
103 #define NFSPROC_RENAME          11
104 #define NFSPROC_LINK            12
105 #define NFSPROC_SYMLINK         13
106 #define NFSPROC_MKDIR           14
107 #define NFSPROC_RMDIR           15
108 #define NFSPROC_READDIR         16
109 #define NFSPROC_STATFS          17
110
111 #define NFS_NPROCS              18
112
113
114 /* File types */
115 typedef enum {
116         NFNON=0,
117         NFREG=1,
118         NFDIR=2,
119         NFBLK=3,
120         NFCHR=4,
121         NFLNK=5
122 } nfstype;
123
124 /* Structs for common parts of the rpc's */
125 struct nfsv2_time {
126         n_long  nfs_sec;
127         n_long  nfs_usec;
128 };
129
130 /*
131  * File attributes and setable attributes.
132  */
133 struct nfsv2_fattr {
134         n_long  fa_type;
135         n_long  fa_mode;
136         n_long  fa_nlink;
137         n_long  fa_uid;
138         n_long  fa_gid;
139         n_long  fa_size;
140         n_long  fa_blocksize;
141         n_long  fa_rdev;
142         n_long  fa_blocks;
143         n_long  fa_fsid;
144         n_long  fa_fileid;
145         struct nfsv2_time fa_atime;
146         struct nfsv2_time fa_mtime;
147         struct nfsv2_time fa_ctime;
148 };
149
150 struct nfsv2_sattr {
151         n_long  sa_mode;
152         n_long  sa_uid;
153         n_long  sa_gid;
154         n_long  sa_size;
155         struct nfsv2_time sa_atime;
156         struct nfsv2_time sa_mtime;
157 };
158
159 struct nfsv2_statfs {
160         n_long  sf_tsize;
161         n_long  sf_bsize;
162         n_long  sf_blocks;
163         n_long  sf_bfree;
164         n_long  sf_bavail;
165 };