Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Modules/i386/include/IOKit/storage/IOStorage.h

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 IOStorage
26 * @abstract
27 * This header contains the IOStorage class definition.
28 */
29
30#ifndef _IOSTORAGE_H
31#define _IOSTORAGE_H
32
33#include <IOKit/IOTypes.h>
34
35/*!
36 * @defined kIOStorageClass
37 * @abstract
38 * The name of the IOStorage class.
39 */
40
41#define kIOStorageClass "IOStorage"
42
43/*!
44 * @defined kIOStorageCategory
45 * @abstract
46 * kIOStorageCategory is a value for IOService's kIOMatchCategoryKey property.
47 * @discussion
48 * The kIOStorageCategory value is the standard value for the IOService property
49 * kIOMatchCategoryKey ("IOMatchCategory") for all storage drivers. All storage
50 * objects that expect to drive new content (that is, produce new media objects)
51 * are expected to compete within the kIOStorageCategory namespace.
52 *
53 * See the IOService documentation for more information on match categories.
54 */
55
56#define kIOStorageCategory "IOStorage" /* (as IOMatchCategory) */
57
58/*!
59 * @defined kIOStorageFeaturesKey
60 * @abstract
61 * A property of any object in the storage stack.
62 * @discussion
63 * kIOStorageFeaturesKey is a property of any object in the storage stack that
64 * wishes to express support of additional features, such as Force Unit Access.
65 * It is typically defined in the device object below the block storage driver
66 * object. It has an OSDictionary value, where each entry describes one given
67 * feature.
68 */
69
70#define kIOStorageFeaturesKey "IOStorageFeatures"
71
72/*!
73 * @defined kIOStorageFeatureDiscard
74 * @abstract
75 * Describes the presence of the Discard feature.
76 * @discussion
77 * This property describes the ability of the storage stack to delete unused
78 * data from the media. It is one of the feature entries listed under the top-
79 * level kIOStorageFeaturesKey property table. It has an OSBoolean value.
80 */
81
82#define kIOStorageFeatureDiscard "Discard"
83
84/*!
85 * @defined kIOStorageFeatureForceUnitAccess
86 * @abstract
87 * Describes the presence of the Force Unit Access feature.
88 * @discussion
89 * This property describes the ability of the storage stack to force a request
90 * to access the media. It is one of the feature entries listed under the top-
91 * level kIOStorageFeaturesKey property table. It has an OSBoolean value.
92 */
93
94#define kIOStorageFeatureForceUnitAccess "Force Unit Access"
95
96#ifdef KERNEL
97#ifdef __cplusplus
98
99/*
100 * Kernel
101 */
102
103#include <IOKit/assert.h>
104#include <IOKit/IOMemoryDescriptor.h>
105#include <IOKit/IOService.h>
106
107/*!
108 * @enum IOStorageAccess
109 * @discussion
110 * The IOStorageAccess enumeration describes the possible access levels for open
111 * requests.
112 * @constant kIOStorageAccessNone
113 * No access is requested; should not be passed to open().
114 * @constant kIOStorageAccessReader
115 * Read-only access is requested.
116 * @constant kIOStorageAccessReaderWriter
117 * Read and write access is requested.
118 * @constant kIOStorageAccessSharedLock
119 * Shared access is requested.
120 * @constant kIOStorageAccessExclusiveLock
121 * Exclusive access is requested.
122 */
123
124enum
125{
126 kIOStorageAccessNone = 0x00,
127 kIOStorageAccessReader = 0x01,
128 kIOStorageAccessReaderWriter = 0x03,
129 kIOStorageAccessSharedLock = 0x04,
130 kIOStorageAccessExclusiveLock = 0x08
131};
132
133typedef UInt32 IOStorageAccess;
134
135/*!
136 * @enum IOStorageOptions
137 * @discussion
138 * Options for read and write storage requests.
139 * @constant kIOStorageOptionForceUnitAccess
140 * Force the request to access the media.
141 */
142
143enum
144{
145 kIOStorageOptionNone = 0x00000000,
146 kIOStorageOptionForceUnitAccess = 0x00000001,
147 kIOStorageOptionReserved = 0xFFFFFFFE
148};
149
150typedef UInt32 IOStorageOptions;
151
152/*!
153 * @struct IOStorageAttributes
154 * @discussion
155 * Attributes of read and write storage requests.
156 * @field options
157 * Options for the request. See IOStorageOptions.
158 * @field reserved
159 * Reserved for future use. Set to zero.
160 */
161
162struct IOStorageAttributes
163{
164 IOStorageOptions options;
165 UInt32 reserved0032;
166 UInt64 reserved0064;
167#ifdef __LP64__
168 UInt64 reserved0128;
169 UInt64 reserved0192;
170#endif /* __LP64__ */
171};
172
173/*!
174 * @typedef IOStorageCompletionAction
175 * @discussion
176 * The IOStorageCompletionAction declaration describes the C (or C++) completion
177 * routine that is called once an asynchronous storage operation completes.
178 * @param target
179 * Opaque client-supplied pointer (or an instance pointer for a C++ callback).
180 * @param parameter
181 * Opaque client-supplied pointer.
182 * @param status
183 * Status of the data transfer.
184 * @param actualByteCount
185 * Actual number of bytes transferred in the data transfer.
186 */
187
188typedef void (*IOStorageCompletionAction)(void * target,
189 void * parameter,
190 IOReturn status,
191 UInt64 actualByteCount);
192
193/*!
194 * @struct IOStorageCompletion
195 * @discussion
196 * The IOStorageCompletion structure describes the C (or C++) completion routine
197 * that is called once an asynchronous storage operation completes. The values
198 * passed for the target and parameter fields will be passed to the routine when
199 * it is called.
200 * @field target
201 * Opaque client-supplied pointer (or an instance pointer for a C++ callback).
202 * @field action
203 * Completion routine to call on completion of the data transfer.
204 * @field parameter
205 * Opaque client-supplied pointer.
206 */
207
208struct IOStorageCompletion
209{
210 void * target;
211 IOStorageCompletionAction action;
212 void * parameter;
213};
214
215#endif /* __cplusplus */
216#endif /* KERNEL */
217#endif /* !_IOSTORAGE_H */
218

Archive Download this file

Revision: 1621