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