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