Root/
Source at commit 1083 created 13 years 1 month ago. By meklort, add GetDriveInfo | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
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␊ |
24 | * limitations under the License.␊ |
25 | * ␊ |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@␊ |
27 | */␊ |
28 | /*␊ |
29 | * @OSF_COPYRIGHT@␊ |
30 | */␊ |
31 | /* ␊ |
32 | * Mach Operating System␊ |
33 | * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University␊ |
34 | * All Rights Reserved.␊ |
35 | * ␊ |
36 | * Permission to use, copy, modify and distribute this software and its␊ |
37 | * documentation is hereby granted, provided that both the copyright␊ |
38 | * notice and this permission notice appear in all copies of the␊ |
39 | * software, derivative works or modified versions, and any portions␊ |
40 | * thereof, and that both notices appear in supporting documentation.␊ |
41 | * ␊ |
42 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"␊ |
43 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR␊ |
44 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.␊ |
45 | * ␊ |
46 | * Carnegie Mellon requests users of this software to return to␊ |
47 | * ␊ |
48 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU␊ |
49 | * School of Computer Science␊ |
50 | * Carnegie Mellon University␊ |
51 | * Pittsburgh PA 15213-3890␊ |
52 | * ␊ |
53 | * any improvements or extensions that they make and grant Carnegie Mellon␊ |
54 | * the rights to redistribute these changes.␊ |
55 | */␊ |
56 | /*␊ |
57 | */␊ |
58 | /*␊ |
59 | *␉File:␉memory_object.h␊ |
60 | *␉Author:␉Michael Wayne Young␊ |
61 | *␊ |
62 | *␉External memory management interface definition.␊ |
63 | */␊ |
64 | ␊ |
65 | #ifndef␉_MACH_MEMORY_OBJECT_TYPES_H_␊ |
66 | #define _MACH_MEMORY_OBJECT_TYPES_H_␊ |
67 | ␊ |
68 | /*␊ |
69 | *␉User-visible types used in the external memory␊ |
70 | *␉management interface:␊ |
71 | */␊ |
72 | ␊ |
73 | #include <mach/port.h>␊ |
74 | #include <mach/message.h>␊ |
75 | #include <mach/vm_prot.h>␊ |
76 | #include <mach/vm_sync.h>␊ |
77 | #include <mach/vm_types.h>␊ |
78 | #include <mach/machine/vm_types.h>␊ |
79 | ␊ |
80 | #include <sys/cdefs.h>␊ |
81 | ␊ |
82 | #define VM_64_BIT_DATA_OBJECTS␊ |
83 | ␊ |
84 | typedef unsigned long long␉memory_object_offset_t;␊ |
85 | typedef unsigned long long␉memory_object_size_t;␊ |
86 | typedef natural_t␉␉memory_object_cluster_size_t;␊ |
87 | typedef natural_t *␉␉memory_object_fault_info_t;␊ |
88 | ␊ |
89 | typedef unsigned long long ␉vm_object_id_t;␊ |
90 | ␊ |
91 | ␊ |
92 | /*␊ |
93 | * Temporary until real EMMI version gets re-implemented␊ |
94 | */␊ |
95 | ␊ |
96 | ␊ |
97 | typedef mach_port_t␉memory_object_t;␊ |
98 | typedef mach_port_t␉memory_object_control_t;␊ |
99 | ␊ |
100 | ␊ |
101 | typedef memory_object_t *memory_object_array_t;␊ |
102 | ␉␉␉␉␉/* A memory object ... */␊ |
103 | ␉␉␉␉␉/* Used by the kernel to retrieve */␊ |
104 | ␉␉␉␉␉/* or store data */␊ |
105 | ␊ |
106 | typedef␉mach_port_t␉memory_object_name_t;␊ |
107 | ␉␉␉␉␉/* Used to describe the memory ... */␊ |
108 | ␉␉␉␉␉/* object in vm_regions() calls */␊ |
109 | ␊ |
110 | typedef mach_port_t␉memory_object_default_t;␊ |
111 | ␉␉␉␉␉/* Registered with the host ... */␊ |
112 | ␉␉␉␉␉/* for creating new internal objects */␊ |
113 | ␊ |
114 | #define MEMORY_OBJECT_NULL␉␉((memory_object_t) 0)␊ |
115 | #define MEMORY_OBJECT_CONTROL_NULL␉((memory_object_control_t) 0)␊ |
116 | #define MEMORY_OBJECT_NAME_NULL␉␉((memory_object_name_t) 0)␊ |
117 | #define MEMORY_OBJECT_DEFAULT_NULL␉((memory_object_default_t) 0)␊ |
118 | ␊ |
119 | ␊ |
120 | typedef␉int␉␉memory_object_copy_strategy_t;␊ |
121 | ␉␉␉␉␉/* How memory manager handles copy: */␊ |
122 | #define␉␉MEMORY_OBJECT_COPY_NONE␉␉0␊ |
123 | ␉␉␉␉␉/* ... No special support */␊ |
124 | #define␉␉MEMORY_OBJECT_COPY_CALL␉␉1␊ |
125 | ␉␉␉␉␉/* ... Make call on memory manager */␊ |
126 | #define␉␉MEMORY_OBJECT_COPY_DELAY ␉2␊ |
127 | ␉␉␉␉␉/* ... Memory manager doesn't␊ |
128 | ␉␉␉␉␉ * change data externally.␊ |
129 | ␉␉␉␉␉ */␊ |
130 | #define␉␉MEMORY_OBJECT_COPY_TEMPORARY ␉3␊ |
131 | ␉␉␉␉␉/* ... Memory manager doesn't␊ |
132 | ␉␉␉␉␉ * change data externally, and␊ |
133 | ␉␉␉␉␉ * doesn't need to see changes.␊ |
134 | ␉␉␉␉␉ */␊ |
135 | #define␉␉MEMORY_OBJECT_COPY_SYMMETRIC ␉4␊ |
136 | ␉␉␉␉␉/* ... Memory manager doesn't␊ |
137 | ␉␉␉␉␉ * change data externally,␊ |
138 | ␉␉␉␉␉ * doesn't need to see changes,␊ |
139 | ␉␉␉␉␉ * and object will not be␊ |
140 | ␉␉␉␉␉ * multiply mapped.␊ |
141 | ␉␉␉␉␉ *␊ |
142 | ␉␉␉␉␉ * XXX␊ |
143 | ␉␉␉␉␉ * Not yet safe for non-kernel use.␊ |
144 | ␉␉␉␉␉ */␊ |
145 | ␊ |
146 | #define␉␉MEMORY_OBJECT_COPY_INVALID␉5␊ |
147 | ␉␉␉␉␉/* ...␉An invalid copy strategy,␊ |
148 | ␉␉␉␉␉ *␉for external objects which␊ |
149 | ␉␉␉␉␉ *␉have not been initialized.␊ |
150 | ␉␉␉␉␉ *␉Allows copy_strategy to be␊ |
151 | ␉␉␉␉␉ *␉examined without also␊ |
152 | ␉␉␉␉␉ *␉examining pager_ready and␊ |
153 | ␉␉␉␉␉ *␉internal.␊ |
154 | ␉␉␉␉␉ */␊ |
155 | ␊ |
156 | typedef␉int␉␉memory_object_return_t;␊ |
157 | ␉␉␉␉␉/* Which pages to return to manager␊ |
158 | ␉␉␉␉␉ this time (lock_request) */␊ |
159 | #define␉␉MEMORY_OBJECT_RETURN_NONE␉0␊ |
160 | ␉␉␉␉␉/* ... don't return any. */␊ |
161 | #define␉␉MEMORY_OBJECT_RETURN_DIRTY␉1␊ |
162 | ␉␉␉␉␉/* ... only dirty pages. */␊ |
163 | #define␉␉MEMORY_OBJECT_RETURN_ALL␉2␊ |
164 | ␉␉␉␉␉/* ... dirty and precious pages. */␊ |
165 | #define␉␉MEMORY_OBJECT_RETURN_ANYTHING␉3␊ |
166 | ␉␉␉␉␉/* ... any resident page. */␊ |
167 | ␊ |
168 | /* ␊ |
169 | *␉Data lock request flags␊ |
170 | */␊ |
171 | ␊ |
172 | #define␉␉MEMORY_OBJECT_DATA_FLUSH ␉0x1␊ |
173 | #define␉␉MEMORY_OBJECT_DATA_NO_CHANGE␉0x2␊ |
174 | #define␉␉MEMORY_OBJECT_DATA_PURGE␉0x4␊ |
175 | #define␉␉MEMORY_OBJECT_COPY_SYNC␉␉0x8␊ |
176 | #define␉␉MEMORY_OBJECT_DATA_SYNC␉␉0x10␊ |
177 | #define MEMORY_OBJECT_IO_SYNC 0x20␊ |
178 | #define␉␉MEMORY_OBJECT_DATA_FLUSH_ALL␉0x40␊ |
179 | ␊ |
180 | /*␊ |
181 | *␉Types for the memory object flavor interfaces␊ |
182 | */␊ |
183 | ␊ |
184 | #define MEMORY_OBJECT_INFO_MAX (1024) ␊ |
185 | typedef int *memory_object_info_t; ␊ |
186 | typedef int␉ memory_object_flavor_t;␊ |
187 | typedef int memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];␊ |
188 | ␊ |
189 | ␊ |
190 | #define MEMORY_OBJECT_PERFORMANCE_INFO␉11␊ |
191 | #define MEMORY_OBJECT_ATTRIBUTE_INFO␉14␊ |
192 | #define MEMORY_OBJECT_BEHAVIOR_INFO ␉15␉␊ |
193 | ␊ |
194 | ␊ |
195 | struct memory_object_perf_info {␊ |
196 | ␉memory_object_cluster_size_t␉cluster_size;␊ |
197 | ␉boolean_t␉␉␉may_cache;␊ |
198 | };␊ |
199 | ␊ |
200 | struct memory_object_attr_info {␊ |
201 | ␉memory_object_copy_strategy_t␉copy_strategy;␊ |
202 | ␉memory_object_cluster_size_t␉cluster_size;␊ |
203 | ␉boolean_t␉␉␉may_cache_object;␊ |
204 | ␉boolean_t␉␉␉temporary;␊ |
205 | };␊ |
206 | ␊ |
207 | struct memory_object_behave_info {␊ |
208 | ␉memory_object_copy_strategy_t␉copy_strategy;␉␊ |
209 | ␉boolean_t␉␉␉temporary;␊ |
210 | ␉boolean_t␉␉␉invalidate;␊ |
211 | ␉boolean_t␉␉␉silent_overwrite;␊ |
212 | ␉boolean_t␉␉␉advisory_pageout;␊ |
213 | };␊ |
214 | ␊ |
215 | ␊ |
216 | typedef struct memory_object_behave_info *memory_object_behave_info_t;␊ |
217 | typedef struct memory_object_behave_info memory_object_behave_info_data_t;␊ |
218 | ␊ |
219 | typedef struct memory_object_perf_info ␉*memory_object_perf_info_t;␊ |
220 | typedef struct memory_object_perf_info␉memory_object_perf_info_data_t;␊ |
221 | ␊ |
222 | typedef struct memory_object_attr_info␉*memory_object_attr_info_t;␊ |
223 | typedef struct memory_object_attr_info␉memory_object_attr_info_data_t;␊ |
224 | ␊ |
225 | #define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t)␉\␊ |
226 | (sizeof(memory_object_behave_info_data_t)/sizeof(int)))␊ |
227 | #define MEMORY_OBJECT_PERF_INFO_COUNT␉((mach_msg_type_number_t)␉\␊ |
228 | ␉␉(sizeof(memory_object_perf_info_data_t)/sizeof(int)))␊ |
229 | #define MEMORY_OBJECT_ATTR_INFO_COUNT␉((mach_msg_type_number_t)␉\␊ |
230 | ␉␉(sizeof(memory_object_attr_info_data_t)/sizeof(int)))␊ |
231 | ␊ |
232 | #define invalid_memory_object_flavor(f)␉␉␉␉␉\␊ |
233 | ␉(f != MEMORY_OBJECT_ATTRIBUTE_INFO && ␉␉␉␉\␊ |
234 | ␉ f != MEMORY_OBJECT_PERFORMANCE_INFO && ␉␉␉\␊ |
235 | ␉ f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO &&␉␉␉\␊ |
236 | ␉ f != MEMORY_OBJECT_BEHAVIOR_INFO &&␉␉␉␉\␊ |
237 | ␉ f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)␊ |
238 | ␊ |
239 | ␊ |
240 | /*␊ |
241 | * Used to support options on memory_object_release_name call␊ |
242 | */␊ |
243 | #define MEMORY_OBJECT_TERMINATE_IDLE␉0x1␊ |
244 | #define MEMORY_OBJECT_RESPECT_CACHE␉0x2␊ |
245 | #define MEMORY_OBJECT_RELEASE_NO_OP␉0x4␊ |
246 | ␊ |
247 | ␊ |
248 | /* named entry processor mapping options */␊ |
249 | /* enumerated */␊ |
250 | #define MAP_MEM_NOOP␉␉0␊ |
251 | #define MAP_MEM_COPYBACK␉1␊ |
252 | #define MAP_MEM_IO␉␉2␊ |
253 | #define MAP_MEM_WTHRU␉␉3␊ |
254 | #define MAP_MEM_WCOMB␉␉4␉/* Write combining mode */␊ |
255 | ␉␉␉␉␉/* aka store gather */␊ |
256 | ␊ |
257 | #define GET_MAP_MEM(flags)␉\␊ |
258 | ␉((((unsigned int)(flags)) >> 24) & 0xFF)␊ |
259 | ␊ |
260 | #define SET_MAP_MEM(caching, flags)␉\␊ |
261 | ␉((flags) = ((((unsigned int)(caching)) << 24) \␊ |
262 | ␉␉␉& 0xFF000000) | ((flags) & 0xFFFFFF));␊ |
263 | ␊ |
264 | /* leave room for vm_prot bits */␊ |
265 | #define MAP_MEM_ONLY␉␉0x10000␉/* change processor caching */␊ |
266 | #define MAP_MEM_NAMED_CREATE␉0x20000 /* create extant object */␊ |
267 | #define MAP_MEM_PURGABLE␉0x40000␉/* create a purgable VM object */␊ |
268 | #define MAP_MEM_NAMED_REUSE␉0x80000␉/* reuse provided entry if identical */␊ |
269 | ␊ |
270 | ␊ |
271 | #endif␉/* _MACH_MEMORY_OBJECT_TYPES_H_ */␊ |
272 |