]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
9bccf70c | 2 | * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
26 | /* | |
27 | * Copyright (c) 1989, 1991, 1993 | |
28 | * The Regents of the University of California. All rights reserved. | |
29 | * | |
30 | * Redistribution and use in source and binary forms, with or without | |
31 | * modification, are permitted provided that the following conditions | |
32 | * are met: | |
33 | * 1. Redistributions of source code must retain the above copyright | |
34 | * notice, this list of conditions and the following disclaimer. | |
35 | * 2. Redistributions in binary form must reproduce the above copyright | |
36 | * notice, this list of conditions and the following disclaimer in the | |
37 | * documentation and/or other materials provided with the distribution. | |
38 | * 3. All advertising materials mentioning features or use of this software | |
39 | * must display the following acknowledgement: | |
40 | * This product includes software developed by the University of | |
41 | * California, Berkeley and its contributors. | |
42 | * 4. Neither the name of the University nor the names of its contributors | |
43 | * may be used to endorse or promote products derived from this software | |
44 | * without specific prior written permission. | |
45 | * | |
46 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
56 | * SUCH DAMAGE. | |
57 | * | |
58 | * @(#)mount.h 8.21 (Berkeley) 5/20/95 | |
59 | */ | |
60 | ||
61 | #ifndef _SYS_MOUNT_H_ | |
62 | #define _SYS_MOUNT_H_ | |
63 | ||
9bccf70c | 64 | #include <sys/appleapiopts.h> |
1c79356b A |
65 | #ifndef KERNEL |
66 | #include <sys/ucred.h> | |
67 | #endif | |
68 | #include <sys/queue.h> | |
69 | #include <sys/lock.h> | |
70 | #include <net/radix.h> | |
71 | #include <sys/socket.h> /* XXX for AF_MAX */ | |
72 | ||
73 | typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */ | |
74 | ||
75 | /* | |
76 | * File identifier. | |
77 | * These are unique per filesystem on a single machine. | |
78 | */ | |
79 | #define MAXFIDSZ 16 | |
80 | ||
81 | struct fid { | |
82 | u_short fid_len; /* length of data in bytes */ | |
83 | u_short fid_reserved; /* force longword alignment */ | |
84 | char fid_data[MAXFIDSZ]; /* data (variable length) */ | |
85 | }; | |
86 | ||
87 | /* | |
88 | * file system statistics | |
89 | */ | |
90 | ||
91 | #define MFSNAMELEN 15 /* length of fs type name, not inc. null */ | |
92 | #define MNAMELEN 90 /* length of buffer for returned name */ | |
93 | ||
94 | struct statfs { | |
95 | short f_otype; /* TEMPORARY SHADOW COPY OF f_type */ | |
96 | short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */ | |
97 | long f_bsize; /* fundamental file system block size */ | |
98 | long f_iosize; /* optimal transfer block size */ | |
99 | long f_blocks; /* total data blocks in file system */ | |
100 | long f_bfree; /* free blocks in fs */ | |
101 | long f_bavail; /* free blocks avail to non-superuser */ | |
102 | long f_files; /* total file nodes in file system */ | |
103 | long f_ffree; /* free file nodes in fs */ | |
104 | fsid_t f_fsid; /* file system id */ | |
105 | uid_t f_owner; /* user that mounted the filesystem */ | |
106 | short f_reserved1; /* spare for later */ | |
107 | short f_type; /* type of filesystem */ | |
108 | long f_flags; /* copy of mount exported flags */ | |
109 | long f_reserved2[2]; /* reserved for future use */ | |
110 | char f_fstypename[MFSNAMELEN]; /* fs type name */ | |
111 | char f_mntonname[MNAMELEN]; /* directory on which mounted */ | |
112 | char f_mntfromname[MNAMELEN];/* mounted filesystem */ | |
113 | #if COMPAT_GETFSSTAT | |
114 | char f_reserved3[0]; /* For alignment */ | |
115 | long f_reserved4[0]; /* For future use */ | |
116 | #else | |
117 | char f_reserved3; /* For alignment */ | |
118 | long f_reserved4[4]; /* For future use */ | |
119 | #endif | |
120 | }; | |
121 | ||
9bccf70c | 122 | #ifdef __APPLE_API_PRIVATE |
1c79356b A |
123 | /* |
124 | * Structure per mounted file system. Each mounted file system has an | |
125 | * array of operations and an instance record. The file systems are | |
126 | * put on a doubly linked list. | |
127 | */ | |
128 | LIST_HEAD(vnodelst, vnode); | |
129 | ||
130 | struct mount { | |
131 | CIRCLEQ_ENTRY(mount) mnt_list; /* mount list */ | |
132 | struct vfsops *mnt_op; /* operations on fs */ | |
133 | struct vfsconf *mnt_vfc; /* configuration info */ | |
134 | struct vnode *mnt_vnodecovered; /* vnode we mounted on */ | |
135 | struct vnodelst mnt_vnodelist; /* list of vnodes this mount */ | |
136 | struct lock__bsd__ mnt_lock; /* mount structure lock */ | |
137 | int mnt_flag; /* flags */ | |
138 | int mnt_kern_flag; /* kernel only flags */ | |
139 | int mnt_maxsymlinklen; /* max size of short symlink */ | |
140 | struct statfs mnt_stat; /* cache of filesystem stats */ | |
141 | qaddr_t mnt_data; /* private data */ | |
0b4e3aa0 | 142 | /* Cached values of the IO constraints for the device */ |
55e303ae A |
143 | union { |
144 | u_int32_t mntu_maxreadcnt; /* Max. byte count for read */ | |
145 | void *mntu_xinfo_ptr; /* points at extended IO constraints */ | |
146 | } mnt_un; /* if MNTK_IO_XINFO is set */ | |
147 | #define mnt_maxreadcnt mnt_un.mntu_maxreadcnt | |
148 | #define mnt_xinfo_ptr mnt_un.mntu_xinfo_ptr | |
0b4e3aa0 A |
149 | u_int32_t mnt_maxwritecnt; /* Max. byte count for write */ |
150 | u_int16_t mnt_segreadcnt; /* Max. segment count for read */ | |
151 | u_int16_t mnt_segwritecnt; /* Max. segment count for write */ | |
1c79356b | 152 | }; |
9bccf70c | 153 | #endif /* __APPLE_API_PRIVATE */ |
1c79356b A |
154 | |
155 | /* | |
156 | * User specifiable flags. | |
157 | * | |
158 | * Unmount uses MNT_FORCE flag. | |
159 | */ | |
160 | #define MNT_RDONLY 0x00000001 /* read only filesystem */ | |
161 | #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ | |
162 | #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ | |
163 | #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ | |
164 | #define MNT_NODEV 0x00000010 /* don't interpret special files */ | |
165 | #define MNT_UNION 0x00000020 /* union with underlying filesystem */ | |
166 | #define MNT_ASYNC 0x00000040 /* file system written asynchronously */ | |
167 | #define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */ | |
168 | #define MNT_UNKNOWNPERMISSIONS 0x00200000 /* no known mapping for uid/gid in permissions information on disk */ | |
169 | #define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */ | |
b4c24cb9 | 170 | #define MNT_JOURNALED 0x00800000 /* filesystem is journaled */ |
1c79356b A |
171 | |
172 | /* | |
173 | * NFS export related mount flags. | |
174 | */ | |
175 | #define MNT_EXRDONLY 0x00000080 /* exported read only */ | |
176 | #define MNT_EXPORTED 0x00000100 /* file system is exported */ | |
177 | #define MNT_DEFEXPORTED 0x00000200 /* exported to the world */ | |
178 | #define MNT_EXPORTANON 0x00000400 /* use anon uid mapping for everyone */ | |
179 | #define MNT_EXKERB 0x00000800 /* exported with Kerberos uid mapping */ | |
180 | ||
181 | /* | |
182 | * Flags set by internal operations. | |
183 | */ | |
184 | #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */ | |
185 | #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */ | |
186 | #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */ | |
187 | #define MNT_DOVOLFS 0x00008000 /* FS supports volfs */ | |
188 | #define MNT_FIXEDSCRIPTENCODING 0x10000000 /* FS supports only fixed script encoding [HFS] */ | |
189 | ||
190 | /* | |
191 | * XXX I think that this could now become (~(MNT_CMDFLAGS)) | |
192 | * but the 'mount' program may need changing to handle this. | |
193 | */ | |
194 | #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \ | |
195 | MNT_NOSUID | MNT_NODEV | MNT_UNION | \ | |
196 | MNT_ASYNC | MNT_EXRDONLY | MNT_EXPORTED | \ | |
197 | MNT_DEFEXPORTED | MNT_EXPORTANON| MNT_EXKERB | \ | |
198 | MNT_LOCAL | MNT_QUOTA | \ | |
199 | MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \ | |
b4c24cb9 | 200 | MNT_UNKNOWNPERMISSIONS | MNT_AUTOMOUNTED | MNT_JOURNALED | MNT_FIXEDSCRIPTENCODING ) |
1c79356b A |
201 | /* |
202 | * External filesystem command modifier flags. | |
203 | * Unmount can use the MNT_FORCE flag. | |
204 | * XXX These are not STATES and really should be somewhere else. | |
205 | * External filesystem control flags. | |
206 | */ | |
207 | #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */ | |
208 | #define MNT_DELEXPORT 0x00020000 /* delete export host lists */ | |
209 | #define MNT_RELOAD 0x00040000 /* reload filesystem data */ | |
210 | #define MNT_FORCE 0x00080000 /* force unmount or readonly change */ | |
211 | #define MNT_CMDFLAGS (MNT_UPDATE|MNT_DELEXPORT|MNT_RELOAD|MNT_FORCE) | |
212 | ||
213 | /* | |
214 | * Internal filesystem control flags stored in mnt_kern_flag. | |
215 | * | |
216 | * MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed | |
217 | * past the mount point. This keeps the subtree stable during mounts | |
218 | * and unmounts. | |
219 | */ | |
55e303ae A |
220 | #define MNTK_VIRTUALDEV 0x00200000 /* mounted on a virtual device i.e. a disk image */ |
221 | #define MNTK_ROOTDEV 0x00400000 /* this filesystem resides on the same device as the root */ | |
222 | #define MNTK_IO_XINFO 0x00800000 /* mnt_un.mntu_ioptr has a malloc associated with it */ | |
1c79356b A |
223 | #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ |
224 | #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ | |
225 | #define MNTK_WANTRDWR 0x04000000 /* upgrade to read/write requested */ | |
226 | #if REV_ENDIAN_FS | |
227 | #define MNT_REVEND 0x08000000 /* Reverse endian FS */ | |
228 | #endif /* REV_ENDIAN_FS */ | |
55e303ae | 229 | #define MNTK_FRCUNMOUNT 0x10000000 /* Forced unmount wanted. */ |
1c79356b A |
230 | /* |
231 | * Sysctl CTL_VFS definitions. | |
232 | * | |
233 | * Second level identifier specifies which filesystem. Second level | |
234 | * identifier VFS_GENERIC returns information about all filesystems. | |
235 | */ | |
236 | #define VFS_GENERIC 0 /* generic filesystem information */ | |
237 | #define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */ | |
238 | /* | |
239 | * Third level identifiers for VFS_GENERIC are given below; third | |
240 | * level identifiers for specific filesystems are given in their | |
241 | * mount specific header files. | |
242 | */ | |
243 | #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ | |
244 | #define VFS_CONF 2 /* struct: vfsconf for filesystem given | |
245 | as next argument */ | |
55e303ae A |
246 | #define VFS_FMOD_WATCH 3 /* block waiting for the next modified file */ |
247 | #define VFS_FMOD_WATCH_ENABLE 4 /* 1==enable, 0==disable */ | |
248 | ||
1c79356b A |
249 | /* |
250 | * Flags for various system call interfaces. | |
251 | * | |
252 | * waitfor flags to vfs_sync() and getfsstat() | |
253 | */ | |
254 | #define MNT_WAIT 1 /* synchronously wait for I/O to complete */ | |
255 | #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */ | |
256 | ||
257 | /* | |
258 | * Generic file handle | |
259 | */ | |
260 | struct fhandle { | |
261 | fsid_t fh_fsid; /* File system id of mount point */ | |
262 | struct fid fh_fid; /* File sys specific id */ | |
263 | }; | |
264 | typedef struct fhandle fhandle_t; | |
265 | ||
266 | /* | |
267 | * Export arguments for local filesystem mount calls. | |
268 | */ | |
269 | struct export_args { | |
270 | int ex_flags; /* export related flags */ | |
271 | uid_t ex_root; /* mapping for root uid */ | |
272 | struct ucred ex_anon; /* mapping for anonymous user */ | |
273 | struct sockaddr *ex_addr; /* net address to which exported */ | |
274 | int ex_addrlen; /* and the net address length */ | |
275 | struct sockaddr *ex_mask; /* mask of valid bits in saddr */ | |
276 | int ex_masklen; /* and the smask length */ | |
277 | }; | |
278 | ||
9bccf70c | 279 | #ifdef __APPLE_API_UNSTABLE |
1c79356b A |
280 | /* |
281 | * Filesystem configuration information. One of these exists for each | |
282 | * type of filesystem supported by the kernel. These are searched at | |
283 | * mount time to identify the requested filesystem. | |
284 | */ | |
285 | struct vfsconf { | |
286 | struct vfsops *vfc_vfsops; /* filesystem operations vector */ | |
287 | char vfc_name[MFSNAMELEN]; /* filesystem type name */ | |
288 | int vfc_typenum; /* historic filesystem type number */ | |
289 | int vfc_refcount; /* number mounted of this type */ | |
290 | int vfc_flags; /* permanent flags */ | |
291 | int (*vfc_mountroot)(void); /* if != NULL, routine to mount root */ | |
292 | struct vfsconf *vfc_next; /* next in list */ | |
293 | }; | |
294 | ||
9bccf70c | 295 | #endif /*__APPLE_API_UNSTABLE */ |
1c79356b | 296 | |
55e303ae A |
297 | struct vfsidctl { |
298 | int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ | |
299 | fsid_t vc_fsid; /* fsid to operate on. */ | |
300 | void *vc_ptr; /* pointer to data structure. */ | |
301 | size_t vc_len; /* sizeof said structure. */ | |
302 | u_int32_t vc_spare[12]; /* spare (must be zero). */ | |
303 | }; | |
304 | ||
305 | /* vfsidctl API version. */ | |
306 | #define VFS_CTL_VERS1 0x01 | |
307 | ||
308 | /* | |
309 | * New style VFS sysctls, do not reuse/conflict with the namespace for | |
310 | * private sysctls. | |
311 | */ | |
312 | #define VFS_CTL_STATFS 0x00010001 /* statfs */ | |
313 | #define VFS_CTL_UMOUNT 0x00010002 /* unmount */ | |
314 | #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */ | |
315 | #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */ | |
316 | #define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */ | |
317 | ||
318 | struct vfsquery { | |
319 | u_int32_t vq_flags; | |
320 | u_int32_t vq_spare[31]; | |
321 | }; | |
322 | ||
323 | /* vfsquery flags */ | |
324 | #define VQ_NOTRESP 0x0001 /* server down */ | |
325 | #define VQ_NEEDAUTH 0x0002 /* server bad auth */ | |
326 | #define VQ_LOWDISK 0x0004 /* we're low on space */ | |
327 | #define VQ_MOUNT 0x0008 /* new filesystem arrived */ | |
328 | #define VQ_UNMOUNT 0x0010 /* filesystem has left */ | |
329 | #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */ | |
330 | #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external | |
331 | program */ | |
332 | #define VQ_FLAG0080 0x0080 /* placeholder */ | |
333 | #define VQ_FLAG0100 0x0100 /* placeholder */ | |
334 | #define VQ_FLAG0200 0x0200 /* placeholder */ | |
335 | #define VQ_FLAG0400 0x0400 /* placeholder */ | |
336 | #define VQ_FLAG0800 0x0800 /* placeholder */ | |
337 | #define VQ_FLAG1000 0x1000 /* placeholder */ | |
338 | #define VQ_FLAG2000 0x2000 /* placeholder */ | |
339 | #define VQ_FLAG4000 0x4000 /* placeholder */ | |
340 | #define VQ_FLAG8000 0x8000 /* placeholder */ | |
341 | ||
342 | #ifdef KERNEL | |
343 | /* Point a sysctl request at a vfsidctl's data. */ | |
344 | #define VCTLTOREQ(vc, req) \ | |
345 | do { \ | |
346 | (req)->newptr = (vc)->vc_ptr; \ | |
347 | (req)->newlen = (vc)->vc_len; \ | |
348 | (req)->newidx = 0; \ | |
349 | } while (0) | |
350 | #endif | |
351 | ||
9bccf70c A |
352 | #ifdef KERNEL |
353 | #ifdef __APPLE_API_UNSTABLE | |
1c79356b A |
354 | extern int maxvfsconf; /* highest defined filesystem type */ |
355 | extern struct vfsconf *vfsconf; /* head of list of filesystem types */ | |
356 | extern int maxvfsslots; /* Maximum slots available to be used */ | |
357 | extern int numused_vfsslots; /* number of slots already used */ | |
358 | ||
359 | int vfsconf_add __P((struct vfsconf *)); | |
360 | int vfsconf_del __P((char *)); | |
361 | ||
362 | /* | |
363 | * Operations supported on mounted file system. | |
364 | */ | |
365 | #ifdef __STDC__ | |
366 | struct nameidata; | |
367 | struct mbuf; | |
368 | #endif | |
369 | ||
370 | struct vfsops { | |
371 | int (*vfs_mount) __P((struct mount *mp, char *path, caddr_t data, | |
372 | struct nameidata *ndp, struct proc *p)); | |
373 | int (*vfs_start) __P((struct mount *mp, int flags, | |
374 | struct proc *p)); | |
375 | int (*vfs_unmount) __P((struct mount *mp, int mntflags, | |
376 | struct proc *p)); | |
377 | int (*vfs_root) __P((struct mount *mp, struct vnode **vpp)); | |
378 | int (*vfs_quotactl) __P((struct mount *mp, int cmds, uid_t uid, | |
379 | caddr_t arg, struct proc *p)); | |
380 | int (*vfs_statfs) __P((struct mount *mp, struct statfs *sbp, | |
381 | struct proc *p)); | |
382 | int (*vfs_sync) __P((struct mount *mp, int waitfor, | |
383 | struct ucred *cred, struct proc *p)); | |
384 | int (*vfs_vget) __P((struct mount *mp, void *ino, | |
385 | struct vnode **vpp)); | |
386 | int (*vfs_fhtovp) __P((struct mount *mp, struct fid *fhp, | |
387 | struct mbuf *nam, struct vnode **vpp, | |
388 | int *exflagsp, struct ucred **credanonp)); | |
389 | int (*vfs_vptofh) __P((struct vnode *vp, struct fid *fhp)); | |
390 | int (*vfs_init) __P((struct vfsconf *)); | |
391 | int (*vfs_sysctl) __P((int *, u_int, void *, size_t *, void *, | |
392 | size_t, struct proc *)); | |
393 | }; | |
394 | ||
395 | #define VFS_MOUNT(MP, PATH, DATA, NDP, P) \ | |
396 | (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P) | |
397 | #define VFS_START(MP, FLAGS, P) (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P) | |
398 | #define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P) | |
399 | #define VFS_ROOT(MP, VPP) (*(MP)->mnt_op->vfs_root)(MP, VPP) | |
400 | #define VFS_QUOTACTL(MP,C,U,A,P) (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P) | |
401 | #define VFS_STATFS(MP, SBP, P) (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P) | |
402 | #define VFS_SYNC(MP, WAIT, C, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P) | |
403 | #define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP) | |
404 | #define VFS_FHTOVP(MP, FIDP, NAM, VPP, EXFLG, CRED) \ | |
405 | (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, NAM, VPP, EXFLG, CRED) | |
406 | #define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP) | |
407 | ||
408 | /* | |
409 | * Network address lookup element | |
410 | */ | |
411 | struct netcred { | |
412 | struct radix_node netc_rnodes[2]; | |
413 | int netc_exflags; | |
414 | struct ucred netc_anon; | |
415 | }; | |
416 | ||
417 | /* | |
418 | * Network export information | |
419 | */ | |
420 | struct netexport { | |
421 | struct netcred ne_defexported; /* Default export */ | |
422 | struct radix_node_head *ne_rtable[AF_MAX+1]; /* Individual exports */ | |
423 | }; | |
424 | ||
425 | /* | |
426 | * exported vnode operations | |
427 | */ | |
428 | int vfs_busy __P((struct mount *, int, struct slock *, struct proc *)); | |
429 | int vfs_export __P((struct mount *, struct netexport *, | |
430 | struct export_args *)); | |
431 | struct netcred *vfs_export_lookup __P((struct mount *, struct netexport *, | |
432 | struct mbuf *)); | |
433 | void vfs_getnewfsid __P((struct mount *)); | |
434 | struct mount *vfs_getvfs __P((fsid_t *)); | |
435 | int vfs_mountedon __P((struct vnode *)); | |
9bccf70c A |
436 | void vfs_unbusy __P((struct mount *, struct proc *)); |
437 | #ifdef __APPLE_API_PRIVATE | |
1c79356b A |
438 | int vfs_mountroot __P((void)); |
439 | int vfs_rootmountalloc __P((char *, char *, struct mount **)); | |
1c79356b | 440 | void vfs_unmountall __P((void)); |
55e303ae A |
441 | int safedounmount(struct mount *, int, struct proc *); |
442 | int dounmount(struct mount *, int, struct proc *); | |
443 | void vfs_event_signal(fsid_t *, u_int32_t, intptr_t); | |
444 | void vfs_event_init(void); | |
9bccf70c | 445 | #endif /* __APPLE_API_PRIVATE */ |
1c79356b A |
446 | extern CIRCLEQ_HEAD(mntlist, mount) mountlist; |
447 | extern struct slock mountlist_slock; | |
448 | ||
9bccf70c | 449 | #endif /* __APPLE_API_UNSTABLE */ |
1c79356b A |
450 | #else /* !KERNEL */ |
451 | ||
452 | #include <sys/cdefs.h> | |
453 | ||
454 | __BEGIN_DECLS | |
55e303ae | 455 | int fhopen __P((const struct fhandle *, int)); |
1c79356b A |
456 | int fstatfs __P((int, struct statfs *)); |
457 | int getfh __P((const char *, fhandle_t *)); | |
458 | int getfsstat __P((struct statfs *, long, int)); | |
459 | int getmntinfo __P((struct statfs **, int)); | |
460 | int mount __P((const char *, const char *, int, void *)); | |
461 | int statfs __P((const char *, struct statfs *)); | |
462 | int unmount __P((const char *, int)); | |
9bccf70c | 463 | int getvfsbyname __P((const char *, struct vfsconf *)); |
1c79356b A |
464 | __END_DECLS |
465 | ||
466 | #endif /* KERNEL */ | |
467 | #endif /* !_SYS_MOUNT_H_ */ |