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_linux.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 */
54 * Hard-code support for some file systems so the built amd
55 * binary can always run them. Also, this helps detection of iso9660
56 * file system for which the module isn't named as the file system mount
59 #include <linux/version.h>
60 #ifndef KERNEL_VERSION
61 # define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
62 #endif /* not KERNEL_VERSION */
63 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
66 # endif /* not MS_BIND */
69 # define MNTTYPE_LOFS "bind"
70 # endif /* not MNTTYPE_LOFS */
71 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) */
73 #ifndef MNTTYPE_ISO9660
74 # define MNTTYPE_ISO9660 "iso9660"
75 #endif /* not MNTTYPE_ISO9660 */
79 #endif /* not FHSIZE */
82 #endif /* not FHSIZE3 */
86 # define MNTTYPE_NFS3 "nfs"
87 #endif /* not MNTTYPE_NFS3 */
88 #endif /* HAVE_FS_NFS3 */
91 * These two force/lazy unmount flags are sometimes missing from some linux
96 # define MNT_FORCE 0x1 /* from <sys/mount.h> */
97 # endif /* not MNT_FORCE */
99 # define MNT_DETACH 0x2 /* from kernel <linux/fs.h> */
100 # endif /* not MNT_DETACH */
101 #endif /* HAVE_UMOUNT2 */
103 /* XXX: hack until we have a better way to detect /dev/loop devices */
104 #ifdef HAVE_LINUX_LOOP_H
105 # define HAVE_LOOP_DEVICE
106 extern char *setup_loop_device(const char *file
);
107 extern int delete_loop_device(const char *device
);
108 #endif /* HAVE_LINUX_LOOP_H */
114 #define dr_drok_u diropres
115 #define ca_attributes attributes
116 #define ca_where where
117 #define da_fhandle dir
119 #define dl_entries entries
121 #define dr_status status
122 #define dr_u diropres_u
123 #define drok_attributes attributes
124 #define drok_fhandle file
126 #define fhsize root.size
127 #define la_fhandle from
129 #define na_atime atime
130 #define na_blocks blocks
131 #define na_blocksize blocksize
132 #define na_ctime ctime
133 #define na_fileid fileid
137 #define na_mtime mtime
138 #define na_nlink nlink
143 #define ne_cookie cookie
144 #define ne_fileid fileid
146 #define ne_nextentry nextentry
147 #define ns_attr_u attributes
148 #define ns_status status
149 #define ns_u attrstat_u
150 #define nt_seconds seconds
151 #define nt_useconds useconds
152 #define ra_count count
153 #define ra_fhandle file
154 #define ra_offset offset
155 #define ra_totalcount totalcount
156 #define raok_attributes attributes
157 #define raok_len_u data_len
159 #define raok_val_u data_val
160 #define rda_cookie cookie
161 #define rda_count count
162 #define rda_fhandle dir
163 #define rdr_reply_u reply
164 #define rdr_status status
165 #define rdr_u readdirres_u
166 #define rlr_data_u data
167 #define rlr_status status
168 #define rlr_u readlinkres_u
169 #define rna_from from
171 #define rr_reply_u reply
172 #define rr_status status
173 #define rr_u readres_u
174 #define sa_atime atime
177 #define sa_mtime mtime
180 #define sag_attributes attributes
181 #define sag_fhandle file
182 #define sfr_reply_u reply
183 #define sfr_status status
184 #define sfr_u statfsres_u
185 #define sfrok_bavail bavail
186 #define sfrok_bfree bfree
187 #define sfrok_blocks blocks
188 #define sfrok_bsize bsize
189 #define sfrok_tsize tsize
190 #define sla_attributes attributes
191 #define sla_from from
193 #define wra_beginoffset beginoffset
194 #define wra_fhandle file
195 #define wra_len_u data_len
196 #define wra_offset offset
197 #define wra_totalcount totalcount
199 #define wra_val_u data_val
205 typedef attrstat nfsattrstat
;
206 typedef createargs nfscreateargs
;
207 typedef dirlist nfsdirlist
;
208 typedef diropargs nfsdiropargs
;
209 typedef diropokres nfsdiropokres
;
210 typedef diropres nfsdiropres
;
211 typedef entry nfsentry
;
212 typedef fattr nfsfattr
;
213 typedef ftype nfsftype
;
214 typedef linkargs nfslinkargs
;
215 typedef readargs nfsreadargs
;
216 typedef readdirargs nfsreaddirargs
;
217 typedef readdirres nfsreaddirres
;
218 typedef readlinkres nfsreadlinkres
;
219 typedef readokres nfsreadokres
;
220 typedef readres nfsreadres
;
221 typedef renameargs nfsrenameargs
;
222 typedef sattr nfssattr
;
223 typedef sattrargs nfssattrargs
;
224 typedef statfsokres nfsstatfsokres
;
225 typedef statfsres nfsstatfsres
;
226 typedef symlinkargs nfssymlinkargs
;
227 typedef writeargs nfswriteargs
;
230 typedef int autofs_args_t
;
233 * We use our own definitions here, because the definitions in the
234 * kernel change the API (though not the ABI) *way* too often.
243 u_char data
[FHSIZE3
];
249 struct nfs2_fh old_root
; /* 1 */
255 int acregmin
; /* 1 */
256 int acregmax
; /* 1 */
257 int acdirmin
; /* 1 */
258 int acdirmax
; /* 1 */
259 struct sockaddr_in addr
; /* 1 */
260 char hostname
[256]; /* 1 */
262 unsigned int bsize
; /* 3 */
263 struct nfs3_fh root
; /* 4 */
264 int pseudoflavor
; /* 5 */
265 char context
[256 + 1];/* 6 */
267 typedef struct nfs_args nfs_args_t
;
270 * Missing definitions on redhat alpha linux
274 /* This line MUST be split! Otherwise m4 will not change it. */
275 # define __FD_ZERO(set) \
276 ((void) memset ((__ptr_t) (set), 0, sizeof(fd_set)))
277 # endif /* not __FD_ZERO */
279 # define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
280 # endif /* not __FD_SET */
282 # define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
283 # endif /* not __FD_CLR */
285 # define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
286 # endif /* not __FD_ISSET */
288 #endif /* _SELECTBITS_H */
290 /* turn off this (b/c of hlfsd) */
291 #undef HAVE_RPC_AUTH_DES_H
293 extern int linux_version_code();
294 /* use a private mapper from errno's to NFS errors */
295 extern int linux_nfs_error(int e
);
296 #define nfs_error(e) linux_nfs_error(e)
298 #endif /* not _AMU_NFS_PROT_H */