1/*	$NetBSD: nfs_prot_aix5_2.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_aix5_2.h
43 *
44 */
45
46#ifndef _AMU_NFS_PROT_H
47#define _AMU_NFS_PROT_H
48
49
50/*
51 * AIX 5.2 has a different aix5_nfs_args structure, hence the separate header.
52 */
53
54#ifdef HAVE_RPCSVC_NFS_PROT_H
55# include <rpcsvc/nfs_prot.h>
56#endif /* HAVE_RPCSVC_NFS_PROT_H */
57#ifdef HAVE_NFS_NFSV2_H
58# include <nfs/nfsv2.h>
59#endif /* HAVE_NFS_NFSV2_H */
60#ifdef HAVE_NFS_RPCV2_H
61# include <nfs/rpcv2.h>
62#endif /* HAVE_NFS_RPCV2_H */
63#ifdef HAVE_SYS_FS_NFS_H
64# include <sys/fs/nfs.h>
65#endif /* HAVE_SYS_FS_NFS_H */
66#ifdef HAVE_RPCSVC_MOUNT_H
67/*
68 * AIX 5.2 wants 'struct pathcnf', but I couldn't find its definition
69 * anywhere.  Luckily, amd doesn't need the size of this structure in
70 * any other structure that it uses.  So we sidestep it for now.
71 */
72struct pathcnf;
73# include <rpcsvc/mount.h>
74#endif /* HAVE_RPCSVC_MOUNT_H */
75#ifdef HAVE_SYS_VFS_H
76/* AIX 5.3 (ppc) wants definition of kernel-specific structure */
77struct thread_credentials;
78#endif /* HAVE_SYS_VFS_H */
79
80/*
81 * MACROS
82 */
83
84#ifndef MNTPATHLEN
85# define MNTPATHLEN 1024
86#endif /* not MNTPATHLEN */
87#ifndef MNTNAMLEN
88# define MNTNAMLEN 255
89#endif /* not MNTNAMLEN */
90
91/* compatible macro name with other OSs */
92#ifdef UVMNT_FORCE
93# define MS_FORCE UVMNT_FORCE
94#endif /* UVMNT_FORCE */
95
96/********************************************************************************/
97/*
98 * NFS mount option flags (out of mount.h)
99 * Maybe one day IBM will include them in system headers.
100 */
101#ifndef MNTOPT_ACDIRMAX
102# define MNTOPT_ACDIRMAX "acdirmax" /* max ac timeout for dirs (sec) */
103# define MNTOPT_ACDIRMIN "acdirmin" /* min ac timeout for dirs (sec) */
104# define MNTOPT_ACREGMAX "acregmax" /* max ac timeout for reg files (sec) */
105# define MNTOPT_ACREGMIN "acregmin" /* min ac timeout for reg files (sec) */
106# define MNTOPT_ACTIMEO  "actimeo" /* attr cache timeout (sec) */
107# define MNTOPT_BG       "bg" /* mount op in background if 1st attempt fails */
108# define MNTOPT_FASTATTR "fastattr" /* no sync_vp in nfs3_getattr */
109# define MNTOPT_FG       "fg" /* mount op in fg if 1st attempt fails, default */
110# define MNTOPT_GRPID    "grpid" /* SysV-compatible group-id on create */
111# define MNTOPT_HARD     "hard"  /* hard mount (default) */
112# define MNTOPT_INTR     "intr"  /* allow interrupts on hard mount */
113# define MNTOPT_NOAC     "noac"  /* don't cache file attributes */
114# define MNTOPT_NOACL	"noacl"  /* don't read acl's from server - default */
115# define MNTOPT_ACL	"acl"  /* read acl's from server means we load ksec */
116# define MNTOPT_NOAUTO   "noauto"/* hide entry from mount -a */
117# define MNTOPT_NOCTO    "nocto" /* no "close to open" attr consistency */
118# define MNTOPT_NODEV    "nodev" /*don't allow opening of devices accross mount*/
119# define MNTOPT_NOINTR   "nointr" /* don't allow interrupts on hard mounts */
120# define MNTOPT_NOQUOTA  "noquota" /* don't check quotas */
121# define MNTOPT_NOSUID   "nosuid" /* no set uid allowed */
122# define MNTOPT_BSY	"bsy"
123# define MNTOPT_PORT     "port"  /* server IP port number */
124# define MNTOPT_POSIX    "posix" /* ask for static pathconf values from mountd */
125# define MNTOPT_QUOTA    "quota" /* quotas */
126# define MNTOPT_RETRANS  "retrans" /* set number of request retries */
127# define MNTOPT_RETRYS   "retry" /* # of times mount is attempted, def=10000*/
128# define MNTOPT_RMNT     "remount" /* remount to rw if mode ro */
129# define MNTOPT_RO       "ro"    /* read only */
130# define MNTOPT_RSIZE    "rsize" /* set read size (bytes) */
131# define MNTOPT_RW       "rw"    /* read/write */
132# define MNTOPT_SECURE   "secure"/* use secure RPC for NFS */
133# define MNTOPT_SHORTDEV "shortdev" /* server dev */
134# define MNTOPT_SOFT     "soft"  /* soft mount */
135# define MNTOPT_TIMEO    "timeo" /* set initial timeout (1/10 sec) */
136# define MNTOPT_WSIZE    "wsize" /* set write size (bytes) */
137# define MNTOPT_VERS "vers"      /* protocol version number indicator */
138# define MNTOPT_PROTO    "proto"     /* protocol network_id indicator */
139# define MNTOPT_LLOCK    "llock"     /* Local locking (no lock manager) */
140# define MNTOPT_BIODS    "biods"     /* max biods per mount */
141# define MNTOPT_EXTATTR  "extraattr" /* extended attribute usage */
142# define MNTOPT_COMBEHND "combehind" /* extended attribute usage */
143# define MNTOPT_NUMCLUST "numclust"  /* max numclust per mount */
144# define MNTOPT_NODIRCACHE   "nodircache"    /* No readdir cache */
145
146# define NFSMNT_NOACL    0x0     /* turn off acl support (not supported) */
147# define NFSMNT_SHORTDEV 0x0     /* server does not support 32-bit device no.
148                                   (not supported) */
149# define NFSMNT_SOFT	0x001	/* soft mount (hard is default) */
150# define NFSMNT_WSIZE	0x002	/* set write size */
151# define NFSMNT_RSIZE	0x004	/* set read size */
152# define NFSMNT_TIMEO	0x008	/* set initial timeout */
153# define NFSMNT_RETRANS	0x010	/* set number of request retrys */
154# define NFSMNT_HOSTNAME	0x020	/* set hostname for error printf */
155# define NFSMNT_INT	0x040	/* allow interrupts on hard mount */
156# define NFSMNT_NOAC	0x080	/* don't cache attributes */
157# define NFSMNT_ACREGMIN	0x0100	/* set min secs for file attr cache */
158# define NFSMNT_ACREGMAX	0x0200	/* set max secs for file attr cache */
159# define NFSMNT_ACDIRMIN	0x0400	/* set min secs for dir attr cache */
160# define NFSMNT_ACDIRMAX	0x0800	/* set max secs for dir attr cache */
161# define NFSMNT_SECURE	0x1000	/* secure mount */
162# define NFSMNT_NOCTO	0x2000	/* no close-to-open consistency */
163# define NFSMNT_KNCONF       0x4000  /* transport's knetconfig structure */
164# define NFSMNT_GRPID        0x8000  /* System V-style gid inheritance */
165# define NFSMNT_RPCTIMESYNC  0x10000 /* use RPC to do secure NFS time sync */
166# define NFSMNT_KERBEROS     0x20000 /* use kerberos credentials */
167# define NFSMNT_POSIX        0x40000 /* static pathconf kludge info */
168# define NFSMNT_LLOCK    0x80000 /* Local locking (no lock manager) */
169# define NFSMNT_ACL	0x100000	/* turn on acl support */
170# define NFSMNT_BIODS        0x200000 /* number of biods per mount */
171# define NFSMNT_EXTATTR      0x400000 /* extended attribute usage */
172# define NFSMNT_FASTATTR     0x800000 /* no sync_vp in nfs3_getattr */
173# define NFSMNT_COMBEHND     0x1000000 /* allow commit behind */
174# define NFSMNT_NUMCLUST     0x2000000 /* number of cluster per mount */
175# define NFSMNT_NODIRCACHE   0x4000000 /* No readdir cache */
176#endif /* not MNTOPT_ACDIRMAX */
177/********************************************************************************/
178
179/* map field names */
180#define ex_dir ex_name
181#define gr_name g_name
182#define gr_next g_next
183#define ml_directory ml_path
184#define ml_hostname ml_name
185#define ml_next ml_nxt
186
187#define	dr_drok_u	diropres
188#define ca_attributes	attributes
189#define ca_where	where
190#define da_fhandle	dir
191#define da_name		name
192#define dl_entries	entries
193#define dl_eof		eof
194#define dr_status	status
195#define dr_u		diropres_u
196#define drok_attributes	attributes
197#define drok_fhandle	file
198#define fh_data		data
199#define la_fhandle	from
200#define la_to		to
201#define na_atime	atime
202#define na_blocks	blocks
203#define na_blocksize	blocksize
204#define na_ctime	ctime
205#define na_fileid	fileid
206#define na_fsid		fsid
207#define na_gid		gid
208#define na_mode		mode
209#define na_mtime	mtime
210#define na_nlink	nlink
211#define na_rdev		rdev
212#define na_size		size
213#define na_type		type
214#define na_uid		uid
215#define ne_cookie	cookie
216#define ne_fileid	fileid
217#define ne_name		name
218#define ne_nextentry	nextentry
219#define ns_attr_u	attributes
220#define ns_status	status
221#define ns_u		attrstat_u
222#define nt_seconds	seconds
223#define nt_useconds	useconds
224#define ra_count	count
225#define ra_fhandle	file
226#define ra_offset	offset
227#define ra_totalcount	totalcount
228#define raok_attributes	attributes
229#define raok_len_u	data_len
230#define raok_u		data
231#define raok_val_u	data_val
232#define rda_cookie	cookie
233#define rda_count	count
234#define rda_fhandle	dir
235#define rdr_reply_u	reply
236#define rdr_status	status
237#define rdr_u		readdirres_u
238#define rlr_data_u	data
239#define rlr_status	status
240#define rlr_u		readlinkres_u
241#define rna_from	from
242#define rna_to		to
243#define rr_reply_u	reply
244#define rr_status	status
245#define rr_u		readres_u
246#define sa_atime	atime
247#define sa_gid		gid
248#define sa_mode		mode
249#define sa_mtime	mtime
250#define sa_size		size
251#define sa_uid		uid
252#define sag_attributes	attributes
253#define sag_fhandle	file
254#define sfr_reply_u	reply
255#define sfr_status	status
256#define sfr_u		statfsres_u
257#define sfrok_bavail	bavail
258#define sfrok_bfree	bfree
259#define sfrok_blocks	blocks
260#define sfrok_bsize	bsize
261#define sfrok_tsize	tsize
262#define sla_attributes	attributes
263#define sla_from	from
264#define sla_to		to
265#define wra_beginoffset	beginoffset
266#define wra_fhandle	file
267#define wra_len_u	data_len
268#define wra_offset	offset
269#define wra_totalcount	totalcount
270#define wra_u		data
271#define wra_val_u	data_val
272
273
274/*
275 * TYPEDEFS:
276 */
277typedef char *dirpath;
278typedef char *name;
279typedef struct exports *exports;
280typedef struct exports exportnode;
281typedef struct groups *groups;
282typedef struct groups groupnode;
283typedef struct mountlist *mountlist;
284
285/*
286 * If these definitions fail to compile on your AIX 5.2 system, be
287 * sure you install all of the necessary header files.
288 */
289typedef attrstat	nfsattrstat;
290typedef createargs	nfscreateargs;
291typedef dirlist		nfsdirlist;
292typedef diropargs	nfsdiropargs;
293typedef diropokres	nfsdiropokres;
294typedef diropres	nfsdiropres;
295typedef entry		nfsentry;
296typedef fattr		nfsfattr;
297typedef ftype		nfsftype;
298typedef linkargs	nfslinkargs;
299typedef readargs	nfsreadargs;
300typedef readdirargs	nfsreaddirargs;
301typedef readdirres	nfsreaddirres;
302typedef readlinkres	nfsreadlinkres;
303typedef readokres	nfsreadokres;
304typedef readres		nfsreadres;
305typedef renameargs	nfsrenameargs;
306typedef sattr		nfssattr;
307typedef sattrargs	nfssattrargs;
308typedef statfsokres	nfsstatfsokres;
309typedef statfsres	nfsstatfsres;
310typedef symlinkargs	nfssymlinkargs;
311typedef writeargs	nfswriteargs;
312
313
314/*
315 * EXTERNALS:
316 */
317
318
319/*
320 * STRUCTURES:
321 */
322
323/*
324 * AIX 5.2 has NFS V3, but it is undefined in the header files.
325 * so I define everything that's needed for NFS V3 here.
326 */
327#ifdef MNT_NFS3
328
329struct aix5_nfs_args {
330  struct sockaddr_in addr;	/* file server address */
331  struct sockaddr_in *syncaddr;	/* secure NFS time sync addr */
332  int proto;
333  char *hostname;		/* server's hostname */
334  char *netname;		/* server's netname */
335  caddr_t fh;			/* File handle to be mounted */
336  int flags;			/* flags */
337  int wsize;			/* write size in bytes */
338  int rsize;			/* read size in bytes */
339  int timeo;			/* initial timeout in .1 secs */
340  int retrans;			/* times to retry send */
341  int acregmin;			/* attr cache file min secs */
342  int acregmax;			/* attr cache file max secs */
343  int acdirmin;			/* attr cache dir min secs */
344  int acdirmax;			/* attr cache dir max secs */
345  struct ppathcnf *pathconf;	/* static pathconf kludge */
346  int biods;			/* biods per mount */
347  int numclust;			/* numclust per mount */
348};
349
350#endif /* MNT_NFS3 */
351
352/*
353 **************************************************************************
354 * AIX 5.2's autofs is not ported or tested yet...
355 * For now, undefine it or define dummy entries.
356 **************************************************************************
357 */
358#ifdef MNT_AUTOFS
359# undef MNT_AUTOFS
360#endif /* MNT_AUTOFS */
361#ifdef HAVE_FS_AUTOFS
362# undef HAVE_FS_AUTOFS
363#endif /* HAVE_FS_AUTOFS */
364
365/*
366 * EXTERNALS:
367 */
368extern bool_t xdr_groups(XDR *xdrs, groups *objp);
369extern char *yperr_string (int incode);
370
371#endif /* not _AMU_NFS_PROT_H */
372