Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / bsd / am-utils / dist / conf / nfs_prot / nfs_prot_osf4.h
blobb21ce8441af3e63752cea3b031d9e0ec2a6f57df
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_osf4.h
46 #ifndef _AMU_NFS_PROT_H
47 #define _AMU_NFS_PROT_H
49 #ifdef HAVE_RPCSVC_NFS_PROT_H
50 # include <rpcsvc/nfs_prot.h>
51 #endif /* HAVE_RPCSVC_NFS_PROT_H */
52 #ifdef HAVE_NFS_NFS_H
53 # include <nfs/nfs.h>
54 #endif /* HAVE_NFS_NFS_H */
55 #ifdef HAVE_RPCSVC_MOUNTV3_H
56 # include <rpcsvc/mountv3.h>
57 #endif /* HAVE_RPCSVC_MOUNTV3_H */
58 #ifdef HAVE_RPC_RPC_H
59 # include <rpc/rpc.h>
60 #endif /* HAVE_RPC_RPC_H */
62 /* avoid conflicts with Irix's EFS */
63 #undef MOUNT_EFS /* DCE Episode FS */
66 * MACROS
69 #define NFS_PORT 2049
70 #define NFS_MAXDATA 8192
71 #define NFS_MAXPATHLEN 1024
72 #define NFS_MAXNAMLEN 255
73 #define NFS_FHSIZE 32
74 #define NFS_COOKIESIZE 4
75 #define MNTPATHLEN 1024
76 #define MNTNAMLEN 255
78 #define NFSMODE_FMT 0170000
79 #define NFSMODE_DIR 0040000
80 #define NFSMODE_CHR 0020000
81 #define NFSMODE_BLK 0060000
82 #define NFSMODE_REG 0100000
83 #define NFSMODE_LNK 0120000
84 #define NFSMODE_SOCK 0140000
85 #define NFSMODE_FIFO 0010000
87 #ifndef NFS_PROGRAM
88 # define NFS_PROGRAM ((u_long)100003)
89 #endif /* not NFS_PROGRAM */
90 #ifndef NFS_VERSION
91 # define NFS_VERSION ((u_long)2)
92 #endif /* not NFS_VERSION */
94 #define NFSPROC_NULL ((u_long)0)
95 #define NFSPROC_GETATTR ((u_long)1)
96 #define NFSPROC_SETATTR ((u_long)2)
97 #define NFSPROC_ROOT ((u_long)3)
98 #define NFSPROC_LOOKUP ((u_long)4)
99 #define NFSPROC_READLINK ((u_long)5)
100 #define NFSPROC_READ ((u_long)6)
101 #define NFSPROC_WRITECACHE ((u_long)7)
102 #define NFSPROC_WRITE ((u_long)8)
103 #define NFSPROC_CREATE ((u_long)9)
104 #define NFSPROC_REMOVE ((u_long)10)
105 #define NFSPROC_RENAME ((u_long)11)
106 #define NFSPROC_LINK ((u_long)12)
107 #define NFSPROC_SYMLINK ((u_long)13)
108 #define NFSPROC_MKDIR ((u_long)14)
109 #define NFSPROC_RMDIR ((u_long)15)
110 #define NFSPROC_READDIR ((u_long)16)
111 #define NFSPROC_STATFS ((u_long)17)
113 /* map field names */
114 #define ml_hostname ml_name
115 #define ml_directory ml_path
116 #define ml_next ml_nxt
117 #define gr_next g_next
118 #define gr_name g_name
119 #define ex_dir ex_name
121 #define drok_attributes drok_attr
122 #define na_fileid na_nodeid
123 #define la_fhandle la_from
124 #define nt_seconds tv_sec
125 #define nt_useconds tv_usec
126 #define ra_totalcount ra_totcount
127 #define sla_to sla_tnm
128 #define sla_attributes sla_sa
129 #define sag_fhandle saa_fh
130 #define sag_attributes saa_sa
131 #define sfrok_tsize fsok_tsize
132 #define sfrok_bsize fsok_bsize
133 #define sfrok_blocks fsok_blocks
134 #define sfrok_bfree fsok_bfree
135 #define sfrok_bavail fsok_bavail
136 #define sfr_status fs_status
137 #define sfr_u fs_u
138 #define sfr_reply_u fs_fsok_u
139 #define wra_fhandle wa_fhandle
140 #define wra_beginoffset wa_begoff
141 #define wra_offset wa_offset
142 #define wra_totalcount wa_totcount
143 #define wra_u wa_mbuf->m_hdr
144 #define wra_val_u mh_data
145 #define wra_len_u mh_len
149 * TYPEDEFS:
151 typedef char *dirpath;
152 typedef char *filename;
153 typedef char *name;
154 typedef char *nfspath;
155 typedef char nfscookie[NFS_COOKIESIZE];
156 typedef enum nfsftype nfsftype;
157 typedef enum nfsstat nfsstat;
158 typedef struct nfssvcfh fhandle;
159 typedef struct nfsattrstat nfsattrstat;
160 typedef struct nfscreateargs nfscreateargs;
161 typedef struct nfsdirlist nfsdirlist;
162 typedef struct nfsdiropargs nfsdiropargs;
163 typedef struct nfsdrok nfsdiropokres;
164 typedef struct nfsdiropres nfsdiropres;
165 typedef struct nfsentry nfsentry;
166 typedef struct exports *exports;
167 typedef struct exports exportnode;
168 typedef struct nfsfattr nfsfattr;
169 typedef struct fhstatus fhstatus;
170 typedef struct groups *groups;
171 typedef struct groups groupnode;
172 typedef struct nfslinkargs nfslinkargs;
173 typedef struct mountlist *mountlist;
174 typedef struct mountlist mountbody;
175 typedef struct _nfs_fh _nfs_fh;
176 typedef struct timeval nfstime;
177 typedef struct nfsreadargs nfsreadargs;
178 typedef struct nfsreaddirargs nfsreaddirargs;
179 typedef struct nfsreaddirres nfsreaddirres;
180 typedef struct nfsreadlinkres nfsreadlinkres;
181 typedef struct nfsreadokres nfsreadokres;
182 typedef struct nfsreadres nfsreadres;
183 typedef struct nfsrenameargs nfsrenameargs;
184 typedef struct nfssattr nfssattr;
185 typedef struct nfssaargs nfssattrargs;
186 typedef struct nfsstatfsok nfsstatfsokres;
187 typedef struct nfsstatfs nfsstatfsres;
188 typedef struct nfsslargs nfssymlinkargs;
189 typedef struct nfswriteargs nfswriteargs;
193 * EXTERNALS: (some are missing from system headers)
196 extern void *nfsproc_null_2_svc(void *, struct svc_req *);
197 extern nfsattrstat *nfsproc_getattr_2_svc(struct nfssvcfh *, struct svc_req *);
198 extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *);
199 extern void *nfsproc_root_2_svc(void *, struct svc_req *);
200 extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *);
201 extern nfsreadlinkres *nfsproc_readlink_2_svc(struct nfssvcfh *, struct svc_req *);
202 extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *);
203 extern void *nfsproc_writecache_2_svc(void *, struct svc_req *);
204 extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *);
205 extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *);
206 extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *);
207 extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *);
208 extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *);
209 extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *);
210 extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *);
211 extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *);
212 extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *);
213 extern nfsstatfsres *nfsproc_statfs_2_svc(struct nfssvcfh *, struct svc_req *);
214 extern int plock(int op);
215 extern const char *hstrerror(int err);
216 extern int getmntinfo(struct statfs **mntbufp, int flags);
218 extern bool_t xdr_nfsstat(XDR *, nfsstat*);
219 extern bool_t xdr_ftype(XDR *, nfsftype*);
220 extern bool_t xdr_nfs_fh(XDR *, struct nfssvcfh*);
221 extern bool_t xdr_nfstime(XDR *, nfstime*);
222 extern bool_t xdr_fattr(XDR *, nfsfattr*);
223 extern bool_t xdr_sattr(XDR *, nfssattr*);
224 extern bool_t xdr_filename(XDR *, filename*);
225 extern bool_t xdr_nfspath(XDR *, nfspath*);
226 extern bool_t xdr_attrstat(XDR *, nfsattrstat*);
227 extern bool_t xdr_sattrargs(XDR *, nfssattrargs*);
228 extern bool_t xdr_diropargs(XDR *, nfsdiropargs*);
229 extern bool_t xdr_diropokres(XDR *, nfsdiropokres*);
230 extern bool_t xdr_diropres(XDR *, nfsdiropres*);
231 extern bool_t xdr_readlinkres(XDR *, nfsreadlinkres*);
232 extern bool_t xdr_readargs(XDR *, nfsreadargs*);
233 extern bool_t xdr_readokres(XDR *, nfsreadokres*);
234 extern bool_t xdr_readres(XDR *, nfsreadres*);
235 extern bool_t xdr_writeargs(XDR *, nfswriteargs*);
236 extern bool_t xdr_createargs(XDR *, nfscreateargs*);
237 extern bool_t xdr_renameargs(XDR *, nfsrenameargs*);
238 extern bool_t xdr_linkargs(XDR *, nfslinkargs*);
239 extern bool_t xdr_symlinkargs(XDR *, nfssymlinkargs*);
240 extern bool_t xdr_nfscookie(XDR *, nfscookie);
241 extern bool_t xdr_readdirargs(XDR *, nfsreaddirargs*);
242 extern bool_t xdr_entry(XDR *, nfsentry*);
243 extern bool_t xdr_dirlist(XDR *, nfsdirlist*);
244 extern bool_t xdr_readdirres(XDR *, nfsreaddirres*);
245 extern bool_t xdr_statfsokres(XDR *, nfsstatfsokres*);
246 extern bool_t xdr_statfsres(XDR *, nfsstatfsres*);
247 extern bool_t xdr_exportnode (XDR *, exportnode*);
248 extern bool_t xdr_groups (XDR *, groups*);
253 * STRUCTURES:
256 struct _nfs_fh {
257 char data[NFS_FHSIZE];
260 struct nfstime {
261 u_int nt_seconds;
262 u_int nt_useconds;
265 struct _fattr {
266 nfsftype na_type;
267 u_int na_mode;
268 u_int na_nlink;
269 u_int na_uid;
270 u_int na_gid;
271 u_int na_size;
272 u_int na_blocksize;
273 u_int na_rdev;
274 u_int na_blocks;
275 u_int na_fsid;
276 u_int na_fileid;
277 nfstime na_atime;
278 nfstime na_mtime;
279 nfstime na_ctime;
282 struct _sattr {
283 u_int sa_mode;
284 u_int sa_uid;
285 u_int sa_gid;
286 u_int sa_size;
287 nfstime sa_atime;
288 nfstime sa_mtime;
291 struct _attrstat {
292 nfsstat ns_status;
293 union {
294 nfsfattr ns_attr_u;
295 } ns_u;
298 struct _sattrargs {
299 struct nfssvcfh sag_fhandle;
300 nfssattr sag_attributes;
303 struct _diropargs {
304 struct nfssvcfh da_fhandle; /* was dir */
305 filename da_name;
308 struct _diropokres {
309 struct nfssvcfh drok_fhandle;
310 nfsfattr drok_attributes;
313 struct _diropres {
314 nfsstat dr_status; /* was status */
315 union {
316 nfsdiropokres dr_drok_u; /* was diropres */
317 } dr_u; /* was diropres_u */
320 struct nfsreadlinkres {
321 nfsstat rlr_status;
322 union {
323 nfspath rlr_data_u;
324 } rlr_u;
327 struct _readargs {
328 struct nfssvcfh ra_fhandle;
329 u_int ra_offset;
330 u_int ra_count;
331 u_int ra_totalcount;
334 struct nfsreadokres {
335 nfsfattr raok_attributes;
336 struct {
337 u_int raok_len_u;
338 char *raok_val_u;
339 } raok_u;
342 struct nfsreadres {
343 nfsstat rr_status;
344 union {
345 nfsreadokres rr_reply_u;
346 } rr_u;
349 #if 0
350 struct _writeargs {
351 struct nfssvcfh wra_fhandle;
352 u_int wra_beginoffset;
353 u_int wra_offset;
354 u_int wra_totalcount;
355 struct {
356 u_int wra_len_u;
357 char *wra_val_u;
358 } wra_u;
360 #endif /* 0 */
362 struct nfscreateargs {
363 nfsdiropargs ca_where;
364 nfssattr ca_attributes;
367 struct nfsrenameargs {
368 nfsdiropargs rna_from;
369 nfsdiropargs rna_to;
372 struct _linkargs {
373 struct nfssvcfh la_fhandle;
374 nfsdiropargs la_to;
377 struct _symlinkargs {
378 nfsdiropargs sla_from;
379 nfspath sla_to;
380 nfssattr sla_attributes;
383 struct nfsreaddirargs {
384 struct nfssvcfh rda_fhandle;
385 nfscookie rda_cookie;
386 u_int rda_count;
389 struct nfsentry {
390 u_int ne_fileid;
391 filename ne_name;
392 nfscookie ne_cookie;
393 nfsentry *ne_nextentry;
396 struct nfsdirlist {
397 nfsentry *dl_entries;
398 bool_t dl_eof;
401 struct nfsreaddirres {
402 nfsstat rdr_status;
403 union {
404 nfsdirlist rdr_reply_u;
405 } rdr_u;
408 struct _statfsokres {
409 u_int sfrok_tsize;
410 u_int sfrok_bsize;
411 u_int sfrok_blocks;
412 u_int sfrok_bfree;
413 u_int sfrok_bavail;
416 struct _statfsres {
417 nfsstat sfr_status;
418 union {
419 nfsstatfsokres sfr_reply_u;
420 } sfr_u;
423 #endif /* not _AMU_NFS_PROT_H */