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_ncr2.h
46 #ifndef _AMU_NFS_PROT_H
47 #define _AMU_NFS_PROT_H
50 * Do NOT include <rpcsvc/nfs_prot.h> to get NFS V2 specs, because
51 * it will result in conflicts with <nfs/nfs.h>. The latter is a must
57 #endif /* HAVE_NFS_NFS_H */
59 #ifdef HAVE_RPCSVC_MOUNT_H
60 # include <rpcsvc/mount.h>
61 #endif /* HAVE_RPCSVC_MOUNT_H */
65 #endif /* HAVE_RPC_RPC_H */
72 /* ncr2 does not define this one! Incredible */
74 # define MNTTYPE_NFS "nfs"
75 #endif /* MNTTYPE_NFS */
78 #define NFS_MAXDATA 8192
79 #define NFS_MAXPATHLEN 1024
80 #define NFS_MAXNAMLEN 255
82 #define NFS_COOKIESIZE 4
84 #define NFSMODE_FMT 0170000
85 #define NFSMODE_DIR 0040000
86 #define NFSMODE_CHR 0020000
87 #define NFSMODE_BLK 0060000
88 #define NFSMODE_REG 0100000
89 #define NFSMODE_LNK 0120000
90 #define NFSMODE_SOCK 0140000
91 #define NFSMODE_FIFO 0010000
93 #define NFSPROC_NULL ((unsigned long)(0))
94 #define NFSPROC_GETATTR ((unsigned long)(1))
95 #define NFSPROC_SETATTR ((unsigned long)(2))
96 #define NFSPROC_ROOT ((unsigned long)(3))
97 #define NFSPROC_LOOKUP ((unsigned long)(4))
98 #define NFSPROC_READLINK ((unsigned long)(5))
99 #define NFSPROC_READ ((unsigned long)(6))
100 #define NFSPROC_WRITECACHE ((unsigned long)(7))
101 #define NFSPROC_WRITE ((unsigned long)(8))
102 #define NFSPROC_CREATE ((unsigned long)(9))
103 #define NFSPROC_REMOVE ((unsigned long)(10))
104 #define NFSPROC_RENAME ((unsigned long)(11))
105 #define NFSPROC_LINK ((unsigned long)(12))
106 #define NFSPROC_SYMLINK ((unsigned long)(13))
107 #define NFSPROC_MKDIR ((unsigned long)(14))
108 #define NFSPROC_RMDIR ((unsigned long)(15))
109 #define NFSPROC_READDIR ((unsigned long)(16))
110 #define NFSPROC_STATFS ((unsigned long)(17))
112 /* map field names */
113 #define ml_hostname ml_name
114 #define ml_directory ml_path
115 #define ml_next ml_nxt
116 #define gr_next g_next
117 #define gr_name g_name
118 #define ex_dir ex_name
123 typedef char *dirpath
;
124 typedef char *filename
;
125 typedef char *nfspath
;
126 typedef char nfscookie
[NFS_COOKIESIZE
];
127 typedef enum nfsftype nfsftype
;
128 typedef enum nfsstat nfsstat
;
129 typedef struct attrstat nfsattrstat
;
130 typedef struct createargs nfscreateargs
;
131 typedef struct dirlist nfsdirlist
;
132 typedef struct diropargs nfsdiropargs
;
133 typedef struct diropokres nfsdiropokres
;
134 typedef struct diropres nfsdiropres
;
135 typedef struct entry nfsentry
;
136 typedef struct fattr nfsfattr
;
137 typedef struct linkargs nfslinkargs
;
138 typedef struct nfs_fh nfs_fh
;
139 typedef struct nfstime nfstime
;
140 typedef struct readargs nfsreadargs
;
141 typedef struct readdirargs nfsreaddirargs
;
142 typedef struct readdirres nfsreaddirres
;
143 typedef struct readlinkres nfsreadlinkres
;
144 typedef struct readokres nfsreadokres
;
145 typedef struct readres nfsreadres
;
146 typedef struct renameargs nfsrenameargs
;
147 typedef struct sattr nfssattr
;
148 typedef struct sattrargs nfssattrargs
;
149 typedef struct statfsokres nfsstatfsokres
;
150 typedef struct statfsres nfsstatfsres
;
151 typedef struct symlinkargs nfssymlinkargs
;
152 typedef struct writeargs nfswriteargs
;
155 typedef fhandle_t fhandle
;
156 typedef struct exports
*exports
;
157 typedef struct exports exportnode
;
158 typedef struct fhstatus fhstatus
;
159 typedef struct groups
*groups
;
160 typedef struct groups groupnode
;
161 typedef struct mountlist
*mountlist
;
162 typedef struct mountlist mountbody
;
169 extern bool_t
xdr_nfsstat(XDR
*, nfsstat
*);
170 extern bool_t
xdr_ftype(XDR
*, nfsftype
*);
171 extern bool_t
xdr_nfs_fh(XDR
*, nfs_fh
*);
172 extern bool_t
xdr_nfstime(XDR
*, nfstime
*);
173 extern bool_t
xdr_fattr(XDR
*, nfsfattr
*);
174 extern bool_t
xdr_sattr(XDR
*, nfssattr
*);
175 extern bool_t
xdr_filename(XDR
*, filename
*);
176 extern bool_t
xdr_nfspath(XDR
*, nfspath
*);
177 extern bool_t
xdr_attrstat(XDR
*, nfsattrstat
*);
178 extern bool_t
xdr_sattrargs(XDR
*, nfssattrargs
*);
179 extern bool_t
xdr_diropargs(XDR
*, nfsdiropargs
*);
180 extern bool_t
xdr_diropokres(XDR
*, nfsdiropokres
*);
181 extern bool_t
xdr_diropres(XDR
*, nfsdiropres
*);
182 extern bool_t
xdr_readlinkres(XDR
*, nfsreadlinkres
*);
183 extern bool_t
xdr_readargs(XDR
*, nfsreadargs
*);
184 extern bool_t
xdr_readokres(XDR
*, nfsreadokres
*);
185 extern bool_t
xdr_readres(XDR
*, nfsreadres
*);
186 extern bool_t
xdr_writeargs(XDR
*, nfswriteargs
*);
187 extern bool_t
xdr_createargs(XDR
*, nfscreateargs
*);
188 extern bool_t
xdr_renameargs(XDR
*, nfsrenameargs
*);
189 extern bool_t
xdr_linkargs(XDR
*, nfslinkargs
*);
190 extern bool_t
xdr_symlinkargs(XDR
*, nfssymlinkargs
*);
191 extern bool_t
xdr_nfscookie(XDR
*, nfscookie
);
192 extern bool_t
xdr_readdirargs(XDR
*, nfsreaddirargs
*);
193 extern bool_t
xdr_entry(XDR
*, nfsentry
*);
194 extern bool_t
xdr_dirlist(XDR
*, nfsdirlist
*);
195 extern bool_t
xdr_readdirres(XDR
*, nfsreaddirres
*);
196 extern bool_t
xdr_statfsokres(XDR
*, nfsstatfsokres
*);
197 extern bool_t
xdr_statfsres(XDR
*, nfsstatfsres
*);
199 extern nfsattrstat
*nfsproc_getattr_2(nfs_fh
*, CLIENT
*);
200 extern nfsattrstat
*nfsproc_getattr_2_svc(nfs_fh
*, struct svc_req
*);
201 extern nfsattrstat
*nfsproc_setattr_2(nfssattrargs
*, CLIENT
*);
202 extern nfsattrstat
*nfsproc_setattr_2_svc(nfssattrargs
*, struct svc_req
*);
203 extern nfsattrstat
*nfsproc_write_2(nfswriteargs
*, CLIENT
*);
204 extern nfsattrstat
*nfsproc_write_2_svc(nfswriteargs
*, struct svc_req
*);
205 extern nfsdiropres
*nfsproc_create_2(nfscreateargs
*, CLIENT
*);
206 extern nfsdiropres
*nfsproc_create_2_svc(nfscreateargs
*, struct svc_req
*);
207 extern nfsdiropres
*nfsproc_lookup_2(nfsdiropargs
*, CLIENT
*);
208 extern nfsdiropres
*nfsproc_lookup_2_svc(nfsdiropargs
*, struct svc_req
*);
209 extern nfsdiropres
*nfsproc_mkdir_2(nfscreateargs
*, CLIENT
*);
210 extern nfsdiropres
*nfsproc_mkdir_2_svc(nfscreateargs
*, struct svc_req
*);
211 extern nfsstat
*nfsproc_link_2(nfslinkargs
*, CLIENT
*);
212 extern nfsstat
*nfsproc_link_2_svc(nfslinkargs
*, struct svc_req
*);
213 extern nfsstat
*nfsproc_remove_2(nfsdiropargs
*, CLIENT
*);
214 extern nfsstat
*nfsproc_remove_2_svc(nfsdiropargs
*, struct svc_req
*);
215 extern nfsstat
*nfsproc_rename_2(nfsrenameargs
*, CLIENT
*);
216 extern nfsstat
*nfsproc_rename_2_svc(nfsrenameargs
*, struct svc_req
*);
217 extern nfsstat
*nfsproc_rmdir_2(nfsdiropargs
*, CLIENT
*);
218 extern nfsstat
*nfsproc_rmdir_2_svc(nfsdiropargs
*, struct svc_req
*);
219 extern nfsstat
*nfsproc_symlink_2(nfssymlinkargs
*, CLIENT
*);
220 extern nfsstat
*nfsproc_symlink_2_svc(nfssymlinkargs
*, struct svc_req
*);
221 extern nfsreaddirres
*nfsproc_readdir_2(nfsreaddirargs
*, CLIENT
*);
222 extern nfsreaddirres
*nfsproc_readdir_2_svc(nfsreaddirargs
*, struct svc_req
*);
223 extern nfsreadlinkres
*nfsproc_readlink_2(nfs_fh
*, CLIENT
*);
224 extern nfsreadlinkres
*nfsproc_readlink_2_svc(nfs_fh
*, struct svc_req
*);
225 extern nfsreadres
*nfsproc_read_2(nfsreadargs
*, CLIENT
*);
226 extern nfsreadres
*nfsproc_read_2_svc(nfsreadargs
*, struct svc_req
*);
227 extern nfsstatfsres
*nfsproc_statfs_2(nfs_fh
*, CLIENT
*);
228 extern nfsstatfsres
*nfsproc_statfs_2_svc(nfs_fh
*, struct svc_req
*);
229 extern void *nfsproc_null_2(void *, CLIENT
*);
230 extern void *nfsproc_null_2_svc(void *, struct svc_req
*);
231 extern void *nfsproc_root_2(void *, CLIENT
*);
232 extern void *nfsproc_root_2_svc(void *, struct svc_req
*);
233 extern void *nfsproc_writecache_2(void *, CLIENT
*);
234 extern void *nfsproc_writecache_2_svc(void *, struct svc_req
*);
235 extern int nfs_program_2_freeresult(SVCXPRT
*, xdrproc_t
, caddr_t
);
246 /* ncr2 (sysv4) forgets to include this in <sys/resource.h> */
248 struct timeval ru_utime
; /* user time used */
249 struct timeval ru_stime
; /* system time used */
250 long ru_maxrss
; /* XXX: 0 */
251 long ru_ixrss
; /* XXX: 0 */
252 long ru_idrss
; /* XXX: sum of rm_asrss */
253 long ru_isrss
; /* XXX: 0 */
254 long ru_minflt
; /* any page faults not requiring I/O */
255 long ru_majflt
; /* any page faults requiring I/O */
256 long ru_nswap
; /* swaps */
257 long ru_inblock
; /* block input operations */
258 long ru_oublock
; /* block output operations */
259 long ru_msgsnd
; /* messages sent */
260 long ru_msgrcv
; /* messages received */
261 long ru_nsignals
; /* signals received */
262 long ru_nvcsw
; /* voluntary context switches */
263 long ru_nivcsw
; /* involuntary " */
267 * ncr2 has ndbm functions, but no <ndbm.h>
268 * only a partial <rpcsvc/dbm.h>
273 int dbm_dirf
; /* open directory file */
274 int dbm_pagf
; /* open page file */
275 int dbm_flags
; /* flags, see below */
276 long dbm_maxbno
; /* last ``bit'' in dir file */
277 long dbm_bitno
; /* current bit number */
278 long dbm_hmask
; /* hash mask */
279 long dbm_blkptr
; /* current block for dbm_nextkey */
280 int dbm_keyptr
; /* current key for dbm_nextkey */
281 long dbm_blkno
; /* current page to read/write */
282 long dbm_pagbno
; /* current page in pagbuf */
283 char dbm_pagbuf
[PBLKSIZ
]; /* page file block buffer */
284 long dbm_dirbno
; /* current block in dirbuf */
285 char dbm_dirbuf
[DBLKSIZ
]; /* directory file block buffer */
287 #define _DBM_RDONLY 0x1 /* data base open read-only */
288 #define _DBM_IOERR 0x2 /* data base I/O error */
289 #define dbm_rdonly(db) ((db)->dbm_flags & _DBM_RDONLY)
290 #define dbm_error(db) ((db)->dbm_flags & _DBM_IOERR)
291 /* use this one at your own risk! */
292 #define dbm_clearerr(db) ((db)->dbm_flags &= ~_DBM_IOERR)
294 #define dbm_dirfno(db) ((db)->dbm_dirf)
295 #define dbm_pagfno(db) ((db)->dbm_pagf)
297 * flags to dbm_store()
300 #define DBM_REPLACE 1
301 extern DBM
*dbm_open(char *, int, int);
302 extern void dbm_close(DBM
*);
309 #endif /* not DATUM */
310 extern datum
dbm_fetch(DBM
*, datum
);
311 extern datum
dbm_firstkey(DBM
*);
312 extern datum
dbm_nextkey(DBM
*);
313 extern int dbm_delete(DBM
*, datum
);
314 extern int dbm_store(DBM
*, datum
, datum
, int);
318 char fh_data
[NFS_FHSIZE
];
361 nfssattr sag_attributes
;
365 nfs_fh da_fhandle
; /* was dir */
371 nfsfattr drok_attributes
;
375 nfsstat dr_status
; /* was status */
377 nfsdiropokres dr_drok_u
; /* was diropres */
378 } dr_u
; /* was diropres_u */
396 nfsfattr raok_attributes
;
406 nfsreadokres rr_reply_u
;
412 u_int wra_beginoffset
;
414 u_int wra_totalcount
;
422 nfsdiropargs ca_where
;
423 nfssattr ca_attributes
;
427 nfsdiropargs rna_from
;
437 nfsdiropargs sla_from
;
439 nfssattr sla_attributes
;
444 nfscookie rda_cookie
;
452 nfsentry
*ne_nextentry
;
456 nfsentry
*dl_entries
;
463 nfsdirlist rdr_reply_u
;
478 nfsstatfsokres sfr_reply_u
;
482 #endif /* not _AMU_NFS_PROT_H */