]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/mount.h
xnu-792.17.14.tar.gz
[apple/xnu.git] / bsd / sys / mount.h
CommitLineData
1c79356b 1/*
5d5c5d0d
A
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
8f6c56a5 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
8f6c56a5
A
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
8ad349bb 24 * limitations under the License.
8f6c56a5
A
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
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
9bccf70c 67#include <sys/appleapiopts.h>
91447636
A
68#include <sys/cdefs.h>
69#include <sys/attr.h> /* needed for vol_capabilities_attr_t */
70
1c79356b 71#ifndef KERNEL
91447636 72#include <stdint.h>
1c79356b 73#include <sys/ucred.h>
91447636
A
74#include <sys/queue.h> /* XXX needed for user builds */
75#else
76#include <sys/kernel_types.h>
1c79356b 77#endif
1c79356b
A
78
79typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
80
1c79356b
A
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
91447636
A
88/*
89 * LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h.
90 */
1c79356b
A
91struct 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
91447636
A
119
120#define MFSTYPENAMELEN 16 /* length of fs type name including null */
121
8f6c56a5
A
122#if __DARWIN_ALIGN_POWER
123#pragma options align=power
124#endif
91447636
A
125
126struct vfsstatfs {
127 uint32_t f_bsize; /* fundamental file system block size */
128 size_t f_iosize; /* optimal transfer block size */
129 uint64_t f_blocks; /* total data blocks in file system */
130 uint64_t f_bfree; /* free blocks in fs */
131 uint64_t f_bavail; /* free blocks avail to non-superuser */
132 uint64_t f_bused; /* free blocks avail to non-superuser */
133 uint64_t f_files; /* total file nodes in file system */
134 uint64_t f_ffree; /* free file nodes in fs */
135 fsid_t f_fsid; /* file system id */
136 uid_t f_owner; /* user that mounted the filesystem */
137 uint64_t f_flags; /* copy of mount exported flags */
138 char f_fstypename[MFSTYPENAMELEN];/* fs type name inclus */
139 char f_mntonname[MAXPATHLEN];/* directory on which mounted */
140 char f_mntfromname[MAXPATHLEN];/* mounted filesystem */
141 uint32_t f_fssubtype; /* fs sub-type (flavor) */
142 void *f_reserved[2]; /* For future use == 0 */
143};
144
8f6c56a5
A
145#if __DARWIN_ALIGN_POWER
146#pragma options align=reset
147#endif
91447636
A
148
149#define VFSATTR_INIT(s) ((s)->f_supported = (s)->f_active = 0LL)
150#define VFSATTR_SET_SUPPORTED(s, a) ((s)->f_supported |= VFSATTR_ ## a)
151#define VFSATTR_IS_SUPPORTED(s, a) ((s)->f_supported & VFSATTR_ ## a)
152#define VFSATTR_CLEAR_ACTIVE(s, a) ((s)->f_active &= ~VFSATTR_ ## a)
153#define VFSATTR_IS_ACTIVE(s, a) ((s)->f_active & VFSATTR_ ## a)
154#define VFSATTR_ALL_SUPPORTED(s) (((s)->f_active & (s)->f_supported) == (s)->f_active)
155#define VFSATTR_WANTED(s, a) ((s)->f_active |= VFSATTR_ ## a)
156#define VFSATTR_RETURN(s, a, x) do { (s)-> a = (x); VFSATTR_SET_SUPPORTED(s, a);} while(0)
157
158#define VFSATTR_f_objcount (1LL<< 0)
159#define VFSATTR_f_filecount (1LL<< 1)
160#define VFSATTR_f_dircount (1LL<< 2)
161#define VFSATTR_f_maxobjcount (1LL<< 3)
162#define VFSATTR_f_bsize (1LL<< 4)
163#define VFSATTR_f_iosize (1LL<< 5)
164#define VFSATTR_f_blocks (1LL<< 6)
165#define VFSATTR_f_bfree (1LL<< 7)
166#define VFSATTR_f_bavail (1LL<< 8)
167#define VFSATTR_f_bused (1LL<< 9)
168#define VFSATTR_f_files (1LL<< 10)
169#define VFSATTR_f_ffree (1LL<< 11)
170#define VFSATTR_f_fsid (1LL<< 12)
171#define VFSATTR_f_owner (1LL<< 13)
172#define VFSATTR_f_capabilities (1LL<< 14)
173#define VFSATTR_f_attributes (1LL<< 15)
174#define VFSATTR_f_create_time (1LL<< 16)
175#define VFSATTR_f_modify_time (1LL<< 17)
176#define VFSATTR_f_access_time (1LL<< 18)
177#define VFSATTR_f_backup_time (1LL<< 19)
178#define VFSATTR_f_fssubtype (1LL<< 20)
179#define VFSATTR_f_vol_name (1LL<< 21)
180#define VFSATTR_f_signature (1LL<< 22)
181#define VFSATTR_f_carbon_fsid (1LL<< 23)
182
1c79356b 183/*
91447636 184 * New VFS_STAT argument structure.
1c79356b 185 */
8f6c56a5
A
186#if __DARWIN_ALIGN_POWER
187#pragma options align=power
188#endif
91447636
A
189
190struct vfs_attr {
191 uint64_t f_supported;
192 uint64_t f_active;
193
194 uint64_t f_objcount; /* number of filesystem objects in volume */
195 uint64_t f_filecount; /* ... files */
196 uint64_t f_dircount; /* ... directories */
197 uint64_t f_maxobjcount; /* maximum number of filesystem objects */
198
199 uint32_t f_bsize; /* block size for the below size values */
200 size_t f_iosize; /* optimal transfer block size */
201 uint64_t f_blocks; /* total data blocks in file system */
202 uint64_t f_bfree; /* free blocks in fs */
203 uint64_t f_bavail; /* free blocks avail to non-superuser */
204 uint64_t f_bused; /* blocks in use */
205 uint64_t f_files; /* total file nodes in file system */
206 uint64_t f_ffree; /* free file nodes in fs */
207 fsid_t f_fsid; /* file system id */
208 uid_t f_owner; /* user that mounted the filesystem */
209
210 vol_capabilities_attr_t f_capabilities;
211 vol_attributes_attr_t f_attributes;
212
213 struct timespec f_create_time; /* creation time */
214 struct timespec f_modify_time; /* last modification time */
215 struct timespec f_access_time; /* time of last access */
216 struct timespec f_backup_time; /* last backup time */
217
218 uint32_t f_fssubtype; /* filesystem subtype */
219
220 char *f_vol_name; /* volume name */
221
222 uint16_t f_signature; /* used for ATTR_VOL_SIGNATURE, Carbon's FSVolumeInfo.signature */
223 uint16_t f_carbon_fsid; /* same as Carbon's FSVolumeInfo.filesystemID */
1c79356b 224};
91447636 225
8f6c56a5
A
226#if __DARWIN_ALIGN_POWER
227#pragma options align=reset
228#endif
1c79356b
A
229
230/*
231 * User specifiable flags.
232 *
233 * Unmount uses MNT_FORCE flag.
234 */
235#define MNT_RDONLY 0x00000001 /* read only filesystem */
236#define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */
237#define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */
238#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
239#define MNT_NODEV 0x00000010 /* don't interpret special files */
240#define MNT_UNION 0x00000020 /* union with underlying filesystem */
241#define MNT_ASYNC 0x00000040 /* file system written asynchronously */
242#define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */
91447636
A
243#define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem
244 * objects */
1c79356b 245#define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */
b4c24cb9 246#define MNT_JOURNALED 0x00800000 /* filesystem is journaled */
91447636
A
247#define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */
248#define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */
249
250/* backwards compatibility only */
251#define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
1c79356b
A
252
253/*
254 * NFS export related mount flags.
255 */
1c79356b 256#define MNT_EXPORTED 0x00000100 /* file system is exported */
1c79356b
A
257
258/*
259 * Flags set by internal operations.
260 */
261#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
262#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
263#define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
264#define MNT_DOVOLFS 0x00008000 /* FS supports volfs */
1c79356b
A
265
266/*
267 * XXX I think that this could now become (~(MNT_CMDFLAGS))
268 * but the 'mount' program may need changing to handle this.
269 */
270#define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \
271 MNT_NOSUID | MNT_NODEV | MNT_UNION | \
91447636 272 MNT_ASYNC | MNT_EXPORTED | \
1c79356b
A
273 MNT_LOCAL | MNT_QUOTA | \
274 MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \
91447636
A
275 MNT_UNKNOWNPERMISSIONS | MNT_AUTOMOUNTED | MNT_JOURNALED | \
276 MNT_DEFWRITE)
1c79356b
A
277/*
278 * External filesystem command modifier flags.
279 * Unmount can use the MNT_FORCE flag.
280 * XXX These are not STATES and really should be somewhere else.
281 * External filesystem control flags.
282 */
283#define MNT_UPDATE 0x00010000 /* not a real mount, just an update */
1c79356b
A
284#define MNT_RELOAD 0x00040000 /* reload filesystem data */
285#define MNT_FORCE 0x00080000 /* force unmount or readonly change */
91447636
A
286#define MNT_CMDFLAGS (MNT_UPDATE|MNT_RELOAD|MNT_FORCE)
287
288
1c79356b 289
1c79356b
A
290/*
291 * Sysctl CTL_VFS definitions.
292 *
293 * Second level identifier specifies which filesystem. Second level
294 * identifier VFS_GENERIC returns information about all filesystems.
295 */
296#define VFS_GENERIC 0 /* generic filesystem information */
297#define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */
298/*
299 * Third level identifiers for VFS_GENERIC are given below; third
300 * level identifiers for specific filesystems are given in their
301 * mount specific header files.
302 */
303#define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */
304#define VFS_CONF 2 /* struct: vfsconf for filesystem given
305 as next argument */
91447636 306#define VFS_SET_PACKAGE_EXTS 3 /* set package extension list */
55e303ae 307
1c79356b
A
308/*
309 * Flags for various system call interfaces.
310 *
311 * waitfor flags to vfs_sync() and getfsstat()
312 */
313#define MNT_WAIT 1 /* synchronously wait for I/O to complete */
314#define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */
315
1c79356b 316
91447636
A
317#ifndef KERNEL
318struct mount;
319typedef struct mount * mount_t;
320struct vnode;
321typedef struct vnode * vnode_t;
322#endif
1c79356b 323
1c79356b
A
324struct vfsconf {
325 struct vfsops *vfc_vfsops; /* filesystem operations vector */
326 char vfc_name[MFSNAMELEN]; /* filesystem type name */
327 int vfc_typenum; /* historic filesystem type number */
328 int vfc_refcount; /* number mounted of this type */
329 int vfc_flags; /* permanent flags */
91447636 330 int (*vfc_mountroot)(mount_t, vnode_t); /* if != NULL, routine to mount root */
1c79356b
A
331 struct vfsconf *vfc_next; /* next in list */
332};
333
55e303ae
A
334struct vfsidctl {
335 int vc_vers; /* should be VFSIDCTL_VERS1 (below) */
336 fsid_t vc_fsid; /* fsid to operate on. */
337 void *vc_ptr; /* pointer to data structure. */
338 size_t vc_len; /* sizeof said structure. */
339 u_int32_t vc_spare[12]; /* spare (must be zero). */
340};
341
91447636 342
55e303ae
A
343/* vfsidctl API version. */
344#define VFS_CTL_VERS1 0x01
345
91447636
A
346#ifdef KERNEL
347// LP64todo - should this move?
348
349/* LP64 version of vfsconf. all pointers
350 * grow when we're dealing with a 64-bit process.
351 * WARNING - keep in sync with vfsconf
352 */
8f6c56a5
A
353#if __DARWIN_ALIGN_NATURAL
354#pragma options align=natural
355#endif
356
91447636
A
357struct user_vfsconf {
358 user_addr_t vfc_vfsops; /* filesystem operations vector */
359 char vfc_name[MFSNAMELEN]; /* filesystem type name */
360 int vfc_typenum; /* historic filesystem type number */
361 int vfc_refcount; /* number mounted of this type */
362 int vfc_flags; /* permanent flags */
8f6c56a5 363 user_addr_t vfc_mountroot; /* if != NULL, routine to mount root */
91447636
A
364 user_addr_t vfc_next; /* next in list */
365};
366
367struct user_vfsidctl {
368 int vc_vers; /* should be VFSIDCTL_VERS1 (below) */
369 fsid_t vc_fsid; /* fsid to operate on. */
8f6c56a5 370 user_addr_t vc_ptr; /* pointer to data structure. */
91447636
A
371 user_size_t vc_len; /* sizeof said structure. */
372 u_int32_t vc_spare[12]; /* spare (must be zero). */
373};
374
8f6c56a5
A
375#if __DARWIN_ALIGN_NATURAL
376#pragma options align=reset
377#endif
378
91447636
A
379#endif /* KERNEL */
380
55e303ae
A
381/*
382 * New style VFS sysctls, do not reuse/conflict with the namespace for
383 * private sysctls.
384 */
385#define VFS_CTL_STATFS 0x00010001 /* statfs */
386#define VFS_CTL_UMOUNT 0x00010002 /* unmount */
387#define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */
388#define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */
389#define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */
e5568f75 390#define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */
55e303ae
A
391
392struct vfsquery {
393 u_int32_t vq_flags;
394 u_int32_t vq_spare[31];
395};
396
397/* vfsquery flags */
398#define VQ_NOTRESP 0x0001 /* server down */
399#define VQ_NEEDAUTH 0x0002 /* server bad auth */
400#define VQ_LOWDISK 0x0004 /* we're low on space */
401#define VQ_MOUNT 0x0008 /* new filesystem arrived */
402#define VQ_UNMOUNT 0x0010 /* filesystem has left */
403#define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */
91447636 404#define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */
e5568f75 405#define VQ_NOTRESPLOCK 0x0080 /* server lockd down */
91447636 406#define VQ_UPDATE 0x0100 /* filesystem information has changed */
55e303ae
A
407#define VQ_FLAG0200 0x0200 /* placeholder */
408#define VQ_FLAG0400 0x0400 /* placeholder */
409#define VQ_FLAG0800 0x0800 /* placeholder */
410#define VQ_FLAG1000 0x1000 /* placeholder */
411#define VQ_FLAG2000 0x2000 /* placeholder */
412#define VQ_FLAG4000 0x4000 /* placeholder */
413#define VQ_FLAG8000 0x8000 /* placeholder */
414
55e303ae 415
9bccf70c 416#ifdef KERNEL
1c79356b 417
91447636
A
418/* Structure for setting device IO parameters per mount point */
419struct vfsioattr {
420 u_int32_t io_maxreadcnt; /* Max. byte count for read */
421 u_int32_t io_maxwritecnt; /* Max. byte count for write */
422 u_int32_t io_segreadcnt; /* Max. segment count for read */
423 u_int32_t io_segwritecnt; /* Max. segment count for write */
424 u_int32_t io_maxsegreadsize; /* Max. segment read size */
425 u_int32_t io_maxsegwritesize; /* Max. segment write size */
426 u_int32_t io_devblocksize; /* the underlying device block size */
427 void * io_reserved[3]; /* extended attribute information */
428};
429
1c79356b
A
430
431/*
91447636 432 * Filesystem Registration information
1c79356b 433 */
91447636
A
434
435#define VFS_TBLTHREADSAFE 0x01
436#define VFS_TBLFSNODELOCK 0x02
437#define VFS_TBLNOTYPENUM 0x08
438#define VFS_TBLLOCALVOL 0x10
439#define VFS_TBL64BITREADY 0x20
440
441struct vfs_fsentry {
442 struct vfsops * vfe_vfsops; /* vfs operations */
443 int vfe_vopcnt; /* # of vnodeopv_desc being registered (reg, spec, fifo ...) */
444 struct vnodeopv_desc ** vfe_opvdescs; /* null terminated; */
445 int vfe_fstypenum; /* historic filesystem type number */
446 char vfe_fsname[MFSNAMELEN]; /* filesystem type name */
447 uint32_t vfe_flags; /* defines the FS capabilities */
448 void * vfe_reserv[2]; /* reserved for future use; set this to zero*/
449 };
450
451
1c79356b
A
452
453struct vfsops {
91447636
A
454 int (*vfs_mount)(struct mount *mp, vnode_t devvp, user_addr_t data, vfs_context_t context);
455 int (*vfs_start)(struct mount *mp, int flags, vfs_context_t context);
456 int (*vfs_unmount)(struct mount *mp, int mntflags, vfs_context_t context);
457 int (*vfs_root)(struct mount *mp, struct vnode **vpp, vfs_context_t context);
458 int (*vfs_quotactl)(struct mount *mp, int cmds, uid_t uid, caddr_t arg, vfs_context_t context);
459 int (*vfs_getattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context);
460/* int (*vfs_statfs)(struct mount *mp, struct vfsstatfs *sbp, vfs_context_t context);*/
461 int (*vfs_sync)(struct mount *mp, int waitfor, vfs_context_t context);
462 int (*vfs_vget)(struct mount *mp, ino64_t ino, struct vnode **vpp, vfs_context_t context);
463 int (*vfs_fhtovp)(struct mount *mp, int fhlen, unsigned char *fhp, struct vnode **vpp,
464 vfs_context_t context);
465 int (*vfs_vptofh)(struct vnode *vp, int *fhlen, unsigned char *fhp, vfs_context_t context);
466 int (*vfs_init)(struct vfsconf *);
467 int (*vfs_sysctl)(int *, u_int, user_addr_t, size_t *, user_addr_t, size_t, vfs_context_t context);
468 int (*vfs_setattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context);
469 void *vfs_reserved[7];
1c79356b
A
470};
471
1c79356b
A
472
473/*
91447636 474 * flags passed into vfs_iterate
1c79356b 475 */
1c79356b
A
476
477/*
91447636 478 * return values from callback
1c79356b 479 */
91447636
A
480#define VFS_RETURNED 0 /* done with vnode, reference can be dropped */
481#define VFS_RETURNED_DONE 1 /* done with vnode, reference can be dropped, terminate iteration */
482#define VFS_CLAIMED 2 /* don't drop reference */
483#define VFS_CLAIMED_DONE 3 /* don't drop reference, terminate iteration */
1c79356b 484
91447636
A
485
486__BEGIN_DECLS
1c79356b 487/*
91447636 488 * prototypes for exported VFS operations
1c79356b 489 */
91447636
A
490extern int VFS_MOUNT(mount_t, vnode_t, user_addr_t, vfs_context_t);
491extern int VFS_START(mount_t, int, vfs_context_t);
492extern int VFS_UNMOUNT(mount_t, int, vfs_context_t);
493extern int VFS_ROOT(mount_t, vnode_t *, vfs_context_t);
494extern int VFS_QUOTACTL(mount_t, int, uid_t, caddr_t, vfs_context_t);
495extern int VFS_SYNC(mount_t, int, vfs_context_t);
496extern int VFS_VGET(mount_t, ino64_t, vnode_t *, vfs_context_t);
497extern int VFS_FHTOVP(mount_t, int, unsigned char *, vnode_t *, vfs_context_t);
498extern int VFS_VPTOFH(vnode_t, int *, unsigned char *, vfs_context_t);
499
500/* The file system registrartion KPI */
501int vfs_fsadd(struct vfs_fsentry *, vfstable_t *);
502int vfs_fsremove(vfstable_t);
503int vfs_iterate(int, int (*)(struct mount *, void *), void *);
504
505uint64_t vfs_flags(mount_t);
506void vfs_setflags(mount_t, uint64_t);
507void vfs_clearflags(mount_t, uint64_t);
508
509int vfs_issynchronous(mount_t);
510int vfs_iswriteupgrade(mount_t);
511int vfs_isupdate(mount_t);
512int vfs_isreload(mount_t);
513int vfs_isforce(mount_t);
514int vfs_isrdonly(mount_t);
515int vfs_isrdwr(mount_t);
516int vfs_authopaque(mount_t);
517int vfs_authopaqueaccess(mount_t);
518void vfs_setauthopaque(mount_t);
519void vfs_setauthopaqueaccess(mount_t);
520void vfs_clearauthopaque(mount_t);
521void vfs_clearauthopaqueaccess(mount_t);
522int vfs_extendedsecurity(mount_t);
523void vfs_setextendedsecurity(mount_t);
524void vfs_clearextendedsecurity(mount_t);
525void vfs_setlocklocal(mount_t);
526
527
528
529uint32_t vfs_maxsymlen(mount_t);
530void vfs_setmaxsymlen(mount_t, uint32_t);
531void * vfs_fsprivate(mount_t);
532void vfs_setfsprivate(mount_t, void *mntdata);
533
534struct vfsstatfs * vfs_statfs(mount_t);
535int vfs_update_vfsstat(mount_t, vfs_context_t);
536int vfs_getattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx);
537int vfs_setattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx);
538
539int vfs_typenum(mount_t);
540void vfs_name(mount_t, char *);
541int vfs_devblocksize(mount_t);
542void vfs_ioattr(mount_t, struct vfsioattr *);
543void vfs_setioattr(mount_t, struct vfsioattr *);
544int vfs_64bitready(mount_t);
545
546
547int vfs_busy(mount_t, int);
548void vfs_unbusy(mount_t);
549
550void vfs_getnewfsid(struct mount *);
551mount_t vfs_getvfs(fsid_t *);
552mount_t vfs_getvfs_by_mntonname(u_char *);
553int vfs_mountedon(struct vnode *);
554
55e303ae
A
555void vfs_event_signal(fsid_t *, u_int32_t, intptr_t);
556void vfs_event_init(void);
91447636
A
557__END_DECLS
558
559#endif /* KERNEL */
1c79356b 560
91447636
A
561#ifndef KERNEL
562
563/*
564 * Generic file handle
565 */
566#define NFS_MAX_FH_SIZE 64
567#define NFSV2_MAX_FH_SIZE 32
568struct fhandle {
569 int fh_len; /* length of file handle */
570 unsigned char fh_data[NFS_MAX_FH_SIZE]; /* file handle value */
571};
572typedef struct fhandle fhandle_t;
1c79356b 573
1c79356b
A
574
575__BEGIN_DECLS
91447636
A
576int fhopen(const struct fhandle *, int);
577int fstatfs(int, struct statfs *);
578int getfh(const char *, fhandle_t *);
579int getfsstat(struct statfs *, int, int);
580int getmntinfo(struct statfs **, int);
581int mount(const char *, const char *, int, void *);
582int statfs(const char *, struct statfs *);
583int unmount(const char *, int);
584int getvfsbyname(const char *, struct vfsconf *);
1c79356b
A
585__END_DECLS
586
587#endif /* KERNEL */
588#endif /* !_SYS_MOUNT_H_ */