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_bsdi2.h
46 #ifndef _AMU_NFS_PROT_H
47 #define _AMU_NFS_PROT_H
49 #ifdef HAVE_NFS_NFSV2_H
50 # include <nfs/nfsv2.h>
51 #endif /* HAVE_NFS_NFSV2_H */
52 #ifdef HAVE_NFS_RPCV2_H
53 # include <nfs/rpcv2.h>
54 #endif /* HAVE_NFS_RPCV2_H */
57 #endif /* HAVE_NFS_NFS_H */
58 #ifdef HAVE_SYS_FS_NFS_H
59 # include <sys/fs/nfs.h>
60 #endif /* HAVE_SYS_FS_NFS_H */
61 #ifdef HAVE_RPCSVC_MOUNT_H
62 # include <rpcsvc/mount.h>
63 #endif /* HAVE_RPCSVC_MOUNT_H */
65 #ifdef HAVE_UFS_UFS_UFSMOUNT_H
68 # endif /* not MAXQUOTAS */
69 /* fake structure: too difficult to include other headers here */
70 struct netexport
{ int this_is_SO_wrong
; };
71 # include <ufs/ufs/ufsmount.h>
72 #endif /* HAVE_UFS_UFS_UFSMOUNT_H */
75 * <msdosfs/msdosfsmount.h> is for kernel only on bsdi2, so do not
78 #ifndef ____MSDOSFS_MSDOSFSMOUNT_H__
79 # define ____MSDOSFS_MSDOSFSMOUNT_H__
80 #endif /* ____MSDOSFS_MSDOSFSMOUNT_H__ */
83 * getifaddrs() on bsdi2 is broken. Don't use it.
85 #ifdef HAVE_GETIFADDRS
86 # undef HAVE_GETIFADDRS
87 #endif /* HAVE_GETIFADDRS */
96 # define NFS_MAXDATA 8192
97 #endif /* NFS_MAXDATA */
98 #define NFS_MAXPATHLEN 1024
99 #define NFS_MAXNAMLEN 255
100 #define NFS_FHSIZE 32
101 #define NFS_COOKIESIZE 4
102 #define MNTPATHLEN 1024
103 #define MNTNAMLEN 255
105 #define NFSMODE_FMT 0170000
106 #define NFSMODE_DIR 0040000
107 #define NFSMODE_CHR 0020000
108 #define NFSMODE_BLK 0060000
109 #define NFSMODE_REG 0100000
110 #define NFSMODE_LNK 0120000
111 #define NFSMODE_SOCK 0140000
112 #define NFSMODE_FIFO 0010000
115 # define NFS_PROGRAM ((u_long)100003)
116 #endif /* not NFS_PROGRAM */
118 # define NFS_VERSION ((u_long)2)
119 #endif /* not NFS_VERSION */
122 * BSD/OS 2.1 deprecated NFSPROC_ROOT and NFSPROC_WRITECACHE and set them
124 * Since amd is its own NFS server, reinstate them.
126 #if (NFSPROC_ROOT == NFSPROC_NOOP)
128 # define NFSPROC_ROOT 3
129 #endif /* (NFSPROC_ROOT == NFSPROC_NOOP) */
130 #if (NFSPROC_WRITECACHE == NFSPROC_NOOP)
131 # undef NFSPROC_WRITECACHE
132 # define NFSPROC_WRITECACHE 7
133 #endif /* (NFSPROC_WRITECACHE == NFSPROC_NOOP) */
135 /* map field names */
136 #define ex_dir ex_name
137 #define gr_name g_name
138 #define gr_next g_next
139 #define ml_directory ml_path
140 #define ml_hostname ml_name
141 #define ml_next ml_nxt
142 #define fh_data fh_bytes
147 typedef char *dirpath
;
148 typedef char *filename
;
150 typedef char *nfspath
;
151 typedef char nfscookie
[NFS_COOKIESIZE
];
152 typedef nfstype nfsftype
;
153 typedef enum nfsstat nfsstat
;
154 typedef struct attrstat nfsattrstat
;
155 typedef struct createargs nfscreateargs
;
156 typedef struct dirlist nfsdirlist
;
157 typedef struct diropargs nfsdiropargs
;
158 typedef struct diropokres nfsdiropokres
;
159 typedef struct diropres nfsdiropres
;
160 typedef struct entry nfsentry
;
161 typedef struct exports
*exports
;
162 typedef struct exports exportnode
;
163 typedef struct fattr nfsfattr
;
164 typedef struct fhstatus fhstatus
;
165 typedef struct groups
*groups
;
166 typedef struct groups groupnode
;
167 typedef struct linkargs nfslinkargs
;
168 typedef struct mountlist
*mountlist
;
169 typedef struct mountlist mountbody
;
170 typedef struct nfstime nfstime
;
171 typedef struct readargs nfsreadargs
;
172 typedef struct readdirargs nfsreaddirargs
;
173 typedef struct readdirres nfsreaddirres
;
174 typedef struct readlinkres nfsreadlinkres
;
175 typedef struct readokres nfsreadokres
;
176 typedef struct readres nfsreadres
;
177 typedef struct renameargs nfsrenameargs
;
178 typedef struct sattr nfssattr
;
179 typedef struct sattrargs nfssattrargs
;
180 typedef struct statfsokres nfsstatfsokres
;
181 typedef struct statfsres nfsstatfsres
;
182 typedef struct symlinkargs nfssymlinkargs
;
183 typedef struct writeargs nfswriteargs
;
190 extern nfsattrstat
*nfsproc_getattr_2_svc(nfsv2fh_t
*, struct svc_req
*);
191 extern nfsattrstat
*nfsproc_setattr_2_svc(nfssattrargs
*, struct svc_req
*);
192 extern nfsattrstat
*nfsproc_write_2_svc(nfswriteargs
*, struct svc_req
*);
193 extern nfsdiropres
*nfsproc_create_2_svc(nfscreateargs
*, struct svc_req
*);
194 extern nfsdiropres
*nfsproc_lookup_2_svc(nfsdiropargs
*, struct svc_req
*);
195 extern nfsdiropres
*nfsproc_mkdir_2_svc(nfscreateargs
*, struct svc_req
*);
196 extern nfsstat
*nfsproc_link_2_svc(nfslinkargs
*, struct svc_req
*);
197 extern nfsstat
*nfsproc_remove_2_svc(nfsdiropargs
*, struct svc_req
*);
198 extern nfsstat
*nfsproc_rename_2_svc(nfsrenameargs
*, struct svc_req
*);
199 extern nfsstat
*nfsproc_rmdir_2_svc(nfsdiropargs
*, struct svc_req
*);
200 extern nfsstat
*nfsproc_symlink_2_svc(nfssymlinkargs
*, struct svc_req
*);
201 extern nfsreaddirres
*nfsproc_readdir_2_svc(nfsreaddirargs
*, struct svc_req
*);
202 extern nfsreadlinkres
*nfsproc_readlink_2_svc(nfsv2fh_t
*, struct svc_req
*);
203 extern nfsreadres
*nfsproc_read_2_svc(nfsreadargs
*, struct svc_req
*);
204 extern nfsstatfsres
*nfsproc_statfs_2_svc(nfsv2fh_t
*, struct svc_req
*);
205 extern void *nfsproc_null_2_svc(void *, struct svc_req
*);
206 extern void *nfsproc_root_2_svc(void *, struct svc_req
*);
207 extern void *nfsproc_writecache_2_svc(void *, struct svc_req
*);
209 extern bool_t
xdr_attrstat(XDR
*, nfsattrstat
*);
210 extern bool_t
xdr_createargs(XDR
*, nfscreateargs
*);
211 extern bool_t
xdr_dirlist(XDR
*, nfsdirlist
*);
212 extern bool_t
xdr_diropargs(XDR
*, nfsdiropargs
*);
213 extern bool_t
xdr_diropokres(XDR
*, nfsdiropokres
*);
214 extern bool_t
xdr_diropres(XDR
*, nfsdiropres
*);
215 extern bool_t
xdr_entry(XDR
*, nfsentry
*);
216 extern bool_t
xdr_fattr(XDR
*, nfsfattr
*);
217 extern bool_t
xdr_filename(XDR
*, filename
*);
218 extern bool_t
xdr_ftype(XDR
*, nfsftype
*);
219 extern bool_t
xdr_linkargs(XDR
*, nfslinkargs
*);
220 extern bool_t
xdr_mountlist(XDR
*xdrs
, mountlist
*objp
);
221 extern bool_t
xdr_nfs_fh(XDR
*, nfsv2fh_t
*);
222 extern bool_t
xdr_nfscookie(XDR
*, nfscookie
);
223 extern bool_t
xdr_nfspath(XDR
*, nfspath
*);
224 extern bool_t
xdr_nfsstat(XDR
*, nfsstat
*);
225 extern bool_t
xdr_nfstime(XDR
*, nfstime
*);
226 extern bool_t
xdr_readargs(XDR
*, nfsreadargs
*);
227 extern bool_t
xdr_readdirargs(XDR
*, nfsreaddirargs
*);
228 extern bool_t
xdr_readdirres(XDR
*, nfsreaddirres
*);
229 extern bool_t
xdr_readlinkres(XDR
*, nfsreadlinkres
*);
230 extern bool_t
xdr_readokres(XDR
*, nfsreadokres
*);
231 extern bool_t
xdr_readres(XDR
*, nfsreadres
*);
232 extern bool_t
xdr_renameargs(XDR
*, nfsrenameargs
*);
233 extern bool_t
xdr_sattr(XDR
*, nfssattr
*);
234 extern bool_t
xdr_sattrargs(XDR
*, nfssattrargs
*);
235 extern bool_t
xdr_statfsokres(XDR
*, nfsstatfsokres
*);
236 extern bool_t
xdr_statfsres(XDR
*, nfsstatfsres
*);
237 extern bool_t
xdr_symlinkargs(XDR
*, nfssymlinkargs
*);
238 extern bool_t
xdr_writeargs(XDR
*, nfswriteargs
*);
246 * Use AMU_ prefixes so as to not conflict with #define's in <nfs/nfsv2.h>.
247 * It is vital! that the AMU_* match one-to-one with the NFS_OK and NFSERR_*
248 * codes listed in <nfs/nfsv2.h>.
253 AMU_NFSERR_NOENT
= 2,
256 AMU_NFSERR_ACCES
= 13,
257 AMU_NFSERR_EXIST
= 17,
258 AMU_NFSERR_NODEV
= 19,
259 AMU_NFSERR_NOTDIR
= 20,
260 AMU_NFSERR_ISDIR
= 21,
261 AMU_NFSERR_FBIG
= 27,
262 AMU_NFSERR_NOSPC
= 28,
263 AMU_NFSERR_ROFS
= 30,
264 AMU_NFSERR_NAMETOOLONG
= 63,
265 AMU_NFSERR_NOTEMPTY
= 66,
266 AMU_NFSERR_DQUOT
= 69,
267 AMU_NFSERR_STALE
= 70,
268 AMU_NFSERR_WFLUSH
= 99
315 nfsv2fh_t sag_fhandle
;
316 nfssattr sag_attributes
;
320 nfsv2fh_t da_fhandle
; /* was dir */
325 nfsv2fh_t drok_fhandle
;
326 nfsfattr drok_attributes
;
330 nfsstat dr_status
; /* was status */
332 nfsdiropokres dr_drok_u
; /* was diropres */
333 } dr_u
; /* was diropres_u */
344 nfsv2fh_t ra_fhandle
;
351 nfsfattr raok_attributes
;
361 nfsreadokres rr_reply_u
;
366 nfsv2fh_t wra_fhandle
;
367 u_int wra_beginoffset
;
369 u_int wra_totalcount
;
377 nfsdiropargs ca_where
;
378 nfssattr ca_attributes
;
382 nfsdiropargs rna_from
;
387 nfsv2fh_t la_fhandle
;
392 nfsdiropargs sla_from
;
394 nfssattr sla_attributes
;
398 nfsv2fh_t rda_fhandle
;
399 nfscookie rda_cookie
;
407 nfsentry
*ne_nextentry
;
411 nfsentry
*dl_entries
;
418 nfsdirlist rdr_reply_u
;
433 nfsstatfsokres sfr_reply_u
;
438 /****************************************************************************/
439 /*** XDR ADDITIONS ***/
440 /****************************************************************************/
448 typedef char fhandle
[NFS_FHSIZE
];
464 dirpath ml_directory
;
469 /****************************************************************************/
470 /*** NFS ADDITIONS ***/
471 /****************************************************************************/
474 # define MOUNTPROG RPCPROG_MNT
475 #endif /* not MOUNTPROG */
478 # define MOUNTVERS RPCMNT_VER1
479 #endif /* not MOUNTVERS */
481 #ifndef MOUNTPROC_MNT
482 # define MOUNTPROC_MNT RPCMNT_MOUNT
483 #endif /* not MOUNTPROC_MNT */
485 #ifndef MOUNTPROC_DUMP
486 # define MOUNTPROC_DUMP RPCMNT_DUMP
487 #endif /* not MOUNTPROC_DUMP */
489 #ifndef MOUNTPROC_UMNT
490 # define MOUNTPROC_UMNT RPCMNT_UMOUNT
491 #endif /* not MOUNTPROC_UMNT */
493 #ifndef MOUNTPROC_UMNTALL
494 # define MOUNTPROC_UMNTALL RPCMNT_UMNTALL
495 #endif /* not MOUNTPROC_UMNTALL */
497 #ifndef MOUNTPROC_EXPORT
498 # define MOUNTPROC_EXPORT RPCMNT_EXPORT
499 #endif /* not MOUNTPROC_EXPORT */
502 #endif /* not _AMU_NFS_PROT_H */