]>
Commit | Line | Data |
---|---|---|
39236c6e A |
1 | /* |
2 | * Copyright (c) 2012 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
0a7de745 | 5 | * |
39236c6e 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. | |
0a7de745 | 14 | * |
39236c6e A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
39236c6e A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
0a7de745 | 25 | * |
39236c6e A |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ | |
28 | ||
29 | #ifndef MOCKFS_H | |
30 | #define MOCKFS_H | |
31 | ||
32 | #if MOCKFS | |
33 | ||
34 | #include <kern/locks.h> | |
35 | #include <miscfs/mockfs/mockfs_fsnode.h> | |
36 | #include <sys/kernel_types.h> | |
37 | ||
38 | /* | |
39 | * mockfs is effectively a "fake" filesystem; the primary motivation for it being that we may have cases | |
40 | * where our userspace needs are extremely simple/consistent and can provided by a single binary. mockfs | |
41 | * uses an in-memory tree to define the structure for an extremely simple filesystem, which makes the | |
42 | * assumption that our root device is in fact a mach-o file, and provides a minimal filesystem to support | |
43 | * this: the root directory, a mountpoint for devfs (given that very basic userspace code may assume the | |
44 | * existance of /dev/), and an executable representing the root device. | |
45 | * | |
46 | * The functionality supported by mockfs is minimal: it is read-only, and does not support user initiated IO, | |
47 | * but it supports lookup (so it should be possible for the user to access /dev/). | |
48 | * | |
49 | * mockfs is primarily targeted towards memory-backed devices, and will (when possible) attempt to inform the | |
50 | * VM that we are using a memory-backed device, so that we can eschew IO to the backing device completely, | |
51 | * and avoid having an extra copy of the data in the UBC (as well as the overhead associated with creating | |
52 | * that copy). | |
53 | * | |
54 | * For the moment, mockfs is not marked in vfs_conf.c as being threadsafe. | |
55 | */ | |
56 | ||
57 | extern lck_attr_t * mockfs_mtx_attr; | |
58 | extern lck_grp_attr_t * mockfs_grp_attr; | |
59 | extern lck_grp_t * mockfs_mtx_grp; | |
60 | ||
61 | struct mockfs_mount { | |
62 | lck_mtx_t mockfs_mnt_mtx; /* Mount-wide (and tree-wide) mutex */ | |
63 | mockfs_fsnode_t mockfs_root; /* Root of the node tree */ | |
64 | boolean_t mockfs_memory_backed; /* Does the backing store reside in memory */ | |
65 | boolean_t mockfs_physical_memory; /* (valid if memory backed) */ | |
66 | uint32_t mockfs_memdev_base; /* Base page of the backing store (valid if memory backed) */ | |
67 | uint64_t mockfs_memdev_size; /* Size of the backing store (valid if memory backed) */ | |
68 | }; | |
69 | ||
70 | typedef struct mockfs_mount * mockfs_mount_t; | |
71 | ||
72 | #endif /* MOCKFS */ | |
73 | ||
74 | #endif /* MOCKFS_H */ |