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