|
|
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 is only permitted until one year after the first shipment
9: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
10: * binary forms are permitted provided that: (1) source distributions retain
11: * this entire copyright notice and comment, and (2) distributions including
12: * binaries display the following acknowledgement: This product includes
13: * software developed by the University of California, Berkeley and its
14: * contributors'' in the documentation or other materials provided with the
15: * distribution and in all advertising materials mentioning features or use
16: * of this software. Neither the name of the University nor the names of
17: * its contributors may be used to endorse or promote products derived from
18: * this software without specific prior written permission.
19: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22: *
23: * @(#)nfsv2.h 7.8 (Berkeley) 6/28/90
24: */
25:
26: /*
27: * nfs definitions as per the version 2 specs
28: */
29:
30: /*
31: * Constants as defined in the Sun NFS Version 2 spec.
32: * "NFS: Network File System Protocol Specification" RFC1094
33: */
34:
35: #define NFS_PORT 2049
36: #define NFS_PROG 100003
37: #define NFS_VER2 2
38: #define NFS_MAXDGRAMDATA 8192
39: #define NFS_MAXDATA 32768
40: #define NFS_MAXPATHLEN 1024
41: #define NFS_MAXNAMLEN 255
42: #define NFS_FHSIZE 32
43: #define NFS_MAXPKTHDR 404
44: #define NFS_MAXPACKET (NFS_MAXPKTHDR+NFS_MAXDATA)
45: #define NFS_NPROCS 18
46: #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */
47:
48: /* Stat numbers for rpc returns */
49: #define NFS_OK 0
50: #define NFSERR_PERM 1
51: #define NFSERR_NOENT 2
52: #define NFSERR_IO 5
53: #define NFSERR_NXIO 6
54: #define NFSERR_ACCES 13
55: #define NFSERR_EXIST 17
56: #define NFSERR_NODEV 19
57: #define NFSERR_NOTDIR 20
58: #define NFSERR_ISDIR 21
59: #define NFSERR_FBIG 27
60: #define NFSERR_NOSPC 28
61: #define NFSERR_ROFS 30
62: #define NFSERR_NAMETOOLONG 63
63: #define NFSERR_NOTEMPTY 66
64: #define NFSERR_DQUOT 69
65: #define NFSERR_STALE 70
66: #define NFSERR_WFLUSH 99
67:
68: /* Sizes in bytes of various nfs rpc components */
69: #define NFSX_FH 32
70: #define NFSX_UNSIGNED 4
71: #define NFSX_FATTR 68
72: #define NFSX_SATTR 32
73: #define NFSX_COOKIE 4
74: #define NFSX_STATFS 20
75:
76: /* nfs rpc procedure numbers */
77: #define NFSPROC_NULL 0
78: #define NFSPROC_GETATTR 1
79: #define NFSPROC_SETATTR 2
80: #define NFSPROC_ROOT 3 /* Obsolete */
81: #define NFSPROC_LOOKUP 4
82: #define NFSPROC_READLINK 5
83: #define NFSPROC_READ 6
84: #define NFSPROC_WRITECACHE 7 /* Obsolete */
85: #define NFSPROC_WRITE 8
86: #define NFSPROC_CREATE 9
87: #define NFSPROC_REMOVE 10
88: #define NFSPROC_RENAME 11
89: #define NFSPROC_LINK 12
90: #define NFSPROC_SYMLINK 13
91: #define NFSPROC_MKDIR 14
92: #define NFSPROC_RMDIR 15
93: #define NFSPROC_READDIR 16
94: #define NFSPROC_STATFS 17
95:
96: /* Conversion macros */
97: extern int vttoif_tab[];
98: #define vtonfs_mode(t,m) \
99: txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \
100: MAKEIMODE((t), (m)))
101: #define nfstov_mode(a) (fxdr_unsigned(u_short, (a))&07777)
102: #define vtonfs_type(a) txdr_unsigned(nfs_type[((long)(a))])
103: #define nfstov_type(a) ntov_type[fxdr_unsigned(u_long,(a))&0x7]
104:
105: /* File types */
106: typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 } nfstype;
107:
108: /* Structs for common parts of the rpc's */
109: struct nfsv2_time {
110: u_long tv_sec;
111: u_long tv_usec;
112: };
113:
114: struct nfsv2_fattr {
115: u_long fa_type;
116: u_long fa_mode;
117: u_long fa_nlink;
118: u_long fa_uid;
119: u_long fa_gid;
120: u_long fa_size;
121: u_long fa_blocksize;
122: u_long fa_rdev;
123: u_long fa_blocks;
124: u_long fa_fsid;
125: u_long fa_fileid;
126: struct nfsv2_time fa_atime;
127: struct nfsv2_time fa_mtime;
128: struct nfsv2_time fa_ctime;
129: };
130:
131: struct nfsv2_sattr {
132: u_long sa_mode;
133: u_long sa_uid;
134: u_long sa_gid;
135: u_long sa_size;
136: struct nfsv2_time sa_atime;
137: struct nfsv2_time sa_mtime;
138: };
139:
140: struct nfsv2_statfs {
141: u_long sf_tsize;
142: u_long sf_bsize;
143: u_long sf_blocks;
144: u_long sf_bfree;
145: u_long sf_bavail;
146: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.