138494Sobrien/*
2174313Sobrien * Copyright (c) 1997-2006 Erez Zadok
338494Sobrien * Copyright (c) 1990 Jan-Simon Pendry
438494Sobrien * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
538494Sobrien * Copyright (c) 1990 The Regents of the University of California.
638494Sobrien * All rights reserved.
738494Sobrien *
838494Sobrien * This code is derived from software contributed to Berkeley by
938494Sobrien * Jan-Simon Pendry at Imperial College, London.
1038494Sobrien *
1138494Sobrien * Redistribution and use in source and binary forms, with or without
1238494Sobrien * modification, are permitted provided that the following conditions
1338494Sobrien * are met:
1438494Sobrien * 1. Redistributions of source code must retain the above copyright
1538494Sobrien *    notice, this list of conditions and the following disclaimer.
1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1738494Sobrien *    notice, this list of conditions and the following disclaimer in the
1838494Sobrien *    documentation and/or other materials provided with the distribution.
1938494Sobrien * 3. All advertising materials mentioning features or use of this software
2042633Sobrien *    must display the following acknowledgment:
2138494Sobrien *      This product includes software developed by the University of
2238494Sobrien *      California, Berkeley and its contributors.
2338494Sobrien * 4. Neither the name of the University nor the names of its contributors
2438494Sobrien *    may be used to endorse or promote products derived from this software
2538494Sobrien *    without specific prior written permission.
2638494Sobrien *
2738494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2838494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2938494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3038494Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3138494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3238494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3338494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3438494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3538494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3638494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3738494Sobrien * SUCH DAMAGE.
3838494Sobrien *
3938494Sobrien *
40174313Sobrien * File: am-utils/conf/nfs_prot/nfs_prot_freebsd3.h
41131706Smbr * $Id: nfs_prot_freebsd3.h,v 1.5.2.7 2004/01/06 03:15:19 ezk Exp $
4251300Sobrien * $FreeBSD$
4338494Sobrien *
4438494Sobrien */
4538494Sobrien
4638494Sobrien#ifndef _AMU_NFS_PROT_H
4738494Sobrien#define _AMU_NFS_PROT_H
4838494Sobrien
4939007Sobrien/* nfs_prot.h defines struct `nfs_fh3', but it is a ``dmr "unwarranted
5039007Sobrien * chumminess with the C implementation".  We need the more complete
5139007Sobrien * structure, which is defined below.  So get the stock `nfs_fh3'
5239007Sobrien * out of the way.
5339007Sobrien */
5439007Sobrienstruct nfs_fh3;
5539007Sobrien#define nfs_fh3 nfs_fh3_fbsd_
5682825Sobrien
5782825Sobrien#ifdef HAVE_RPCSVC_NFS_PROT_H
5882825Sobrien# include <rpcsvc/nfs_prot.h>
5982825Sobrien#endif /* HAVE_RPCSVC_NFS_PROT_H */
6082825Sobrien
6139007Sobrien#undef nfs_fh3
6238578Sobrien
6338494Sobrien#ifdef HAVE_NFS_RPCV2_H
6438494Sobrien# include <nfs/rpcv2.h>
6538494Sobrien#endif /* HAVE_NFS_RPCV2_H */
6638494Sobrien#ifdef HAVE_NFS_NFS_H
6783653Speter# include <nfsclient/nfs.h>
6883653Speter# include <nfsserver/nfs.h>
6938494Sobrien#endif /* HAVE_NFS_NFS_H */
7051300Sobrien#ifdef	HAVE_UFS_UFS_UFSMOUNT_H
71174313Sobrien# ifdef HAVE_UFS_UFS_EXTATTR_H
72174313Sobrien/*
73174313Sobrien * Define a dummy struct ufs_extattr_per_mount, which is used in struct
74174313Sobrien * ufsmount in <ufs/ufs/ufsmount.h>.
75174313Sobrien */
76174313Sobrienstruct ufs_extattr_per_mount;
77174313Sobrien# endif /* HAVE_UFS_UFS_EXTATTR_H */
7851300Sobrien# include <ufs/ufs/ufsmount.h>
7951300Sobrien#endif	/* HAVE_UFS_UFS_UFSMOUNT_H */
8038494Sobrien
81119682Smbr/* nfsclient/nfsargs.h was introduced in FreeBSD 5.0, and is needed */
82119682Smbr#ifdef	HAVE_NFSCLIENT_NFSARGS_H
83119682Smbr# include <nfsclient/nfsargs.h>
84119682Smbr#endif	/* HAVE_NFSCLIENT_NFSARGS_H */
85119682Smbr
8638494Sobrien/*
8738494Sobrien * MACROS:
8838494Sobrien */
8938494Sobrien#define	dr_drok_u	diropres
9038494Sobrien#define ca_where	where
9138494Sobrien#define da_fhandle	dir
9238494Sobrien#define da_name		name
9338494Sobrien#define dl_entries	entries
9438494Sobrien#define dl_eof		eof
9538494Sobrien#define dr_status	status
9638494Sobrien#define dr_u		diropres_u
9738494Sobrien#define drok_attributes	attributes
9838494Sobrien#define drok_fhandle	file
9938494Sobrien#define fh_data		data
10038494Sobrien#define la_fhandle	from
10138494Sobrien#define la_to		to
10238494Sobrien#define na_atime	atime
10338494Sobrien#define na_ctime	ctime
10438494Sobrien#define na_fileid	fileid
10538494Sobrien#define na_fsid		fsid
10638494Sobrien#define na_mode		mode
10738494Sobrien#define na_mtime	mtime
10838494Sobrien#define na_nlink	nlink
10938494Sobrien#define na_size		size
11038494Sobrien#define na_type		type
111119682Smbr#define na_uid		uid
11238494Sobrien#define ne_cookie	cookie
11338494Sobrien#define ne_fileid	fileid
11438494Sobrien#define ne_name		name
11538494Sobrien#define ne_nextentry	nextentry
11638494Sobrien#define ns_attr_u	attributes
11738494Sobrien#define ns_status	status
11838494Sobrien#define ns_u		attrstat_u
11938494Sobrien#define nt_seconds	seconds
12038494Sobrien#define nt_useconds	useconds
12138494Sobrien#define rda_cookie	cookie
12238494Sobrien#define rda_count	count
12338494Sobrien#define rda_fhandle	dir
12438494Sobrien#define rdr_reply_u	reply
12538494Sobrien#define rdr_status	status
12638494Sobrien#define rdr_u		readdirres_u
12738494Sobrien#define rlr_data_u	data
12838494Sobrien#define rlr_status	status
12938494Sobrien#define rlr_u		readlinkres_u
13038494Sobrien#define rna_from	from
13138494Sobrien#define rna_to		to
13238494Sobrien#define rr_status	status
13338494Sobrien#define sag_fhandle	file
13438494Sobrien#define sfr_reply_u	reply
13538494Sobrien#define sfr_status	status
13638494Sobrien#define sfr_u		statfsres_u
13738494Sobrien#define sfrok_bavail	bavail
13838494Sobrien#define sfrok_bfree	bfree
13938494Sobrien#define sfrok_blocks	blocks
14038494Sobrien#define sfrok_bsize	bsize
14138494Sobrien#define sfrok_tsize	tsize
14238494Sobrien#define sla_from	from
14338494Sobrien#define wra_fhandle	file
14438494Sobrien
14538494Sobrien
14638494Sobrien/*
14738494Sobrien * TYPEDEFS:
14838494Sobrien */
14938494Sobrientypedef attrstat nfsattrstat;
15038494Sobrientypedef createargs nfscreateargs;
15138494Sobrientypedef dirlist nfsdirlist;
15238494Sobrientypedef diropargs nfsdiropargs;
15338494Sobrientypedef diropres nfsdiropres;
15438494Sobrientypedef entry nfsentry;
15538494Sobrientypedef fattr nfsfattr;
15638494Sobrientypedef ftype nfsftype;
15738494Sobrientypedef linkargs nfslinkargs;
15838494Sobrientypedef readargs nfsreadargs;
15938494Sobrientypedef readdirargs nfsreaddirargs;
16038494Sobrientypedef readdirres nfsreaddirres;
16138494Sobrientypedef readlinkres nfsreadlinkres;
16238494Sobrientypedef readres nfsreadres;
16338494Sobrientypedef renameargs nfsrenameargs;
16438494Sobrientypedef sattrargs nfssattrargs;
16538494Sobrientypedef statfsokres nfsstatfsokres;
16638494Sobrientypedef statfsres nfsstatfsres;
16738494Sobrientypedef symlinkargs nfssymlinkargs;
16838494Sobrientypedef writeargs nfswriteargs;
16938494Sobrien
17038494Sobrien
17138494Sobrien/*
17238494Sobrien *
17342633Sobrien * FreeBSD-3.0-RELEASE has NFS V3.  Older versions had it only defined
17442633Sobrien * in the rpcgen source file.  If you are on an older system, and you
17542633Sobrien * want NFSv3 support, you need to regenerate the rpcsvc header files as
17642633Sobrien * follows:
17742633Sobrien *	cd /usr/include/rpcsvc
17842633Sobrien *	rpcgen -h -C -DWANT_NFS3 mount.x
17942633Sobrien *	rpcgen -h -C -DWANT_NFS3 nfs_prot.x
18042633Sobrien * If you don't want NFSv3, then you will have to turn off the NFSMNT_NFSV3
18142633Sobrien * macro below.  If the code doesn't compile, upgrade to the latest 3.0
18242633Sobrien * version...
18338494Sobrien */
18438494Sobrien#ifdef NFSMNT_NFSV3
18538494Sobrien
18682816Sobrien# define MOUNT_NFS3	"nfs"	/* is this right? */
18782803Sobrien# define MNTOPT_NFS3	"nfs"
18838494Sobrien
189174313Sobrien# ifndef HAVE_XDR_LOOKUP3RES
19042633Sobrien/*
191174313Sobrien * FreeBSD uses different field names than are defined on most other
192174313Sobrien * systems.
19342633Sobrien */
194174313Sobrien#  define AMU_LOOKUP3RES_OK(x)		((x)->LOOKUP3res_u.resok)
195174313Sobrien#  define AMU_LOOKUP3RES_FAIL(x)	((x)->LOOKUP3res_u.resfail)
196174313Sobrien#  define AMU_LOOKUP3RES_FH_LEN(x)	(AMU_LOOKUP3RES_OK(x).object.data.data_len)
197174313Sobrien#  define AMU_LOOKUP3RES_FH_DATA(x)	(AMU_LOOKUP3RES_OK(x).object.data.data_val)
198174313Sobrien# endif /* not HAVE_XDR_LOOKUP3RES */
19938494Sobrien
20042659Sobrien/* since we don't use Am-utils's aux/macros/struct_nfs_fh3.m4, we don't get
20142659Sobrien   their special searching.  So restore the standard name. */
20242659Sobrientypedef struct nfs_fh3_freebsd3 nfs_fh3;
20342659Sobrien
20438494Sobrien#endif /* NFSMNT_NFSV3 */
20538494Sobrien
20638494Sobrien#endif /* not _AMU_NFS_PROT_H */
207