nfs_prot_freebsd3.h revision 38495
1/*
2 * Copyright (c) 1997-1998 Erez Zadok
3 * Copyright (c) 1990 Jan-Simon Pendry
4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 *    must display the following acknowledgement:
21 *      This product includes software developed by the University of
22 *      California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 *    may be used to endorse or promote products derived from this software
25 *    without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 *      %W% (Berkeley) %G%
40 *
41 * $Id: nfs_prot_freebsd3.h,v 1.1 1996/01/13 23:23:39 ezk Exp ezk $
42 *
43 */
44
45#ifndef _AMU_NFS_PROT_H
46#define _AMU_NFS_PROT_H
47
48#ifdef HAVE_RPCSVC_NFS_PROT_H
49# include <rpcsvc/nfs_prot.h>
50#endif /* HAVE_RPCSVC_NFS_PROT_H */
51#ifdef HAVE_NFS_RPCV2_H
52# include <nfs/rpcv2.h>
53#endif /* HAVE_NFS_RPCV2_H */
54#ifdef HAVE_NFS_NFS_H
55# include <nfs/nfs.h>
56#endif /* HAVE_NFS_NFS_H */
57
58/*
59 * MACROS:
60 */
61#define	dr_drok_u	diropres
62#define ca_where	where
63#define da_fhandle	dir
64#define da_name		name
65#define dl_entries	entries
66#define dl_eof		eof
67#define dr_status	status
68#define dr_u		diropres_u
69#define drok_attributes	attributes
70#define drok_fhandle	file
71#define fh_data		data
72#define la_fhandle	from
73#define la_to		to
74#define na_atime	atime
75#define na_ctime	ctime
76#define na_fileid	fileid
77#define na_fsid		fsid
78#define na_mode		mode
79#define na_mtime	mtime
80#define na_nlink	nlink
81#define na_size		size
82#define na_type		type
83#define ne_cookie	cookie
84#define ne_fileid	fileid
85#define ne_name		name
86#define ne_nextentry	nextentry
87#define ns_attr_u	attributes
88#define ns_status	status
89#define ns_u		attrstat_u
90#define nt_seconds	seconds
91#define nt_useconds	useconds
92#define rda_cookie	cookie
93#define rda_count	count
94#define rda_fhandle	dir
95#define rdr_reply_u	reply
96#define rdr_status	status
97#define rdr_u		readdirres_u
98#define rlr_data_u	data
99#define rlr_status	status
100#define rlr_u		readlinkres_u
101#define rna_from	from
102#define rna_to		to
103#define rr_status	status
104#define sag_fhandle	file
105#define sfr_reply_u	reply
106#define sfr_status	status
107#define sfr_u		statfsres_u
108#define sfrok_bavail	bavail
109#define sfrok_bfree	bfree
110#define sfrok_blocks	blocks
111#define sfrok_bsize	bsize
112#define sfrok_tsize	tsize
113#define sla_from	from
114#define wra_fhandle	file
115
116
117/*
118 * TYPEDEFS:
119 */
120typedef attrstat nfsattrstat;
121typedef createargs nfscreateargs;
122typedef dirlist nfsdirlist;
123typedef diropargs nfsdiropargs;
124typedef diropres nfsdiropres;
125typedef entry nfsentry;
126typedef fattr nfsfattr;
127typedef ftype nfsftype;
128typedef linkargs nfslinkargs;
129typedef readargs nfsreadargs;
130typedef readdirargs nfsreaddirargs;
131typedef readdirres nfsreaddirres;
132typedef readlinkres nfsreadlinkres;
133typedef readres nfsreadres;
134typedef renameargs nfsrenameargs;
135typedef sattrargs nfssattrargs;
136typedef statfsokres nfsstatfsokres;
137typedef statfsres nfsstatfsres;
138typedef symlinkargs nfssymlinkargs;
139typedef writeargs nfswriteargs;
140
141
142/*
143 *
144 * FreeBSD 3.0 has NFS V3, but you need to regenrate the rpcsc header files
145 * as follows:
146 *	cd /usr/local/rpcsvc
147 *	rpcgen -DWANT_NFS3 mount.x
148 *	rpcgen -DWANT_NFS3 nfs_prot.x
149 * But that's not expected of everyone, plus there are additional things
150 * needed so I define everything that's neede for NFS V3 here.
151 */
152#ifdef NFSMNT_NFSV3
153
154# define MOUNT_NFS3 MOUNT_NFS
155# define MNTOPT_NFS3 "nfs"
156
157#define FHSIZE3 64		/* size in bytes of a file handle (v3) */
158#define	NFS3_FHSIZE 64
159#define	MOUNTVERS3 ((unsigned long)(3))
160#define	NFS_V3 ((unsigned long)(3))
161
162typedef struct {
163  u_int fhandle3_len;
164  char *fhandle3_val;
165} fhandle3;
166
167enum mountstat3 {
168  MNT3_OK = 0,
169  MNT3ERR_PERM = 1,
170  MNT3ERR_NOENT = 2,
171  MNT3ERR_IO = 5,
172  MNT3ERR_ACCES = 13,
173  MNT3ERR_NOTDIR = 20,
174  MNT3ERR_INVAL = 22,
175  MNT3ERR_NAMETOOLONG = 63,
176  MNT3ERR_NOTSUPP = 10004,
177  MNT3ERR_SERVERFAULT = 10006
178};
179typedef enum mountstat3 mountstat3;
180
181struct mountres3_ok {
182  fhandle3 fhandle;
183  struct {
184    u_int auth_flavors_len;
185    int *auth_flavors_val;
186  } auth_flavors;
187};
188typedef struct mountres3_ok mountres3_ok;
189
190struct mountres3 {
191  mountstat3 fhs_status;
192  union {
193    mountres3_ok mountinfo;
194  } mountres3_u;
195};
196typedef struct mountres3 mountres3;
197
198struct nfs_fh3 {
199  u_int fh3_length;
200  union nfs_fh3_u {
201    struct nfs_fh3_i {
202      fhandle_t fh3_i;
203    } nfs_fh3_i;
204    char data[NFS3_FHSIZE];
205  } fh3_u;
206};
207typedef struct nfs_fh3 nfs_fh3;
208
209#endif /* NFSMNT_NFSV3 */
210
211#endif /* not _AMU_NFS_PROT_H */
212