Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / bsd / am-utils / dist / conf / nfs_prot / nfs_prot_hpux11.h
blob20beab27b4af6e03d3a59a13b4e6ad1a67d0391c
1 /* $NetBSD$ */
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.
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
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.
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.
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 */
55 #ifndef _TIUSER_H
56 # define _TIUSER_H
57 #endif /* TIUSER_H */
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> */
65 #ifdef T_NULL
66 # undef T_NULL
67 #endif /* T_NULL */
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 */
79 #ifdef HAVE_NFS_NFS_H
80 # include <nfs/nfs.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 */
91 * MACROS
94 #define NFS_PORT 2049
95 #define NFS_MAXDATA 8192
96 #define NFS_MAXPATHLEN 1024
97 #define NFS_MAXNAMLEN 255
98 #define NFS_FHSIZE 32
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
113 #ifndef NFS_PROGRAM
114 # define NFS_PROGRAM ((u_long)100003)
115 #endif /* not NFS_PROGRAM */
116 #ifndef NFS_VERSION
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 */
171 * ENUMS:
175 * Error status
176 * Should include all possible net errors.
177 * For now we just cast errno into an enum nfsstat.
179 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 */
205 * File types
207 enum nfsftype {
208 NFNON,
209 NFREG, /* regular file */
210 NFDIR, /* directory */
211 NFBLK, /* block special */
212 NFCHR, /* character special */
213 NFLNK, /* symbolic link */
214 NFSOC /* socket */
219 * TYPEDEFS:
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 {
258 u_int am_fh3_length;
259 char am_fh3_data[HPUX11_FHSIZE3];
261 typedef struct hpux11_nfs_fh3 hpux11_nfs_fh3;
264 * EXTERNALS:
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*);
317 * STRUCTURES:
320 /* This is similar to Solaris 2.5.1 */
321 struct nfs_args {
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 */
338 #if 0
339 struct pathcnf *pathconf; /* static pathconf kludge */
340 #endif /* 0 */
343 struct nfs_fh {
344 char fh_data[NFS_FHSIZE];
347 struct nfstime {
348 u_int nt_seconds;
349 u_int nt_useconds;
352 struct fattr {
353 nfsftype na_type;
354 u_int na_mode;
355 u_int na_nlink;
356 u_int na_uid;
357 u_int na_gid;
358 u_int na_size;
359 u_int na_blocksize;
360 u_int na_rdev;
361 u_int na_blocks;
362 u_int na_fsid;
363 u_int na_fileid;
364 nfstime na_atime;
365 nfstime na_mtime;
366 nfstime na_ctime;
369 struct sattr {
370 u_int sa_mode;
371 u_int sa_uid;
372 u_int sa_gid;
373 u_int sa_size;
374 nfstime sa_atime;
375 nfstime sa_mtime;
378 struct attrstat {
379 nfsstat ns_status;
380 union {
381 nfsfattr ns_attr_u;
382 } ns_u;
385 struct sattrargs {
386 nfs_fh sag_fhandle;
387 nfssattr sag_attributes;
390 struct diropargs {
391 nfs_fh da_fhandle; /* was dir */
392 filename da_name;
395 struct diropokres {
396 nfs_fh drok_fhandle;
397 nfsfattr drok_attributes;
400 struct diropres {
401 nfsstat dr_status; /* was status */
402 union {
403 nfsdiropokres dr_drok_u; /* was diropres */
404 } dr_u; /* was diropres_u */
407 struct readlinkres {
408 nfsstat rlr_status;
409 union {
410 nfspath rlr_data_u;
411 } rlr_u;
414 struct readargs {
415 nfs_fh ra_fhandle;
416 u_int ra_offset;
417 u_int ra_count;
418 u_int ra_totalcount;
421 struct readokres {
422 nfsfattr raok_attributes;
423 struct {
424 u_int raok_len_u;
425 char *raok_val_u;
426 } raok_u;
429 struct readres {
430 nfsstat rr_status;
431 union {
432 nfsreadokres rr_reply_u;
433 } rr_u;
436 struct writeargs {
437 nfs_fh wra_fhandle;
438 u_int wra_beginoffset;
439 u_int wra_offset;
440 u_int wra_totalcount;
441 struct {
442 u_int wra_len_u;
443 char *wra_val_u;
444 } wra_u;
447 struct createargs {
448 nfsdiropargs ca_where;
449 nfssattr ca_attributes;
452 struct renameargs {
453 nfsdiropargs rna_from;
454 nfsdiropargs rna_to;
457 struct linkargs {
458 nfs_fh la_fhandle;
459 nfsdiropargs la_to;
462 struct symlinkargs {
463 nfsdiropargs sla_from;
464 nfspath sla_to;
465 nfssattr sla_attributes;
468 struct readdirargs {
469 nfs_fh rda_fhandle;
470 nfscookie rda_cookie;
471 u_int rda_count;
474 struct entry {
475 u_int ne_fileid;
476 filename ne_name;
477 nfscookie ne_cookie;
478 nfsentry *ne_nextentry;
481 struct dirlist {
482 nfsentry *dl_entries;
483 bool_t dl_eof;
486 struct readdirres {
487 nfsstat rdr_status;
488 union {
489 nfsdirlist rdr_reply_u;
490 } rdr_u;
493 struct statfsokres {
494 u_int sfrok_tsize;
495 u_int sfrok_bsize;
496 u_int sfrok_blocks;
497 u_int sfrok_bfree;
498 u_int sfrok_bavail;
501 struct statfsres {
502 nfsstat sfr_status;
503 union {
504 nfsstatfsokres sfr_reply_u;
505 } sfr_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 */
524 #ifdef MNTTYPE_NFS3
526 #define NFSPROC3_LOOKUP ((u_long) 3)
527 enum nfsstat3 {
528 NFS3_OK = 0,
529 NFS3ERR_PERM = 1,
530 NFS3ERR_NOENT = 2,
531 NFS3ERR_IO = 5,
532 NFS3ERR_NXIO = 6,
533 NFS3ERR_ACCES = 13,
534 NFS3ERR_EXIST = 17,
535 NFS3ERR_XDEV = 18,
536 NFS3ERR_NODEV = 19,
537 NFS3ERR_NOTDIR = 20,
538 NFS3ERR_ISDIR = 21,
539 NFS3ERR_INVAL = 22,
540 NFS3ERR_FBIG = 27,
541 NFS3ERR_NOSPC = 28,
542 NFS3ERR_ROFS = 30,
543 NFS3ERR_MLINK = 31,
544 NFS3ERR_NAMETOOLONG = 63,
545 NFS3ERR_NOTEMPTY = 66,
546 NFS3ERR_DQUOT = 69,
547 NFS3ERR_STALE = 70,
548 NFS3ERR_REMOTE = 71,
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;
562 struct diropargs3 {
563 hpux11_nfs_fh3 dir;
564 filename3 name;
566 typedef struct diropargs3 diropargs3;
568 struct LOOKUP3args {
569 diropargs3 what;
571 typedef struct LOOKUP3args LOOKUP3args;
573 struct LOOKUP3resok {
574 hpux11_nfs_fh3 object;
575 #if 0
576 post_op_attr obj_attributes;
577 post_op_attr dir_attributes;
578 #endif /* 0 */
580 typedef struct LOOKUP3resok LOOKUP3resok;
582 struct LOOKUP3resfail {
583 int dummy;
584 #if 0
585 post_op_attr dir_attributes;
586 #endif /* 0 */
588 typedef struct LOOKUP3resfail LOOKUP3resfail;
590 struct LOOKUP3res {
591 nfsstat3 status;
592 union {
593 LOOKUP3resok ok;
594 LOOKUP3resfail fail;
595 } res_u;
597 typedef struct LOOKUP3res LOOKUP3res;
599 # endif /* MNTTYPE_NFS3 */
601 #endif /* not _AMU_NFS_PROT_H */