]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/mount.h
6a98e3fdd30ed3594e32467020416ab3b0dbf9b9
[apple/xnu.git] / bsd / sys / mount.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29 /*
30 * Copyright (c) 1989, 1991, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)mount.h 8.21 (Berkeley) 5/20/95
62 */
63
64 #ifndef _SYS_MOUNT_H_
65 #define _SYS_MOUNT_H_
66
67 #include <sys/appleapiopts.h>
68 #include <sys/cdefs.h>
69 #include <sys/attr.h> /* needed for vol_capabilities_attr_t */
70
71 #ifndef KERNEL
72 #include <stdint.h>
73 #include <sys/ucred.h>
74 #include <sys/queue.h> /* XXX needed for user builds */
75 #else
76 #include <sys/kernel_types.h>
77 #endif
78
79 typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
80
81 /*
82 * file system statistics
83 */
84
85 #define MFSNAMELEN 15 /* length of fs type name, not inc. null */
86 #define MNAMELEN 90 /* length of buffer for returned name */
87
88 /*
89 * LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h.
90 */
91 struct statfs {
92 short f_otype; /* TEMPORARY SHADOW COPY OF f_type */
93 short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */
94 long f_bsize; /* fundamental file system block size */
95 long f_iosize; /* optimal transfer block size */
96 long f_blocks; /* total data blocks in file system */
97 long f_bfree; /* free blocks in fs */
98 long f_bavail; /* free blocks avail to non-superuser */
99 long f_files; /* total file nodes in file system */
100 long f_ffree; /* free file nodes in fs */
101 fsid_t f_fsid; /* file system id */
102 uid_t f_owner; /* user that mounted the filesystem */
103 short f_reserved1; /* spare for later */
104 short f_type; /* type of filesystem */
105 long f_flags; /* copy of mount exported flags */
106 long f_reserved2[2]; /* reserved for future use */
107 char f_fstypename[MFSNAMELEN]; /* fs type name */
108 char f_mntonname[MNAMELEN]; /* directory on which mounted */
109 char f_mntfromname[MNAMELEN];/* mounted filesystem */
110 #if COMPAT_GETFSSTAT
111 char f_reserved3[0]; /* For alignment */
112 long f_reserved4[0]; /* For future use */
113 #else
114 char f_reserved3; /* For alignment */
115 long f_reserved4[4]; /* For future use */
116 #endif
117 };
118
119
120 #define MFSTYPENAMELEN 16 /* length of fs type name including null */
121
122 #pragma pack(4)
123
124 struct vfsstatfs {
125 uint32_t f_bsize; /* fundamental file system block size */
126 size_t f_iosize; /* optimal transfer block size */
127 uint64_t f_blocks; /* total data blocks in file system */
128 uint64_t f_bfree; /* free blocks in fs */
129 uint64_t f_bavail; /* free blocks avail to non-superuser */
130 uint64_t f_bused; /* free blocks avail to non-superuser */
131 uint64_t f_files; /* total file nodes in file system */
132 uint64_t f_ffree; /* free file nodes in fs */
133 fsid_t f_fsid; /* file system id */
134 uid_t f_owner; /* user that mounted the filesystem */
135 uint64_t f_flags; /* copy of mount exported flags */
136 char f_fstypename[MFSTYPENAMELEN];/* fs type name inclus */
137 char f_mntonname[MAXPATHLEN];/* directory on which mounted */
138 char f_mntfromname[MAXPATHLEN];/* mounted filesystem */
139 uint32_t f_fssubtype; /* fs sub-type (flavor) */
140 void *f_reserved[2]; /* For future use == 0 */
141 };
142
143 #pragma pack()
144
145 #define VFSATTR_INIT(s) ((s)->f_supported = (s)->f_active = 0LL)
146 #define VFSATTR_SET_SUPPORTED(s, a) ((s)->f_supported |= VFSATTR_ ## a)
147 #define VFSATTR_IS_SUPPORTED(s, a) ((s)->f_supported & VFSATTR_ ## a)
148 #define VFSATTR_CLEAR_ACTIVE(s, a) ((s)->f_active &= ~VFSATTR_ ## a)
149 #define VFSATTR_IS_ACTIVE(s, a) ((s)->f_active & VFSATTR_ ## a)
150 #define VFSATTR_ALL_SUPPORTED(s) (((s)->f_active & (s)->f_supported) == (s)->f_active)
151 #define VFSATTR_WANTED(s, a) ((s)->f_active |= VFSATTR_ ## a)
152 #define VFSATTR_RETURN(s, a, x) do { (s)-> a = (x); VFSATTR_SET_SUPPORTED(s, a);} while(0)
153
154 #define VFSATTR_f_objcount (1LL<< 0)
155 #define VFSATTR_f_filecount (1LL<< 1)
156 #define VFSATTR_f_dircount (1LL<< 2)
157 #define VFSATTR_f_maxobjcount (1LL<< 3)
158 #define VFSATTR_f_bsize (1LL<< 4)
159 #define VFSATTR_f_iosize (1LL<< 5)
160 #define VFSATTR_f_blocks (1LL<< 6)
161 #define VFSATTR_f_bfree (1LL<< 7)
162 #define VFSATTR_f_bavail (1LL<< 8)
163 #define VFSATTR_f_bused (1LL<< 9)
164 #define VFSATTR_f_files (1LL<< 10)
165 #define VFSATTR_f_ffree (1LL<< 11)
166 #define VFSATTR_f_fsid (1LL<< 12)
167 #define VFSATTR_f_owner (1LL<< 13)
168 #define VFSATTR_f_capabilities (1LL<< 14)
169 #define VFSATTR_f_attributes (1LL<< 15)
170 #define VFSATTR_f_create_time (1LL<< 16)
171 #define VFSATTR_f_modify_time (1LL<< 17)
172 #define VFSATTR_f_access_time (1LL<< 18)
173 #define VFSATTR_f_backup_time (1LL<< 19)
174 #define VFSATTR_f_fssubtype (1LL<< 20)
175 #define VFSATTR_f_vol_name (1LL<< 21)
176 #define VFSATTR_f_signature (1LL<< 22)
177 #define VFSATTR_f_carbon_fsid (1LL<< 23)
178
179 /*
180 * New VFS_STAT argument structure.
181 */
182 #pragma pack(4)
183
184 struct vfs_attr {
185 uint64_t f_supported;
186 uint64_t f_active;
187
188 uint64_t f_objcount; /* number of filesystem objects in volume */
189 uint64_t f_filecount; /* ... files */
190 uint64_t f_dircount; /* ... directories */
191 uint64_t f_maxobjcount; /* maximum number of filesystem objects */
192
193 uint32_t f_bsize; /* block size for the below size values */
194 size_t f_iosize; /* optimal transfer block size */
195 uint64_t f_blocks; /* total data blocks in file system */
196 uint64_t f_bfree; /* free blocks in fs */
197 uint64_t f_bavail; /* free blocks avail to non-superuser */
198 uint64_t f_bused; /* blocks in use */
199 uint64_t f_files; /* total file nodes in file system */
200 uint64_t f_ffree; /* free file nodes in fs */
201 fsid_t f_fsid; /* file system id */
202 uid_t f_owner; /* user that mounted the filesystem */
203
204 vol_capabilities_attr_t f_capabilities;
205 vol_attributes_attr_t f_attributes;
206
207 struct timespec f_create_time; /* creation time */
208 struct timespec f_modify_time; /* last modification time */
209 struct timespec f_access_time; /* time of last access */
210 struct timespec f_backup_time; /* last backup time */
211
212 uint32_t f_fssubtype; /* filesystem subtype */
213
214 char *f_vol_name; /* volume name */
215
216 uint16_t f_signature; /* used for ATTR_VOL_SIGNATURE, Carbon's FSVolumeInfo.signature */
217 uint16_t f_carbon_fsid; /* same as Carbon's FSVolumeInfo.filesystemID */
218 };
219
220 #pragma pack()
221
222 /*
223 * User specifiable flags.
224 *
225 * Unmount uses MNT_FORCE flag.
226 */
227 #define MNT_RDONLY 0x00000001 /* read only filesystem */
228 #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */
229 #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */
230 #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
231 #define MNT_NODEV 0x00000010 /* don't interpret special files */
232 #define MNT_UNION 0x00000020 /* union with underlying filesystem */
233 #define MNT_ASYNC 0x00000040 /* file system written asynchronously */
234 #define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */
235 #define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem
236 * objects */
237 #define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */
238 #define MNT_JOURNALED 0x00800000 /* filesystem is journaled */
239 #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */
240 #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */
241
242 /* backwards compatibility only */
243 #define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
244
245 /*
246 * NFS export related mount flags.
247 */
248 #define MNT_EXPORTED 0x00000100 /* file system is exported */
249
250 /*
251 * Flags set by internal operations.
252 */
253 #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
254 #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
255 #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
256 #define MNT_DOVOLFS 0x00008000 /* FS supports volfs */
257
258 /*
259 * XXX I think that this could now become (~(MNT_CMDFLAGS))
260 * but the 'mount' program may need changing to handle this.
261 */
262 #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \
263 MNT_NOSUID | MNT_NODEV | MNT_UNION | \
264 MNT_ASYNC | MNT_EXPORTED | \
265 MNT_LOCAL | MNT_QUOTA | \
266 MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \
267 MNT_UNKNOWNPERMISSIONS | MNT_AUTOMOUNTED | MNT_JOURNALED | \
268 MNT_DEFWRITE)
269 /*
270 * External filesystem command modifier flags.
271 * Unmount can use the MNT_FORCE flag.
272 * XXX These are not STATES and really should be somewhere else.
273 * External filesystem control flags.
274 */
275 #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */
276 #define MNT_RELOAD 0x00040000 /* reload filesystem data */
277 #define MNT_FORCE 0x00080000 /* force unmount or readonly change */
278 #define MNT_CMDFLAGS (MNT_UPDATE|MNT_RELOAD|MNT_FORCE)
279
280
281
282 /*
283 * Sysctl CTL_VFS definitions.
284 *
285 * Second level identifier specifies which filesystem. Second level
286 * identifier VFS_GENERIC returns information about all filesystems.
287 */
288 #define VFS_GENERIC 0 /* generic filesystem information */
289 #define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */
290 /*
291 * Third level identifiers for VFS_GENERIC are given below; third
292 * level identifiers for specific filesystems are given in their
293 * mount specific header files.
294 */
295 #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */
296 #define VFS_CONF 2 /* struct: vfsconf for filesystem given
297 as next argument */
298 #define VFS_SET_PACKAGE_EXTS 3 /* set package extension list */
299
300 /*
301 * Flags for various system call interfaces.
302 *
303 * waitfor flags to vfs_sync() and getfsstat()
304 */
305 #define MNT_WAIT 1 /* synchronously wait for I/O to complete */
306 #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */
307
308
309 #ifndef KERNEL
310 struct mount;
311 typedef struct mount * mount_t;
312 struct vnode;
313 typedef struct vnode * vnode_t;
314 #endif
315
316 struct vfsconf {
317 struct vfsops *vfc_vfsops; /* filesystem operations vector */
318 char vfc_name[MFSNAMELEN]; /* filesystem type name */
319 int vfc_typenum; /* historic filesystem type number */
320 int vfc_refcount; /* number mounted of this type */
321 int vfc_flags; /* permanent flags */
322 int (*vfc_mountroot)(mount_t, vnode_t); /* if != NULL, routine to mount root */
323 struct vfsconf *vfc_next; /* next in list */
324 };
325
326 struct vfsidctl {
327 int vc_vers; /* should be VFSIDCTL_VERS1 (below) */
328 fsid_t vc_fsid; /* fsid to operate on. */
329 void *vc_ptr; /* pointer to data structure. */
330 size_t vc_len; /* sizeof said structure. */
331 u_int32_t vc_spare[12]; /* spare (must be zero). */
332 };
333
334
335 /* vfsidctl API version. */
336 #define VFS_CTL_VERS1 0x01
337
338 #ifdef KERNEL
339 // LP64todo - should this move?
340
341 /* LP64 version of vfsconf. all pointers
342 * grow when we're dealing with a 64-bit process.
343 * WARNING - keep in sync with vfsconf
344 */
345 struct user_vfsconf {
346 user_addr_t vfc_vfsops; /* filesystem operations vector */
347 char vfc_name[MFSNAMELEN]; /* filesystem type name */
348 int vfc_typenum; /* historic filesystem type number */
349 int vfc_refcount; /* number mounted of this type */
350 int vfc_flags; /* permanent flags */
351 user_addr_t vfc_mountroot __attribute((aligned(8))); /* if != NULL, routine to mount root */
352 user_addr_t vfc_next; /* next in list */
353 };
354
355 struct user_vfsidctl {
356 int vc_vers; /* should be VFSIDCTL_VERS1 (below) */
357 fsid_t vc_fsid; /* fsid to operate on. */
358 user_addr_t vc_ptr __attribute((aligned(8))); /* pointer to data structure. */
359 user_size_t vc_len; /* sizeof said structure. */
360 u_int32_t vc_spare[12]; /* spare (must be zero). */
361 };
362
363 #endif /* KERNEL */
364
365 /*
366 * New style VFS sysctls, do not reuse/conflict with the namespace for
367 * private sysctls.
368 */
369 #define VFS_CTL_STATFS 0x00010001 /* statfs */
370 #define VFS_CTL_UMOUNT 0x00010002 /* unmount */
371 #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */
372 #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */
373 #define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */
374 #define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */
375
376 struct vfsquery {
377 u_int32_t vq_flags;
378 u_int32_t vq_spare[31];
379 };
380
381 /* vfsquery flags */
382 #define VQ_NOTRESP 0x0001 /* server down */
383 #define VQ_NEEDAUTH 0x0002 /* server bad auth */
384 #define VQ_LOWDISK 0x0004 /* we're low on space */
385 #define VQ_MOUNT 0x0008 /* new filesystem arrived */
386 #define VQ_UNMOUNT 0x0010 /* filesystem has left */
387 #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */
388 #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */
389 #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */
390 #define VQ_UPDATE 0x0100 /* filesystem information has changed */
391 #define VQ_FLAG0200 0x0200 /* placeholder */
392 #define VQ_FLAG0400 0x0400 /* placeholder */
393 #define VQ_FLAG0800 0x0800 /* placeholder */
394 #define VQ_FLAG1000 0x1000 /* placeholder */
395 #define VQ_FLAG2000 0x2000 /* placeholder */
396 #define VQ_FLAG4000 0x4000 /* placeholder */
397 #define VQ_FLAG8000 0x8000 /* placeholder */
398
399
400 #ifdef KERNEL
401
402 /* Structure for setting device IO parameters per mount point */
403 struct vfsioattr {
404 u_int32_t io_maxreadcnt; /* Max. byte count for read */
405 u_int32_t io_maxwritecnt; /* Max. byte count for write */
406 u_int32_t io_segreadcnt; /* Max. segment count for read */
407 u_int32_t io_segwritecnt; /* Max. segment count for write */
408 u_int32_t io_maxsegreadsize; /* Max. segment read size */
409 u_int32_t io_maxsegwritesize; /* Max. segment write size */
410 u_int32_t io_devblocksize; /* the underlying device block size */
411 void * io_reserved[3]; /* extended attribute information */
412 };
413
414
415 /*
416 * Filesystem Registration information
417 */
418
419 #define VFS_TBLTHREADSAFE 0x01
420 #define VFS_TBLFSNODELOCK 0x02
421 #define VFS_TBLNOTYPENUM 0x08
422 #define VFS_TBLLOCALVOL 0x10
423 #define VFS_TBL64BITREADY 0x20
424
425 struct vfs_fsentry {
426 struct vfsops * vfe_vfsops; /* vfs operations */
427 int vfe_vopcnt; /* # of vnodeopv_desc being registered (reg, spec, fifo ...) */
428 struct vnodeopv_desc ** vfe_opvdescs; /* null terminated; */
429 int vfe_fstypenum; /* historic filesystem type number */
430 char vfe_fsname[MFSNAMELEN]; /* filesystem type name */
431 uint32_t vfe_flags; /* defines the FS capabilities */
432 void * vfe_reserv[2]; /* reserved for future use; set this to zero*/
433 };
434
435
436
437 struct vfsops {
438 int (*vfs_mount)(struct mount *mp, vnode_t devvp, user_addr_t data, vfs_context_t context);
439 int (*vfs_start)(struct mount *mp, int flags, vfs_context_t context);
440 int (*vfs_unmount)(struct mount *mp, int mntflags, vfs_context_t context);
441 int (*vfs_root)(struct mount *mp, struct vnode **vpp, vfs_context_t context);
442 int (*vfs_quotactl)(struct mount *mp, int cmds, uid_t uid, caddr_t arg, vfs_context_t context);
443 int (*vfs_getattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context);
444 /* int (*vfs_statfs)(struct mount *mp, struct vfsstatfs *sbp, vfs_context_t context);*/
445 int (*vfs_sync)(struct mount *mp, int waitfor, vfs_context_t context);
446 int (*vfs_vget)(struct mount *mp, ino64_t ino, struct vnode **vpp, vfs_context_t context);
447 int (*vfs_fhtovp)(struct mount *mp, int fhlen, unsigned char *fhp, struct vnode **vpp,
448 vfs_context_t context);
449 int (*vfs_vptofh)(struct vnode *vp, int *fhlen, unsigned char *fhp, vfs_context_t context);
450 int (*vfs_init)(struct vfsconf *);
451 int (*vfs_sysctl)(int *, u_int, user_addr_t, size_t *, user_addr_t, size_t, vfs_context_t context);
452 int (*vfs_setattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context);
453 void *vfs_reserved[7];
454 };
455
456
457 /*
458 * flags passed into vfs_iterate
459 */
460
461 /*
462 * return values from callback
463 */
464 #define VFS_RETURNED 0 /* done with vnode, reference can be dropped */
465 #define VFS_RETURNED_DONE 1 /* done with vnode, reference can be dropped, terminate iteration */
466 #define VFS_CLAIMED 2 /* don't drop reference */
467 #define VFS_CLAIMED_DONE 3 /* don't drop reference, terminate iteration */
468
469
470 __BEGIN_DECLS
471 /*
472 * prototypes for exported VFS operations
473 */
474 extern int VFS_MOUNT(mount_t, vnode_t, user_addr_t, vfs_context_t);
475 extern int VFS_START(mount_t, int, vfs_context_t);
476 extern int VFS_UNMOUNT(mount_t, int, vfs_context_t);
477 extern int VFS_ROOT(mount_t, vnode_t *, vfs_context_t);
478 extern int VFS_QUOTACTL(mount_t, int, uid_t, caddr_t, vfs_context_t);
479 extern int VFS_SYNC(mount_t, int, vfs_context_t);
480 extern int VFS_VGET(mount_t, ino64_t, vnode_t *, vfs_context_t);
481 extern int VFS_FHTOVP(mount_t, int, unsigned char *, vnode_t *, vfs_context_t);
482 extern int VFS_VPTOFH(vnode_t, int *, unsigned char *, vfs_context_t);
483
484 /* The file system registrartion KPI */
485 int vfs_fsadd(struct vfs_fsentry *, vfstable_t *);
486 int vfs_fsremove(vfstable_t);
487 int vfs_iterate(int, int (*)(struct mount *, void *), void *);
488
489 uint64_t vfs_flags(mount_t);
490 void vfs_setflags(mount_t, uint64_t);
491 void vfs_clearflags(mount_t, uint64_t);
492
493 int vfs_issynchronous(mount_t);
494 int vfs_iswriteupgrade(mount_t);
495 int vfs_isupdate(mount_t);
496 int vfs_isreload(mount_t);
497 int vfs_isforce(mount_t);
498 int vfs_isrdonly(mount_t);
499 int vfs_isrdwr(mount_t);
500 int vfs_authopaque(mount_t);
501 int vfs_authopaqueaccess(mount_t);
502 void vfs_setauthopaque(mount_t);
503 void vfs_setauthopaqueaccess(mount_t);
504 void vfs_clearauthopaque(mount_t);
505 void vfs_clearauthopaqueaccess(mount_t);
506 int vfs_extendedsecurity(mount_t);
507 void vfs_setextendedsecurity(mount_t);
508 void vfs_clearextendedsecurity(mount_t);
509 void vfs_setlocklocal(mount_t);
510
511
512
513 uint32_t vfs_maxsymlen(mount_t);
514 void vfs_setmaxsymlen(mount_t, uint32_t);
515 void * vfs_fsprivate(mount_t);
516 void vfs_setfsprivate(mount_t, void *mntdata);
517
518 struct vfsstatfs * vfs_statfs(mount_t);
519 int vfs_update_vfsstat(mount_t, vfs_context_t);
520 int vfs_getattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx);
521 int vfs_setattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx);
522
523 int vfs_typenum(mount_t);
524 void vfs_name(mount_t, char *);
525 int vfs_devblocksize(mount_t);
526 void vfs_ioattr(mount_t, struct vfsioattr *);
527 void vfs_setioattr(mount_t, struct vfsioattr *);
528 int vfs_64bitready(mount_t);
529
530
531 int vfs_busy(mount_t, int);
532 void vfs_unbusy(mount_t);
533
534 void vfs_getnewfsid(struct mount *);
535 mount_t vfs_getvfs(fsid_t *);
536 mount_t vfs_getvfs_by_mntonname(u_char *);
537 int vfs_mountedon(struct vnode *);
538
539 void vfs_event_signal(fsid_t *, u_int32_t, intptr_t);
540 void vfs_event_init(void);
541 __END_DECLS
542
543 #endif /* KERNEL */
544
545 #ifndef KERNEL
546
547 /*
548 * Generic file handle
549 */
550 #define NFS_MAX_FH_SIZE 64
551 #define NFSV2_MAX_FH_SIZE 32
552 struct fhandle {
553 int fh_len; /* length of file handle */
554 unsigned char fh_data[NFS_MAX_FH_SIZE]; /* file handle value */
555 };
556 typedef struct fhandle fhandle_t;
557
558
559 __BEGIN_DECLS
560 int fhopen(const struct fhandle *, int);
561 int fstatfs(int, struct statfs *);
562 int getfh(const char *, fhandle_t *);
563 int getfsstat(struct statfs *, int, int);
564 int getmntinfo(struct statfs **, int);
565 int mount(const char *, const char *, int, void *);
566 int statfs(const char *, struct statfs *);
567 int unmount(const char *, int);
568 int getvfsbyname(const char *, struct vfsconf *);
569 __END_DECLS
570
571 #endif /* KERNEL */
572 #endif /* !_SYS_MOUNT_H_ */