nfs_prot_freebsd3.h revision 38494
138494Sobrien/*
238494Sobrien * Copyright (c) 1997-1998 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
2038494Sobrien *    must display the following acknowledgement:
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 *      %W% (Berkeley) %G%
4038494Sobrien *
4138494Sobrien * $Id: nfs_prot_freebsd3.h,v 1.1 1996/01/13 23:23:39 ezk Exp ezk $
4238494Sobrien *
4338494Sobrien */
4438494Sobrien
4538494Sobrien#ifndef _AMU_NFS_PROT_H
4638494Sobrien#define _AMU_NFS_PROT_H
4738494Sobrien
4838494Sobrien#ifdef HAVE_RPCSVC_NFS_PROT_H
4938494Sobrien# include <rpcsvc/nfs_prot.h>
5038494Sobrien#endif /* HAVE_RPCSVC_NFS_PROT_H */
5138494Sobrien#ifdef HAVE_NFS_RPCV2_H
5238494Sobrien# include <nfs/rpcv2.h>
5338494Sobrien#endif /* HAVE_NFS_RPCV2_H */
5438494Sobrien#ifdef HAVE_NFS_NFS_H
5538494Sobrien# include <nfs/nfs.h>
5638494Sobrien#endif /* HAVE_NFS_NFS_H */
5738494Sobrien
5838494Sobrien/*
5938494Sobrien * MACROS:
6038494Sobrien */
6138494Sobrien#define	dr_drok_u	diropres
6238494Sobrien#define ca_where	where
6338494Sobrien#define da_fhandle	dir
6438494Sobrien#define da_name		name
6538494Sobrien#define dl_entries	entries
6638494Sobrien#define dl_eof		eof
6738494Sobrien#define dr_status	status
6838494Sobrien#define dr_u		diropres_u
6938494Sobrien#define drok_attributes	attributes
7038494Sobrien#define drok_fhandle	file
7138494Sobrien#define fh_data		data
7238494Sobrien#define la_fhandle	from
7338494Sobrien#define la_to		to
7438494Sobrien#define na_atime	atime
7538494Sobrien#define na_ctime	ctime
7638494Sobrien#define na_fileid	fileid
7738494Sobrien#define na_fsid		fsid
7838494Sobrien#define na_mode		mode
7938494Sobrien#define na_mtime	mtime
8038494Sobrien#define na_nlink	nlink
8138494Sobrien#define na_size		size
8238494Sobrien#define na_type		type
8338494Sobrien#define ne_cookie	cookie
8438494Sobrien#define ne_fileid	fileid
8538494Sobrien#define ne_name		name
8638494Sobrien#define ne_nextentry	nextentry
8738494Sobrien#define ns_attr_u	attributes
8838494Sobrien#define ns_status	status
8938494Sobrien#define ns_u		attrstat_u
9038494Sobrien#define nt_seconds	seconds
9138494Sobrien#define nt_useconds	useconds
9238494Sobrien#define rda_cookie	cookie
9338494Sobrien#define rda_count	count
9438494Sobrien#define rda_fhandle	dir
9538494Sobrien#define rdr_reply_u	reply
9638494Sobrien#define rdr_status	status
9738494Sobrien#define rdr_u		readdirres_u
9838494Sobrien#define rlr_data_u	data
9938494Sobrien#define rlr_status	status
10038494Sobrien#define rlr_u		readlinkres_u
10138494Sobrien#define rna_from	from
10238494Sobrien#define rna_to		to
10338494Sobrien#define rr_status	status
10438494Sobrien#define sag_fhandle	file
10538494Sobrien#define sfr_reply_u	reply
10638494Sobrien#define sfr_status	status
10738494Sobrien#define sfr_u		statfsres_u
10838494Sobrien#define sfrok_bavail	bavail
10938494Sobrien#define sfrok_bfree	bfree
11038494Sobrien#define sfrok_blocks	blocks
11138494Sobrien#define sfrok_bsize	bsize
11238494Sobrien#define sfrok_tsize	tsize
11338494Sobrien#define sla_from	from
11438494Sobrien#define wra_fhandle	file
11538494Sobrien
11638494Sobrien
11738494Sobrien/*
11838494Sobrien * TYPEDEFS:
11938494Sobrien */
12038494Sobrientypedef attrstat nfsattrstat;
12138494Sobrientypedef createargs nfscreateargs;
12238494Sobrientypedef dirlist nfsdirlist;
12338494Sobrientypedef diropargs nfsdiropargs;
12438494Sobrientypedef diropres nfsdiropres;
12538494Sobrientypedef entry nfsentry;
12638494Sobrientypedef fattr nfsfattr;
12738494Sobrientypedef ftype nfsftype;
12838494Sobrientypedef linkargs nfslinkargs;
12938494Sobrientypedef readargs nfsreadargs;
13038494Sobrientypedef readdirargs nfsreaddirargs;
13138494Sobrientypedef readdirres nfsreaddirres;
13238494Sobrientypedef readlinkres nfsreadlinkres;
13338494Sobrientypedef readres nfsreadres;
13438494Sobrientypedef renameargs nfsrenameargs;
13538494Sobrientypedef sattrargs nfssattrargs;
13638494Sobrientypedef statfsokres nfsstatfsokres;
13738494Sobrientypedef statfsres nfsstatfsres;
13838494Sobrientypedef symlinkargs nfssymlinkargs;
13938494Sobrientypedef writeargs nfswriteargs;
14038494Sobrien
14138494Sobrien
14238494Sobrien/*
14338494Sobrien *
14438494Sobrien * FreeBSD 3.0 has NFS V3, but you need to regenrate the rpcsc header files
14538494Sobrien * as follows:
14638494Sobrien *	cd /usr/local/rpcsvc
14738494Sobrien *	rpcgen -DWANT_NFS3 mount.x
14838494Sobrien *	rpcgen -DWANT_NFS3 nfs_prot.x
14938494Sobrien * But that's not expected of everyone, plus there are additional things
15038494Sobrien * needed so I define everything that's neede for NFS V3 here.
15138494Sobrien */
15238494Sobrien#ifdef NFSMNT_NFSV3
15338494Sobrien
15438494Sobrien# define MOUNT_NFS3 MOUNT_NFS
15538494Sobrien# define MNTOPT_NFS3 "nfs"
15638494Sobrien
15738494Sobrien#define FHSIZE3 64		/* size in bytes of a file handle (v3) */
15838494Sobrien#define	NFS3_FHSIZE 64
15938494Sobrien#define	MOUNTVERS3 ((unsigned long)(3))
16038494Sobrien#define	NFS_V3 ((unsigned long)(3))
16138494Sobrien
16238494Sobrientypedef struct {
16338494Sobrien  u_int fhandle3_len;
16438494Sobrien  char *fhandle3_val;
16538494Sobrien} fhandle3;
16638494Sobrien
16738494Sobrienenum mountstat3 {
16838494Sobrien  MNT3_OK = 0,
16938494Sobrien  MNT3ERR_PERM = 1,
17038494Sobrien  MNT3ERR_NOENT = 2,
17138494Sobrien  MNT3ERR_IO = 5,
17238494Sobrien  MNT3ERR_ACCES = 13,
17338494Sobrien  MNT3ERR_NOTDIR = 20,
17438494Sobrien  MNT3ERR_INVAL = 22,
17538494Sobrien  MNT3ERR_NAMETOOLONG = 63,
17638494Sobrien  MNT3ERR_NOTSUPP = 10004,
17738494Sobrien  MNT3ERR_SERVERFAULT = 10006
17838494Sobrien};
17938494Sobrientypedef enum mountstat3 mountstat3;
18038494Sobrien
18138494Sobrienstruct mountres3_ok {
18238494Sobrien  fhandle3 fhandle;
18338494Sobrien  struct {
18438494Sobrien    u_int auth_flavors_len;
18538494Sobrien    int *auth_flavors_val;
18638494Sobrien  } auth_flavors;
18738494Sobrien};
18838494Sobrientypedef struct mountres3_ok mountres3_ok;
18938494Sobrien
19038494Sobrienstruct mountres3 {
19138494Sobrien  mountstat3 fhs_status;
19238494Sobrien  union {
19338494Sobrien    mountres3_ok mountinfo;
19438494Sobrien  } mountres3_u;
19538494Sobrien};
19638494Sobrientypedef struct mountres3 mountres3;
19738494Sobrien
19838494Sobrienstruct nfs_fh3 {
19938494Sobrien  u_int fh3_length;
20038494Sobrien  union nfs_fh3_u {
20138494Sobrien    struct nfs_fh3_i {
20238494Sobrien      fhandle_t fh3_i;
20338494Sobrien    } nfs_fh3_i;
20438494Sobrien    char data[NFS3_FHSIZE];
20538494Sobrien  } fh3_u;
20638494Sobrien};
20738494Sobrientypedef struct nfs_fh3 nfs_fh3;
20838494Sobrien
20938494Sobrien#endif /* NFSMNT_NFSV3 */
21038494Sobrien
21138494Sobrien#endif /* not _AMU_NFS_PROT_H */
212