|
|
1.1 root 1: /*
2: * Copyright (c) 1989 The Regents of the University of California.
3: * 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 7.8 (Berkeley) 6/28/90
1.1.1.2 ! root 37: *
! 38: * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
! 39: * -------------------- ----- ----------------------
! 40: * CURRENT PATCH LEVEL: 1 00053
! 41: * -------------------- ----- ----------------------
! 42: *
! 43: * 08 Sep 92 Rick "gopher I" Fix "reserved port" bug, fixed for
! 44: * AIX3.2 NFS clients
1.1 root 45: */
46:
47: /*
48: * nfs definitions as per the version 2 specs
49: */
50:
51: /*
52: * Constants as defined in the Sun NFS Version 2 spec.
53: * "NFS: Network File System Protocol Specification" RFC1094
54: */
55:
56: #define NFS_PORT 2049
57: #define NFS_PROG 100003
58: #define NFS_VER2 2
59: #define NFS_MAXDGRAMDATA 8192
60: #define NFS_MAXDATA 32768
61: #define NFS_MAXPATHLEN 1024
62: #define NFS_MAXNAMLEN 255
63: #define NFS_FHSIZE 32
64: #define NFS_MAXPKTHDR 404
65: #define NFS_MAXPACKET (NFS_MAXPKTHDR+NFS_MAXDATA)
66: #define NFS_NPROCS 18
67: #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */
68:
69: /* Stat numbers for rpc returns */
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_NODEV 19
78: #define NFSERR_NOTDIR 20
79: #define NFSERR_ISDIR 21
80: #define NFSERR_FBIG 27
81: #define NFSERR_NOSPC 28
82: #define NFSERR_ROFS 30
83: #define NFSERR_NAMETOOLONG 63
84: #define NFSERR_NOTEMPTY 66
85: #define NFSERR_DQUOT 69
86: #define NFSERR_STALE 70
87: #define NFSERR_WFLUSH 99
88:
89: /* Sizes in bytes of various nfs rpc components */
90: #define NFSX_FH 32
91: #define NFSX_UNSIGNED 4
92: #define NFSX_FATTR 68
93: #define NFSX_SATTR 32
94: #define NFSX_COOKIE 4
95: #define NFSX_STATFS 20
96:
97: /* nfs rpc procedure numbers */
98: #define NFSPROC_NULL 0
99: #define NFSPROC_GETATTR 1
100: #define NFSPROC_SETATTR 2
101: #define NFSPROC_ROOT 3 /* Obsolete */
1.1.1.2 ! root 102: #define NFSPROC_NOOP 3 /* Fake for err returns XXX 08 Sep 92*/
1.1 root 103: #define NFSPROC_LOOKUP 4
104: #define NFSPROC_READLINK 5
105: #define NFSPROC_READ 6
106: #define NFSPROC_WRITECACHE 7 /* Obsolete */
107: #define NFSPROC_WRITE 8
108: #define NFSPROC_CREATE 9
109: #define NFSPROC_REMOVE 10
110: #define NFSPROC_RENAME 11
111: #define NFSPROC_LINK 12
112: #define NFSPROC_SYMLINK 13
113: #define NFSPROC_MKDIR 14
114: #define NFSPROC_RMDIR 15
115: #define NFSPROC_READDIR 16
116: #define NFSPROC_STATFS 17
117:
118: /* Conversion macros */
119: extern int vttoif_tab[];
120: #define vtonfs_mode(t,m) \
121: txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \
122: MAKEIMODE((t), (m)))
123: #define nfstov_mode(a) (fxdr_unsigned(u_short, (a))&07777)
124: #define vtonfs_type(a) txdr_unsigned(nfs_type[((long)(a))])
125: #define nfstov_type(a) ntov_type[fxdr_unsigned(u_long,(a))&0x7]
126:
127: /* File types */
128: typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 } nfstype;
129:
130: /* Structs for common parts of the rpc's */
131: struct nfsv2_time {
132: u_long tv_sec;
133: u_long tv_usec;
134: };
135:
136: struct nfsv2_fattr {
137: u_long fa_type;
138: u_long fa_mode;
139: u_long fa_nlink;
140: u_long fa_uid;
141: u_long fa_gid;
142: u_long fa_size;
143: u_long fa_blocksize;
144: u_long fa_rdev;
145: u_long fa_blocks;
146: u_long fa_fsid;
147: u_long fa_fileid;
148: struct nfsv2_time fa_atime;
149: struct nfsv2_time fa_mtime;
150: struct nfsv2_time fa_ctime;
151: };
152:
153: struct nfsv2_sattr {
154: u_long sa_mode;
155: u_long sa_uid;
156: u_long sa_gid;
157: u_long sa_size;
158: struct nfsv2_time sa_atime;
159: struct nfsv2_time sa_mtime;
160: };
161:
162: struct nfsv2_statfs {
163: u_long sf_tsize;
164: u_long sf_bsize;
165: u_long sf_blocks;
166: u_long sf_bfree;
167: u_long sf_bavail;
168: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.