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.
10 * This code is derived from software contributed to Berkeley by
11 * Jan-Simon Pendry at Imperial College, London.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
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.
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
42 * File: am-utils/conf/nfs_prot/nfs_prot_hpux11.h
46 #ifndef _AMU_NFS_PROT_H
47 #define _AMU_NFS_PROT_H
50 * NOTE: HPUX 11 is missing many header definitions which had to be
51 * guessed and copied over from HPUX 10.20.
54 /* don't include this file as it isn't needed on hpux */
58 #ifndef _TIUSER_INCLUDED
59 # define _TIUSER_INCLUDED
60 #endif /* TIUSER_INCLUDED */
61 #ifndef _SYS_TIUSER_INCLUDED
62 # define _SYS_TIUSER_INCLUDED
63 #endif /* _SYS_TIUSER_INCLUDED */
64 /* if T_NULL is defined, undefine it due to a conflict with <arpa/nameser.h> */
69 #ifdef HAVE_NFS_EXPORT_H_not
70 /* don't include this b/c it'll get included twice */
71 # include <nfs/export.h>
72 #endif /* HAVE_NFS_EXPORT_H */
73 #ifdef HAVE_NFS_NFSV2_H
74 # include <nfs/nfsv2.h>
75 #endif /* HAVE_NFS_NFSV2_H */
76 #ifdef HAVE_NFS_RPCV2_H
77 # include <nfs/rpcv2.h>
78 #endif /* HAVE_NFS_RPCV2_H */
81 #endif /* HAVE_NFS_NFS_H */
82 #ifdef HAVE_SYS_FS_NFS_H
83 # include <sys/fs/nfs.h>
84 #endif /* HAVE_SYS_FS_NFS_H */
85 #ifdef HAVE_RPCSVC_MOUNT_H
86 # include <rpcsvc/mount.h>
87 #endif /* HAVE_RPCSVC_MOUNT_H */
95 #define NFS_MAXDATA 8192
96 #define NFS_MAXPATHLEN 1024
97 #define NFS_MAXNAMLEN 255
99 #define NFS_COOKIESIZE 4
100 #define MNTPATHLEN 1024
101 #define MNTNAMLEN 255
102 #define HOSTNAMESZ 32 /* Max size of hostname in struct nfs_args */
104 #define NFSMODE_FMT 0170000
105 #define NFSMODE_DIR 0040000
106 #define NFSMODE_CHR 0020000
107 #define NFSMODE_BLK 0060000
108 #define NFSMODE_REG 0100000
109 #define NFSMODE_LNK 0120000
110 #define NFSMODE_SOCK 0140000
111 #define NFSMODE_FIFO 0010000
114 # define NFS_PROGRAM ((u_long)100003)
115 #endif /* not NFS_PROGRAM */
117 # define NFS_VERSION ((u_long)2)
118 #endif /* not NFS_VERSION */
120 #define NFSPROC_NULL ((u_long)0)
121 #define NFSPROC_GETATTR ((u_long)1)
122 #define NFSPROC_SETATTR ((u_long)2)
123 #define NFSPROC_ROOT ((u_long)3)
124 #define NFSPROC_LOOKUP ((u_long)4)
125 #define NFSPROC_READLINK ((u_long)5)
126 #define NFSPROC_READ ((u_long)6)
127 #define NFSPROC_WRITECACHE ((u_long)7)
128 #define NFSPROC_WRITE ((u_long)8)
129 #define NFSPROC_CREATE ((u_long)9)
130 #define NFSPROC_REMOVE ((u_long)10)
131 #define NFSPROC_RENAME ((u_long)11)
132 #define NFSPROC_LINK ((u_long)12)
133 #define NFSPROC_SYMLINK ((u_long)13)
134 #define NFSPROC_MKDIR ((u_long)14)
135 #define NFSPROC_RMDIR ((u_long)15)
136 #define NFSPROC_READDIR ((u_long)16)
137 #define NFSPROC_STATFS ((u_long)17)
140 * NFS mount option flags
142 #define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */
143 #define NFSMNT_WSIZE 0x002 /* set write size */
144 #define NFSMNT_RSIZE 0x004 /* set read size */
145 #define NFSMNT_TIMEO 0x008 /* set initial timeout */
146 #define NFSMNT_RETRANS 0x010 /* set number of request retries */
147 #define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */
148 #define NFSMNT_INT 0x040 /* allow interrupts on hard mount */
149 #define NFSMNT_NOAC 0x080 /* don't cache attributes */
150 #define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */
151 #define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */
152 #define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */
153 #define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */
154 #define NFSMNT_SECURE 0x1000 /* secure mount */
155 #define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */
156 #define NFSMNT_KNCONF 0x4000 /* transport's knetconfig structure */
157 #define NFSMNT_GRPID 0x8000 /* System V-style gid inheritance */
158 #define NFSMNT_RPCTIMESYNC 0x10000 /* use RPC to do secure NFS time sync */
159 #define NFSMNT_KERBEROS 0x20000 /* use kerberos credentials */
160 #define NFSMNT_POSIX 0x40000 /* static pathconf kludge info */
161 #define NFSMNT_LLOCK 0x80000 /* Local locking (no lock manager) */
162 #define NFSMNT_REMOUNT 0x100000 /* Remount from r/o to r/w */
164 #define NFSMNT_FSNAME 0x1000000 /* FS name e.g. "host:/path/" */
165 #define NFSMNT_NODEVS 0x2000000 /* no devices access (default on) */
166 #define NFSMNT_IGNORE 0x4000000 /* ignore in mnttab */
168 #define MS_FSS 0x00 /* fake flag to do nothing */
176 * Should include all possible net errors.
177 * For now we just cast errno into an enum nfsstat.
180 NFS_OK
= 0, /* no error */
181 NFSERR_PERM
= 1, /* Not owner */
182 NFSERR_NOENT
= 2, /* No such file or directory */
183 NFSERR_IO
= 5, /* I/O error */
184 NFSERR_NXIO
= 6, /* No such device or address */
185 NFSERR_ACCES
= 13, /* Permission denied */
186 NFSERR_EXIST
= 17, /* File exists */
187 NFSERR_XDEV
= 18, /* Cross-device link */
188 NFSERR_NODEV
= 19, /* No such device */
189 NFSERR_NOTDIR
= 20, /* Not a directory */
190 NFSERR_ISDIR
= 21, /* Is a directory */
191 NFSERR_INVAL
= 22, /* Invalid argument */
192 NFSERR_FBIG
= 27, /* File too large */
193 NFSERR_NOSPC
= 28, /* No space left on device */
194 NFSERR_ROFS
= 30, /* Read-only file system */
195 NFSERR_OPNOTSUPP
= 45, /* Operation not supported */
196 NFSERR_NAMETOOLONG
= 63, /* File name too long */
197 NFSERR_NOTEMPTY
= 66, /* Directory not empty */
198 NFSERR_DQUOT
= 69, /* Disc quota exceeded */
199 NFSERR_STALE
= 70, /* Stale NFS file handle */
200 NFSERR_REMOTE
= 71, /* Object is remote */
201 NFSERR_WFLUSH
/* write cache flushed */
209 NFREG
, /* regular file */
210 NFDIR
, /* directory */
211 NFBLK
, /* block special */
212 NFCHR
, /* character special */
213 NFLNK
, /* symbolic link */
221 typedef struct nfs_fh nfs_fh
;
222 typedef char *filename
;
223 typedef char *nfspath
;
224 typedef char nfscookie
[NFS_COOKIESIZE
];
225 typedef enum nfsftype nfsftype
;
226 typedef enum nfsstat nfsstat
;
227 typedef struct attrstat nfsattrstat
;
228 typedef struct createargs nfscreateargs
;
229 typedef struct dirlist nfsdirlist
;
230 typedef struct diropargs nfsdiropargs
;
231 typedef struct diropokres nfsdiropokres
;
232 typedef struct diropres nfsdiropres
;
233 typedef struct entry nfsentry
;
234 typedef struct fattr nfsfattr
;
235 typedef struct linkargs nfslinkargs
;
236 typedef struct nfstime nfstime
;
237 typedef struct readargs nfsreadargs
;
238 typedef struct readdirargs nfsreaddirargs
;
239 typedef struct readdirres nfsreaddirres
;
240 typedef struct readlinkres nfsreadlinkres
;
241 typedef struct readokres nfsreadokres
;
242 typedef struct readres nfsreadres
;
243 typedef struct renameargs nfsrenameargs
;
244 typedef struct sattr nfssattr
;
245 typedef struct sattrargs nfssattrargs
;
246 typedef struct statfsokres nfsstatfsokres
;
247 typedef struct statfsres nfsstatfsres
;
248 typedef struct symlinkargs nfssymlinkargs
;
249 typedef struct writeargs nfswriteargs
;
252 * NFSv3 handle (copied from am_xdr_func.h, because it is needed here)
253 * we use a different name but same storage size/alignment to avoid
254 * conflicts. Sigh, this is so hacky. -ezk
256 #define HPUX11_FHSIZE3 64 /* size in bytes of a file handle (v3) */
257 struct hpux11_nfs_fh3
{
259 char am_fh3_data
[HPUX11_FHSIZE3
];
261 typedef struct hpux11_nfs_fh3 hpux11_nfs_fh3
;
267 extern void *nfsproc_null_2_svc(void *, struct svc_req
*);
268 extern nfsattrstat
*nfsproc_getattr_2_svc(nfs_fh
*, struct svc_req
*);
269 extern nfsattrstat
*nfsproc_setattr_2_svc(nfssattrargs
*, struct svc_req
*);
270 extern void *nfsproc_root_2_svc(void *, struct svc_req
*);
271 extern nfsdiropres
*nfsproc_lookup_2_svc(nfsdiropargs
*, struct svc_req
*);
272 extern nfsreadlinkres
*nfsproc_readlink_2_svc(nfs_fh
*, struct svc_req
*);
273 extern nfsreadres
*nfsproc_read_2_svc(nfsreadargs
*, struct svc_req
*);
274 extern void *nfsproc_writecache_2_svc(void *, struct svc_req
*);
275 extern nfsattrstat
*nfsproc_write_2_svc(nfswriteargs
*, struct svc_req
*);
276 extern nfsdiropres
*nfsproc_create_2_svc(nfscreateargs
*, struct svc_req
*);
277 extern nfsstat
*nfsproc_remove_2_svc(nfsdiropargs
*, struct svc_req
*);
278 extern nfsstat
*nfsproc_rename_2_svc(nfsrenameargs
*, struct svc_req
*);
279 extern nfsstat
*nfsproc_link_2_svc(nfslinkargs
*, struct svc_req
*);
280 extern nfsstat
*nfsproc_symlink_2_svc(nfssymlinkargs
*, struct svc_req
*);
281 extern nfsdiropres
*nfsproc_mkdir_2_svc(nfscreateargs
*, struct svc_req
*);
282 extern nfsstat
*nfsproc_rmdir_2_svc(nfsdiropargs
*, struct svc_req
*);
283 extern nfsreaddirres
*nfsproc_readdir_2_svc(nfsreaddirargs
*, struct svc_req
*);
284 extern nfsstatfsres
*nfsproc_statfs_2_svc(nfs_fh
*, struct svc_req
*);
286 extern bool_t
xdr_nfsstat(XDR
*, nfsstat
*);
287 extern bool_t
xdr_ftype(XDR
*, nfsftype
*);
288 extern bool_t
xdr_nfs_fh(XDR
*, nfs_fh
*);
289 extern bool_t
xdr_nfstime(XDR
*, nfstime
*);
290 extern bool_t
xdr_fattr(XDR
*, nfsfattr
*);
291 extern bool_t
xdr_sattr(XDR
*, nfssattr
*);
292 extern bool_t
xdr_filename(XDR
*, filename
*);
293 extern bool_t
xdr_nfspath(XDR
*, nfspath
*);
294 extern bool_t
xdr_attrstat(XDR
*, nfsattrstat
*);
295 extern bool_t
xdr_sattrargs(XDR
*, nfssattrargs
*);
296 extern bool_t
xdr_diropargs(XDR
*, nfsdiropargs
*);
297 extern bool_t
xdr_diropokres(XDR
*, nfsdiropokres
*);
298 extern bool_t
xdr_diropres(XDR
*, nfsdiropres
*);
299 extern bool_t
xdr_readlinkres(XDR
*, nfsreadlinkres
*);
300 extern bool_t
xdr_readargs(XDR
*, nfsreadargs
*);
301 extern bool_t
xdr_readokres(XDR
*, nfsreadokres
*);
302 extern bool_t
xdr_readres(XDR
*, nfsreadres
*);
303 extern bool_t
xdr_writeargs(XDR
*, nfswriteargs
*);
304 extern bool_t
xdr_createargs(XDR
*, nfscreateargs
*);
305 extern bool_t
xdr_renameargs(XDR
*, nfsrenameargs
*);
306 extern bool_t
xdr_linkargs(XDR
*, nfslinkargs
*);
307 extern bool_t
xdr_symlinkargs(XDR
*, nfssymlinkargs
*);
308 extern bool_t
xdr_nfscookie(XDR
*, nfscookie
);
309 extern bool_t
xdr_readdirargs(XDR
*, nfsreaddirargs
*);
310 extern bool_t
xdr_entry(XDR
*, nfsentry
*);
311 extern bool_t
xdr_dirlist(XDR
*, nfsdirlist
*);
312 extern bool_t
xdr_readdirres(XDR
*, nfsreaddirres
*);
313 extern bool_t
xdr_statfsokres(XDR
*, nfsstatfsokres
*);
314 extern bool_t
xdr_statfsres(XDR
*, nfsstatfsres
*);
320 /* This is similar to Solaris 2.5.1 */
322 struct netbuf
*addr
; /* file server address */
323 struct netbuf
*syncaddr
; /* secure NFS time sync addr */
324 struct knetconfig
*knconf
; /* transport netconfig struct */
325 char *hostname
; /* server's hostname */
326 char *netname
; /* server's netname */
327 caddr_t fh
; /* File handle to be mounted */
328 int flags
; /* flags */
329 int wsize
; /* write size in bytes */
330 int rsize
; /* read size in bytes */
331 int timeo
; /* initial timeout in .1 secs */
332 int retrans
; /* times to retry send */
333 int acregmin
; /* attr cache file min secs */
334 int acregmax
; /* attr cache file max secs */
335 int acdirmin
; /* attr cache dir min secs */
336 int acdirmax
; /* attr cache dir max secs */
337 char *fsname
; /* F/S name */
339 struct pathcnf
*pathconf
; /* static pathconf kludge */
344 char fh_data
[NFS_FHSIZE
];
387 nfssattr sag_attributes
;
391 nfs_fh da_fhandle
; /* was dir */
397 nfsfattr drok_attributes
;
401 nfsstat dr_status
; /* was status */
403 nfsdiropokres dr_drok_u
; /* was diropres */
404 } dr_u
; /* was diropres_u */
422 nfsfattr raok_attributes
;
432 nfsreadokres rr_reply_u
;
438 u_int wra_beginoffset
;
440 u_int wra_totalcount
;
448 nfsdiropargs ca_where
;
449 nfssattr ca_attributes
;
453 nfsdiropargs rna_from
;
463 nfsdiropargs sla_from
;
465 nfssattr sla_attributes
;
470 nfscookie rda_cookie
;
478 nfsentry
*ne_nextentry
;
482 nfsentry
*dl_entries
;
489 nfsdirlist rdr_reply_u
;
504 nfsstatfsokres sfr_reply_u
;
509 **************************************************************************
510 * HP-UX 11 has Autofs support, but we don't support it yet.
511 * For now, undefine it or define dummy entries.
512 **************************************************************************
514 #ifdef MNTTYPE_AUTOFS
515 # undef MNTTYPE_AUTOFS
516 #endif /* MNTTYPE_AUTOFS */
517 #ifdef MNTTAB_TYPE_AUTOFS
518 # undef MNTTAB_TYPE_AUTOFS
519 #endif /* MNTTAB_TYPE_AUTOFS */
520 #ifdef HAVE_FS_AUTOFS
521 # undef HAVE_FS_AUTOFS
522 #endif /* HAVE_FS_AUTOFS */
526 #define NFSPROC3_LOOKUP ((u_long) 3)
544 NFS3ERR_NAMETOOLONG
= 63,
545 NFS3ERR_NOTEMPTY
= 66,
549 NFS3ERR_BADHANDLE
= 10001,
550 NFS3ERR_NOT_SYNC
= 10002,
551 NFS3ERR_BAD_COOKIE
= 10003,
552 NFS3ERR_NOTSUPP
= 10004,
553 NFS3ERR_TOOSMALL
= 10005,
554 NFS3ERR_SERVERFAULT
= 10006,
555 NFS3ERR_BADTYPE
= 10007,
556 NFS3ERR_JUKEBOX
= 10008
558 typedef enum nfsstat3 nfsstat3
;
560 typedef char *filename3
;
566 typedef struct diropargs3 diropargs3
;
571 typedef struct LOOKUP3args LOOKUP3args
;
573 struct LOOKUP3resok
{
574 hpux11_nfs_fh3 object
;
576 post_op_attr obj_attributes
;
577 post_op_attr dir_attributes
;
580 typedef struct LOOKUP3resok LOOKUP3resok
;
582 struct LOOKUP3resfail
{
585 post_op_attr dir_attributes
;
588 typedef struct LOOKUP3resfail LOOKUP3resfail
;
597 typedef struct LOOKUP3res LOOKUP3res
;
599 # endif /* MNTTYPE_NFS3 */
601 #endif /* not _AMU_NFS_PROT_H */