1 /*	$NetBSD: nfs_prot_freebsd3.h,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 1997-2009 Erez Zadok
5  * Copyright (c) 1990 Jan-Simon Pendry
6  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
7  * Copyright (c) 1990 The Regents of the University of California.
8  * All rights reserved.
9  *
10  * This code is derived from software contributed to Berkeley by
11  * Jan-Simon Pendry at Imperial College, London.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgment:
23  *      This product includes software developed by the University of
24  *      California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  *
42  * File: am-utils/conf/nfs_prot/nfs_prot_freebsd3.h
43  *
44  */
45 
46 #ifndef _AMU_NFS_PROT_H
47 #define _AMU_NFS_PROT_H
48 
49 #ifdef HAVE_RPCSVC_NFS_PROT_H
50 # include <rpcsvc/nfs_prot.h>
51 #endif /* HAVE_RPCSVC_NFS_PROT_H */
52 #ifdef HAVE_NFS_RPCV2_H
53 # include <nfs/rpcv2.h>
54 #endif /* HAVE_NFS_RPCV2_H */
55 #ifdef HAVE_NFS_NFS_H
56 # include <nfs/nfs.h>
57 #endif /* HAVE_NFS_NFS_H */
58 #ifdef	HAVE_UFS_UFS_UFSMOUNT_H
59 # ifdef HAVE_UFS_UFS_EXTATTR_H
60 /*
61  * Define a dummy struct ufs_extattr_per_mount, which is used in struct
62  * ufsmount in <ufs/ufs/ufsmount.h>.
63  */
64 struct ufs_extattr_per_mount;
65 # endif /* HAVE_UFS_UFS_EXTATTR_H */
66 # include <ufs/ufs/ufsmount.h>
67 #endif	/* HAVE_UFS_UFS_UFSMOUNT_H */
68 
69 /* nfsclient/nfsargs.h was introduced in FreeBSD 5.0, and is needed */
70 #ifdef	HAVE_NFSCLIENT_NFSARGS_H
71 # include <nfsclient/nfsargs.h>
72 #endif	/* HAVE_NFSCLIENT_NFSARGS_H */
73 
74 /*
75  * MACROS:
76  */
77 #define	dr_drok_u	diropres
78 #define ca_where	where
79 #define da_fhandle	dir
80 #define da_name		name
81 #define dl_entries	entries
82 #define dl_eof		eof
83 #define dr_status	status
84 #define dr_u		diropres_u
85 #define drok_attributes	attributes
86 #define drok_fhandle	file
87 #define fh_data		data
88 #define la_fhandle	from
89 #define la_to		to
90 #define na_atime	atime
91 #define na_ctime	ctime
92 #define na_fileid	fileid
93 #define na_fsid		fsid
94 #define na_mode		mode
95 #define na_mtime	mtime
96 #define na_nlink	nlink
97 #define na_size		size
98 #define na_type		type
99 #define na_uid		uid
100 #define ne_cookie	cookie
101 #define ne_fileid	fileid
102 #define ne_name		name
103 #define ne_nextentry	nextentry
104 #define ns_attr_u	attributes
105 #define ns_status	status
106 #define ns_u		attrstat_u
107 #define nt_seconds	seconds
108 #define nt_useconds	useconds
109 #define rda_cookie	cookie
110 #define rda_count	count
111 #define rda_fhandle	dir
112 #define rdr_reply_u	reply
113 #define rdr_status	status
114 #define rdr_u		readdirres_u
115 #define rlr_data_u	data
116 #define rlr_status	status
117 #define rlr_u		readlinkres_u
118 #define rna_from	from
119 #define rna_to		to
120 #define rr_status	status
121 #define sag_fhandle	file
122 #define sfr_reply_u	reply
123 #define sfr_status	status
124 #define sfr_u		statfsres_u
125 #define sfrok_bavail	bavail
126 #define sfrok_bfree	bfree
127 #define sfrok_blocks	blocks
128 #define sfrok_bsize	bsize
129 #define sfrok_tsize	tsize
130 #define sla_from	from
131 #define wra_fhandle	file
132 
133 
134 /*
135  * TYPEDEFS:
136  */
137 typedef attrstat nfsattrstat;
138 typedef createargs nfscreateargs;
139 typedef dirlist nfsdirlist;
140 typedef diropargs nfsdiropargs;
141 typedef diropres nfsdiropres;
142 typedef entry nfsentry;
143 typedef fattr nfsfattr;
144 typedef ftype nfsftype;
145 typedef linkargs nfslinkargs;
146 typedef readargs nfsreadargs;
147 typedef readdirargs nfsreaddirargs;
148 typedef readdirres nfsreaddirres;
149 typedef readlinkres nfsreadlinkres;
150 typedef readres nfsreadres;
151 typedef renameargs nfsrenameargs;
152 typedef sattrargs nfssattrargs;
153 typedef statfsokres nfsstatfsokres;
154 typedef statfsres nfsstatfsres;
155 typedef symlinkargs nfssymlinkargs;
156 typedef writeargs nfswriteargs;
157 
158 
159 /*
160  *
161  * FreeBSD-3.0-RELEASE has NFS V3.  Older versions had it only defined
162  * in the rpcgen source file.  If you are on an older system, and you
163  * want NFSv3 support, you need to regenerate the rpcsvc header files as
164  * follows:
165  *	cd /usr/include/rpcsvc
166  *	rpcgen -h -C -DWANT_NFS3 mount.x
167  *	rpcgen -h -C -DWANT_NFS3 nfs_prot.x
168  * If you don't want NFSv3, then you will have to turn off the NFSMNT_NFSV3
169  * macro below.  If the code doesn't compile, upgrade to the latest 3.0
170  * version...
171  */
172 #ifdef NFSMNT_NFSV3
173 
174 # define MOUNT_NFS3	"nfs"	/* is this right? */
175 # define MNTOPT_NFS3	"nfs"
176 
177 # ifndef HAVE_XDR_LOOKUP3RES
178 /*
179  * FreeBSD uses different field names than are defined on most other
180  * systems.
181  */
182 #  define AMU_LOOKUP3RES_OK(x)		((x)->LOOKUP3res_u.resok)
183 #  define AMU_LOOKUP3RES_FAIL(x)	((x)->LOOKUP3res_u.resfail)
184 #  define AMU_LOOKUP3RES_FH_LEN(x)	(AMU_LOOKUP3RES_OK(x).object.data.data_len)
185 #  define AMU_LOOKUP3RES_FH_DATA(x)	(AMU_LOOKUP3RES_OK(x).object.data.data_val)
186 # endif /* not HAVE_XDR_LOOKUP3RES */
187 
188 #endif /* NFSMNT_NFSV3 */
189 
190 #endif /* not _AMU_NFS_PROT_H */
191