Root/
Source at commit 296 created 12 years 11 months ago. By ifabio, add i386 folder | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1998-2009 Apple Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_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. Please obtain a copy of the License at␊ |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
11 | * file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
18 | * Please see the License for the specific language governing rights and␊ |
19 | * limitations under the License.␊ |
20 | * ␊ |
21 | * @APPLE_LICENSE_HEADER_END@␊ |
22 | */␊ |
23 | ␊ |
24 | /*!␊ |
25 | * @header IOMedia␊ |
26 | * @abstract␊ |
27 | * This header contains the IOMedia class definition.␊ |
28 | */␊ |
29 | ␊ |
30 | #ifndef _IOMEDIA_H␊ |
31 | #define _IOMEDIA_H␊ |
32 | ␊ |
33 | #include <IOKit/IOTypes.h>␊ |
34 | ␊ |
35 | /*!␊ |
36 | * @defined kIOMediaClass␊ |
37 | * @abstract␊ |
38 | * The name of the IOMedia class.␊ |
39 | */␊ |
40 | ␊ |
41 | #define kIOMediaClass "IOMedia"␊ |
42 | ␊ |
43 | /*!␊ |
44 | * @defined kIOMediaContentKey␊ |
45 | * @abstract␊ |
46 | * A property of IOMedia objects.␊ |
47 | * @discussion␊ |
48 | * The kIOMediaContentKey property has an OSString␊ |
49 | * value and contains a description of the media's␊ |
50 | * contents. The description is the same as the hint at the time of the␊ |
51 | * object's creation, but it is possible that the description has been overridden␊ |
52 | * by a client (which has probed the media and identified the content correctly)␊ |
53 | * of the media object. It is more accurate than the hint for this reason. The␊ |
54 | * string is formed in the likeness of Apple's "Apple_HFS" strings or in the␊ |
55 | * likeness of a UUID.␊ |
56 | */␊ |
57 | ␊ |
58 | #define kIOMediaContentKey "Content"␊ |
59 | ␊ |
60 | /*!␊ |
61 | * @defined kIOMediaContentHintKey␊ |
62 | * @abstract␊ |
63 | * A property of IOMedia objects.␊ |
64 | * @discussion␊ |
65 | * The kIOMediaContentHintKey property has an OSString␊ |
66 | * value and contains a hint of the media's contents.␊ |
67 | * The hint is set at the time of the object's creation, should the creator have␊ |
68 | * a clue as to what it may contain. The hint string does not change for the␊ |
69 | * lifetime of the object and is formed in the likeness of Apple's "Apple_HFS"␊ |
70 | * strings or in the likeness of a UUID.␊ |
71 | */␊ |
72 | ␊ |
73 | #define kIOMediaContentHintKey "Content Hint"␊ |
74 | ␊ |
75 | /*!␊ |
76 | * @defined kIOMediaEjectableKey␊ |
77 | * @abstract␊ |
78 | * A property of IOMedia objects.␊ |
79 | * @discussion␊ |
80 | * The kIOMediaEjectableKey property has an OSBoolean␊ |
81 | * value and describes whether the media is ejectable␊ |
82 | * from the drive mechanism under software control. Implies IOMediaRemovable␊ |
83 | * is also true.␊ |
84 | */␊ |
85 | ␊ |
86 | #define kIOMediaEjectableKey "Ejectable"␊ |
87 | ␊ |
88 | /*!␊ |
89 | * @defined kIOMediaLeafKey␊ |
90 | * @abstract␊ |
91 | * A property of IOMedia objects.␊ |
92 | * @discussion␊ |
93 | * The kIOMediaLeafKey property has an OSBoolean value and describes whether the media is a leaf, that is,␊ |
94 | * it is the deepest media object in this branch of the I/O Registry.␊ |
95 | */␊ |
96 | ␊ |
97 | #define kIOMediaLeafKey "Leaf"␊ |
98 | ␊ |
99 | /*!␊ |
100 | * @defined kIOMediaOpenKey␊ |
101 | * @abstract␊ |
102 | * A property of IOMedia objects.␊ |
103 | * @discussion␊ |
104 | * The kIOMediaOpenKey property has an OSBoolean value and describes whether␊ |
105 | * a client presently has an open on this media.␊ |
106 | */␊ |
107 | ␊ |
108 | #define kIOMediaOpenKey "Open"␊ |
109 | ␊ |
110 | /*!␊ |
111 | * @defined kIOMediaPreferredBlockSizeKey␊ |
112 | * @abstract␊ |
113 | * A property of IOMedia objects.␊ |
114 | * @discussion␊ |
115 | * The kIOMediaPreferredBlockSizeKey property has an␊ |
116 | * OSNumber value and describes the media's natural␊ |
117 | * block size in bytes. This information is useful to clients that want to␊ |
118 | * optimize access to the media.␊ |
119 | */␊ |
120 | ␊ |
121 | #define kIOMediaPreferredBlockSizeKey "Preferred Block Size"␊ |
122 | ␊ |
123 | /*!␊ |
124 | * @defined kIOMediaRemovableKey␊ |
125 | * @abstract␊ |
126 | * A property of IOMedia objects.␊ |
127 | * @discussion␊ |
128 | * The kIOMediaRemovableKey property has an OSBoolean␊ |
129 | * value and describes whether the media is removable␊ |
130 | * from the drive mechanism.␊ |
131 | */␊ |
132 | ␊ |
133 | #define kIOMediaRemovableKey "Removable"␊ |
134 | ␊ |
135 | /*!␊ |
136 | * @defined kIOMediaSizeKey␊ |
137 | * @abstract␊ |
138 | * A property of IOMedia objects.␊ |
139 | * @discussion␊ |
140 | * The kIOMediaSizeKey property has an OSNumber value and describes the total length of the media in␊ |
141 | * bytes.␊ |
142 | */␊ |
143 | ␊ |
144 | #define kIOMediaSizeKey "Size"␊ |
145 | ␊ |
146 | /*!␊ |
147 | * @defined kIOMediaUUIDKey␊ |
148 | * @abstract␊ |
149 | * A property of IOMedia objects.␊ |
150 | * @discussion␊ |
151 | * The kIOMediaUUIDKey property has an OSString value and contains a persistent␊ |
152 | * Universal Unique Identifier for the media if such an identifier is available.␊ |
153 | */␊ |
154 | ␊ |
155 | #define kIOMediaUUIDKey "UUID"␊ |
156 | ␊ |
157 | /*!␊ |
158 | * @defined kIOMediaWholeKey␊ |
159 | * @abstract␊ |
160 | * A property of IOMedia objects.␊ |
161 | * @discussion␊ |
162 | * The kIOMediaWholeKey property has an OSBoolean␊ |
163 | * value and describes whether the media is whole, that is,␊ |
164 | * it represents the whole disk (the physical disk, or a virtual replica␊ |
165 | * thereof).␊ |
166 | */␊ |
167 | ␊ |
168 | #define kIOMediaWholeKey "Whole"␊ |
169 | ␊ |
170 | /*!␊ |
171 | * @defined kIOMediaWritableKey␊ |
172 | * @abstract␊ |
173 | * A property of IOMedia objects.␊ |
174 | * @discussion␊ |
175 | * The kIOMediaWritableKey property has an OSBoolean␊ |
176 | * value and describes whether the media is writable.␊ |
177 | */␊ |
178 | ␊ |
179 | #define kIOMediaWritableKey "Writable"␊ |
180 | ␊ |
181 | /*!␊ |
182 | * @defined kIOMediaContentMaskKey␊ |
183 | * @abstract␊ |
184 | * A property of IOMedia clients.␊ |
185 | * @discussion␊ |
186 | * The kIOMediaContentMaskKey property has an OSString␊ |
187 | * value and must exist in all IOMedia clients that␊ |
188 | * drive new content (that is, produce new media objects). When the client␊ |
189 | * matches against the provider media, the value of the client's␊ |
190 | * kIOMediaContentMaskKey property is used to replace the provider's␊ |
191 | * kIOMediaContentKey property.␊ |
192 | */␊ |
193 | ␊ |
194 | #define kIOMediaContentMaskKey "Content Mask"␊ |
195 | ␊ |
196 | /*!␊ |
197 | * @defined kIOMediaIconKey␊ |
198 | * @abstract␊ |
199 | * A property of any object in the media stack.␊ |
200 | * @discussion␊ |
201 | * kIOMediaIconKey is a property of any object in the media stack that wishes␊ |
202 | * to override the default icon shown for the media objects in the stack. It␊ |
203 | * is usually defined in a provider object below the media object. It has an␊ |
204 | * OSDictionary value, with properties identical to the kIOIconKey definition,␊ |
205 | * that is, kCFBundleIdentifierKey and kIOBundleResourceFileKey.␊ |
206 | */␊ |
207 | ␊ |
208 | #define kIOMediaIconKey "IOMediaIcon"␊ |
209 | ␊ |
210 | /*!␊ |
211 | * @enum IOMediaAttributeMask␊ |
212 | * @discussion␊ |
213 | * The IOMediaAttributeMask bit mask describes various attributes of␊ |
214 | * the media object, such as its ejectability and its removability.␊ |
215 | * @constant kIOMediaAttributeEjectableMask␊ |
216 | * Indicates whether the media is ejectable from the drive mechanism␊ |
217 | * under software control. Implies kIOMediaAttributeRemovableMask.␊ |
218 | * @constant kIOMediaAttributeRemovableMask␊ |
219 | * Indicates whether the media is removable from the drive mechanism.␊ |
220 | */␊ |
221 | ␊ |
222 | enum␊ |
223 | {␊ |
224 | kIOMediaAttributeEjectableMask = 0x00000001,␊ |
225 | kIOMediaAttributeRemovableMask = 0x00000002,␊ |
226 | kIOMediaAttributeReservedMask = 0xFFFFFFFC␊ |
227 | };␊ |
228 | ␊ |
229 | typedef UInt32 IOMediaAttributeMask;␊ |
230 | ␊ |
231 | #ifdef KERNEL␊ |
232 | #ifdef __cplusplus␊ |
233 | ␊ |
234 | /*␊ |
235 | * Kernel␊ |
236 | */␊ |
237 | ␊ |
238 | #include <IOKit/storage/IOStorage.h>␊ |
239 | ␊ |
240 | /*!␊ |
241 | * @class IOMedia␊ |
242 | * @abstract␊ |
243 | * A random-access disk device abstraction.␊ |
244 | * @discussion␊ |
245 | * The IOMedia class is a random-access disk device abstraction. It provides a␊ |
246 | * consistent interface for both real and virtual disk devices, for subdivisions␊ |
247 | * of disks such as partitions, for supersets of disks such as RAID volumes, and␊ |
248 | * so on. It extends the IOStorage class by implementing the appropriate open,␊ |
249 | * close, read, write, and matching semantics for media objects. The properties␊ |
250 | * it has reflect the properties of real disk devices, such as ejectability and␊ |
251 | * writability.␊ |
252 | *␊ |
253 | * The read and write interfaces support byte-level access to the storage space,␊ |
254 | * with the appropriate deblocking handled by the block storage driver, however,␊ |
255 | * a typical client will want to get the natural block size in order to optimize␊ |
256 | * access to the real disk device. A read or write is accepted so long as the␊ |
257 | * client's access is valid, the media is formatted and the transfer is within␊ |
258 | * the bounds of the media. An optional non-zero base (offset) is then applied␊ |
259 | * before the read or write is passed to provider object.␊ |
260 | */␊ |
261 | ␊ |
262 | class IOMedia : public IOStorage␊ |
263 | {␊ |
264 | OSDeclareDefaultStructors(IOMedia)␊ |
265 | ␊ |
266 | protected:␊ |
267 | ␊ |
268 | struct ExpansionData { /* */ };␊ |
269 | ExpansionData * _expansionData;␊ |
270 | ␊ |
271 | UInt32 _attributes;␊ |
272 | ␊ |
273 | bool _isWhole;␊ |
274 | bool _isWritable;␊ |
275 | ␊ |
276 | UInt64 _mediaBase; /* (relative to the storage object below us) */␊ |
277 | UInt64 _mediaSize;␊ |
278 | ␊ |
279 | IOStorageAccess _openLevel;␊ |
280 | OSDictionary * _openClients;␊ |
281 | ␊ |
282 | UInt32 _reserved0320;␊ |
283 | ␊ |
284 | UInt64 _preferredBlockSize;␊ |
285 | ␊ |
286 | /*␊ |
287 | * Free all of this object's outstanding resources.␊ |
288 | */␊ |
289 | ␊ |
290 | virtual void free();␊ |
291 | ␊ |
292 | /*!␊ |
293 | * @function handleOpen␊ |
294 | * @discussion␊ |
295 | * The handleOpen method grants or denies permission to access this object␊ |
296 | * to an interested client. The argument is an IOStorageAccess value that␊ |
297 | * specifies the level of access desired -- reader or reader-writer.␊ |
298 | *␊ |
299 | * This method can be invoked to upgrade or downgrade the access level for␊ |
300 | * an existing client as well. The previous access level will prevail for␊ |
301 | * upgrades that fail, of course. A downgrade should never fail. If the␊ |
302 | * new access level should be the same as the old for a given client, this␊ |
303 | * method will do nothing and return success. In all cases, one, singular␊ |
304 | * close-per-client is expected for all opens-per-client received.␊ |
305 | *␊ |
306 | * This implementation replaces the IOService definition of handleOpen().␊ |
307 | * @param client␊ |
308 | * Client requesting the open.␊ |
309 | * @param options␊ |
310 | * Options for the open. Set to zero.␊ |
311 | * @param access␊ |
312 | * Access level for the open. Set to kIOStorageAccessReader or␊ |
313 | * kIOStorageAccessReaderWriter.␊ |
314 | * @result␊ |
315 | * Returns true if the open was successful, false otherwise.␊ |
316 | */␊ |
317 | ␊ |
318 | virtual bool handleOpen(IOService * client,␊ |
319 | IOOptionBits options,␊ |
320 | void * access);␊ |
321 | ␊ |
322 | /*!␊ |
323 | * @function handleIsOpen␊ |
324 | * @discussion␊ |
325 | * The handleIsOpen method determines whether the specified client, or any␊ |
326 | * client if none is specified, presently has an open on this object.␊ |
327 | *␊ |
328 | * This implementation replaces the IOService definition of handleIsOpen().␊ |
329 | * @param client␊ |
330 | * Client to check the open state of. Set to zero to check the open state␊ |
331 | * of all clients.␊ |
332 | * @result␊ |
333 | * Returns true if the client was (or clients were) open, false otherwise.␊ |
334 | */␊ |
335 | ␊ |
336 | virtual bool handleIsOpen(const IOService * client) const;␊ |
337 | ␊ |
338 | /*!␊ |
339 | * @function handleClose␊ |
340 | * @discussion␊ |
341 | * The handleClose method closes the client's access to this object.␊ |
342 | *␊ |
343 | * This implementation replaces the IOService definition of handleClose().␊ |
344 | * @param client␊ |
345 | * Client requesting the close.␊ |
346 | * @param options␊ |
347 | * Options for the close. Set to zero.␊ |
348 | */␊ |
349 | ␊ |
350 | virtual void handleClose(IOService * client, IOOptionBits options);␊ |
351 | ␊ |
352 | public:␊ |
353 | ␊ |
354 | using IOStorage::read;␊ |
355 | using IOStorage::write;␊ |
356 | ␊ |
357 | #ifndef __LP64__␊ |
358 | virtual bool init(UInt64 base,␊ |
359 | UInt64 size,␊ |
360 | UInt64 preferredBlockSize,␊ |
361 | bool isEjectable,␊ |
362 | bool isWhole,␊ |
363 | bool isWritable,␊ |
364 | const char * contentHint = 0,␊ |
365 | OSDictionary * properties = 0) __attribute__ ((deprecated));␊ |
366 | #endif /* !__LP64__ */␊ |
367 | ␊ |
368 | /*␊ |
369 | * This method is called for each client interested in the services we␊ |
370 | * provide. The superclass links us as a parent to this client in the␊ |
371 | * I/O Kit registry on success.␊ |
372 | */␊ |
373 | ␊ |
374 | virtual bool attachToChild(IORegistryEntry * client,␊ |
375 | const IORegistryPlane * plane);␊ |
376 | ␊ |
377 | /*␊ |
378 | * This method is called for each client that loses interest in the␊ |
379 | * services we provide. The superclass unlinks us from this client␊ |
380 | * in the I/O Kit registry on success.␊ |
381 | */␊ |
382 | ␊ |
383 | virtual void detachFromChild(IORegistryEntry * client,␊ |
384 | const IORegistryPlane * plane);␊ |
385 | ␊ |
386 | /*␊ |
387 | * Obtain this object's provider. We override the superclass's method to␊ |
388 | * return a more specific subclass of OSObject -- IOStorage. This method␊ |
389 | * serves simply as a convenience to subclass developers.␊ |
390 | */␊ |
391 | ␊ |
392 | virtual IOStorage * getProvider() const;␊ |
393 | ␊ |
394 | /*␊ |
395 | * Compare the properties in the supplied table to this object's properties.␊ |
396 | */␊ |
397 | ␊ |
398 | virtual bool matchPropertyTable(OSDictionary * table, SInt32 * score);␊ |
399 | ␊ |
400 | /*!␊ |
401 | * @function read␊ |
402 | * @discussion␊ |
403 | * Read data from the storage object at the specified byte offset into the␊ |
404 | * specified buffer, asynchronously. When the read completes, the caller␊ |
405 | * will be notified via the specified completion action.␊ |
406 | *␊ |
407 | * The buffer will be retained for the duration of the read.␊ |
408 | * @param client␊ |
409 | * Client requesting the read.␊ |
410 | * @param byteStart␊ |
411 | * Starting byte offset for the data transfer.␊ |
412 | * @param buffer␊ |
413 | * Buffer for the data transfer. The size of the buffer implies the size of␊ |
414 | * the data transfer.␊ |
415 | * @param attributes␊ |
416 | * Attributes of the data transfer. See IOStorageAttributes. It is the␊ |
417 | * responsibility of the callee to maintain the information for the duration␊ |
418 | * of the data transfer, as necessary.␊ |
419 | * @param completion␊ |
420 | * Completion routine to call once the data transfer is complete. It is the␊ |
421 | * responsibility of the callee to maintain the information for the duration␊ |
422 | * of the data transfer, as necessary.␊ |
423 | */␊ |
424 | ␊ |
425 | virtual void read(IOService * client,␊ |
426 | UInt64 byteStart,␊ |
427 | IOMemoryDescriptor * buffer,␊ |
428 | IOStorageAttributes * attributes,␊ |
429 | IOStorageCompletion * completion);␊ |
430 | ␊ |
431 | /*!␊ |
432 | * @function write␊ |
433 | * @discussion␊ |
434 | * Write data into the storage object at the specified byte offset from the␊ |
435 | * specified buffer, asynchronously. When the write completes, the caller␊ |
436 | * will be notified via the specified completion action.␊ |
437 | *␊ |
438 | * The buffer will be retained for the duration of the write.␊ |
439 | * @param client␊ |
440 | * Client requesting the write.␊ |
441 | * @param byteStart␊ |
442 | * Starting byte offset for the data transfer.␊ |
443 | * @param buffer␊ |
444 | * Buffer for the data transfer. The size of the buffer implies the size of␊ |
445 | * the data transfer.␊ |
446 | * @param attributes␊ |
447 | * Attributes of the data transfer. See IOStorageAttributes. It is the␊ |
448 | * responsibility of the callee to maintain the information for the duration␊ |
449 | * of the data transfer, as necessary.␊ |
450 | * @param completion␊ |
451 | * Completion routine to call once the data transfer is complete. It is the␊ |
452 | * responsibility of the callee to maintain the information for the duration␊ |
453 | * of the data transfer, as necessary.␊ |
454 | */␊ |
455 | ␊ |
456 | virtual void write(IOService * client,␊ |
457 | UInt64 byteStart,␊ |
458 | IOMemoryDescriptor * buffer,␊ |
459 | IOStorageAttributes * attributes,␊ |
460 | IOStorageCompletion * completion);␊ |
461 | ␊ |
462 | /*!␊ |
463 | * @function synchronizeCache␊ |
464 | * @discussion␊ |
465 | * Flush the cached data in the storage object, if any, synchronously.␊ |
466 | * @param client␊ |
467 | * Client requesting the cache synchronization.␊ |
468 | * @result␊ |
469 | * Returns the status of the cache synchronization.␊ |
470 | */␊ |
471 | ␊ |
472 | virtual IOReturn synchronizeCache(IOService * client);␊ |
473 | ␊ |
474 | /*!␊ |
475 | * @function discard␊ |
476 | * @discussion␊ |
477 | * Delete unused data from the storage object at the specified byte offset,␊ |
478 | * synchronously.␊ |
479 | * @param client␊ |
480 | * Client requesting the operation.␊ |
481 | * @param byteStart␊ |
482 | * Starting byte offset for the operation.␊ |
483 | * @param byteCount␊ |
484 | * Size of the operation.␊ |
485 | * @result␊ |
486 | * Returns the status of the operation.␊ |
487 | */␊ |
488 | ␊ |
489 | virtual IOReturn discard(IOService * client,␊ |
490 | UInt64 byteStart,␊ |
491 | UInt64 byteCount);␊ |
492 | ␊ |
493 | /*!␊ |
494 | * @function getPreferredBlockSize␊ |
495 | * @discussion␊ |
496 | * Ask the media object for its natural block size. This information␊ |
497 | * is useful to clients that want to optimize access to the media.␊ |
498 | * @result␊ |
499 | * Natural block size, in bytes.␊ |
500 | */␊ |
501 | ␊ |
502 | virtual UInt64 getPreferredBlockSize() const;␊ |
503 | ␊ |
504 | /*!␊ |
505 | * @function getSize␊ |
506 | * @discussion␊ |
507 | * Ask the media object for its total length in bytes.␊ |
508 | * @result␊ |
509 | * Media size, in bytes.␊ |
510 | */␊ |
511 | ␊ |
512 | virtual UInt64 getSize() const;␊ |
513 | ␊ |
514 | /*!␊ |
515 | * @function getBase␊ |
516 | * @discussion␊ |
517 | * Ask the media object for its byte offset relative to its provider media␊ |
518 | * object below it in the storage hierarchy.␊ |
519 | * Media offset, in bytes.␊ |
520 | */␊ |
521 | ␊ |
522 | virtual UInt64 getBase() const;␊ |
523 | ␊ |
524 | /*!␊ |
525 | * @function isEjectable␊ |
526 | * @discussion␊ |
527 | * Ask the media object whether it is ejectable.␊ |
528 | * @result␊ |
529 | * Returns true if the media is ejectable, false otherwise.␊ |
530 | */␊ |
531 | ␊ |
532 | virtual bool isEjectable() const;␊ |
533 | ␊ |
534 | /*!␊ |
535 | * @function isFormatted␊ |
536 | * @discussion␊ |
537 | * Ask the media object whether it is formatted.␊ |
538 | * @result␊ |
539 | * Returns true if the media is formatted, false otherwise.␊ |
540 | */␊ |
541 | ␊ |
542 | virtual bool isFormatted() const;␊ |
543 | ␊ |
544 | /*!␊ |
545 | * @function isWhole␊ |
546 | * @discussion␊ |
547 | * Ask the media object whether it represents the whole disk.␊ |
548 | * @result␊ |
549 | * Returns true if the media represents the whole disk, false otherwise.␊ |
550 | */␊ |
551 | ␊ |
552 | virtual bool isWhole() const;␊ |
553 | ␊ |
554 | /*!␊ |
555 | * @function isWritable␊ |
556 | * @discussion␊ |
557 | * Ask the media object whether it is writable.␊ |
558 | * @result␊ |
559 | * Returns true if the media is writable, false otherwise.␊ |
560 | */␊ |
561 | ␊ |
562 | virtual bool isWritable() const;␊ |
563 | ␊ |
564 | /*!␊ |
565 | * @function getContent␊ |
566 | * @discussion␊ |
567 | * Ask the media object for a description of its contents. The description␊ |
568 | * is the same as the hint at the time of the object's creation, but it is␊ |
569 | * possible that the description has been overridden by a client (which has probed␊ |
570 | * the media and identified the content correctly) of the media object. It␊ |
571 | * is more accurate than the hint for this reason. The string is formed in␊ |
572 | * the likeness of Apple's "Apple_HFS" strings or in the likeness of a UUID.␊ |
573 | *␊ |
574 | * The content description can be overridden by any client that matches onto␊ |
575 | * this media object with a match category of kIOStorageCategory. The media␊ |
576 | * object checks for a kIOMediaContentMaskKey property in the client, and if␊ |
577 | * it finds one, it copies it into kIOMediaContentKey property.␊ |
578 | * @result␊ |
579 | * Description of media's contents.␊ |
580 | */␊ |
581 | ␊ |
582 | virtual const char * getContent() const;␊ |
583 | ␊ |
584 | /*!␊ |
585 | * @function getContentHint␊ |
586 | * @discussion␊ |
587 | * Ask the media object for a hint of its contents. The hint is set at the␊ |
588 | * time of the object's creation, should the creator have a clue as to what␊ |
589 | * it may contain. The hint string does not change for the lifetime of the␊ |
590 | * object and is also formed in the likeness of Apple's "Apple_HFS" strings␊ |
591 | * or in the likeness of a UUID.␊ |
592 | * @result␊ |
593 | * Hint of media's contents.␊ |
594 | */␊ |
595 | ␊ |
596 | virtual const char * getContentHint() const;␊ |
597 | ␊ |
598 | /*!␊ |
599 | * @function init␊ |
600 | * @discussion␊ |
601 | * Initialize this object's minimal state.␊ |
602 | * @param base␊ |
603 | * Media offset, in bytes.␊ |
604 | * @param size␊ |
605 | * Media size, in bytes.␊ |
606 | * @param preferredBlockSize␊ |
607 | * Natural block size, in bytes.␊ |
608 | * @param attributes␊ |
609 | * Media attributes, such as ejectability and removability. See␊ |
610 | * IOMediaAttributeMask.␊ |
611 | * @param isWhole␊ |
612 | * Indicates whether the media represents the whole disk.␊ |
613 | * @param isWritable␊ |
614 | * Indicates whether the media is writable.␊ |
615 | * @param contentHint␊ |
616 | * Hint of media's contents (optional). See getContentHint().␊ |
617 | * @param properties␊ |
618 | * Substitute property table for this object (optional).␊ |
619 | * @result␊ |
620 | * Returns true on success, false otherwise.␊ |
621 | */␊ |
622 | ␊ |
623 | virtual bool init(UInt64 base,␊ |
624 | UInt64 size,␊ |
625 | UInt64 preferredBlockSize,␊ |
626 | IOMediaAttributeMask attributes,␊ |
627 | bool isWhole,␊ |
628 | bool isWritable,␊ |
629 | const char * contentHint = 0,␊ |
630 | OSDictionary * properties = 0); /* 10.2.0 */␊ |
631 | ␊ |
632 | /*!␊ |
633 | * @function getAttributes␊ |
634 | * @discussion␊ |
635 | * Ask the media object for its attributes.␊ |
636 | * @result␊ |
637 | * Media attributes, such as ejectability and removability. See␊ |
638 | * IOMediaAttributeMask.␊ |
639 | */␊ |
640 | ␊ |
641 | virtual IOMediaAttributeMask getAttributes() const; /* 10.2.0 */␊ |
642 | ␊ |
643 | #ifdef __LP64__␊ |
644 | OSMetaClassDeclareReservedUnused(IOMedia, 0);␊ |
645 | OSMetaClassDeclareReservedUnused(IOMedia, 1);␊ |
646 | #else /* !__LP64__ */␊ |
647 | OSMetaClassDeclareReservedUsed(IOMedia, 0);␊ |
648 | OSMetaClassDeclareReservedUsed(IOMedia, 1);␊ |
649 | #endif /* !__LP64__ */␊ |
650 | OSMetaClassDeclareReservedUnused(IOMedia, 2);␊ |
651 | OSMetaClassDeclareReservedUnused(IOMedia, 3);␊ |
652 | OSMetaClassDeclareReservedUnused(IOMedia, 4);␊ |
653 | OSMetaClassDeclareReservedUnused(IOMedia, 5);␊ |
654 | OSMetaClassDeclareReservedUnused(IOMedia, 6);␊ |
655 | OSMetaClassDeclareReservedUnused(IOMedia, 7);␊ |
656 | OSMetaClassDeclareReservedUnused(IOMedia, 8);␊ |
657 | OSMetaClassDeclareReservedUnused(IOMedia, 9);␊ |
658 | OSMetaClassDeclareReservedUnused(IOMedia, 10);␊ |
659 | OSMetaClassDeclareReservedUnused(IOMedia, 11);␊ |
660 | OSMetaClassDeclareReservedUnused(IOMedia, 12);␊ |
661 | OSMetaClassDeclareReservedUnused(IOMedia, 13);␊ |
662 | OSMetaClassDeclareReservedUnused(IOMedia, 14);␊ |
663 | OSMetaClassDeclareReservedUnused(IOMedia, 15);␊ |
664 | };␊ |
665 | ␊ |
666 | #endif /* __cplusplus */␊ |
667 | #endif /* KERNEL */␊ |
668 | #endif /* !_IOMEDIA_H */␊ |
669 |