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