Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/iFabio/Chameleon/i386/include/IOKit/storage/IOCDPartitionScheme.h

Source at commit 296 created 12 years 10 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 IOCDPartitionScheme
26 * @abstract
27 * This header contains the IOCDPartitionScheme class definition.
28 */
29
30#ifndef _IOCDPARTITIONSCHEME_H
31#define _IOCDPARTITIONSCHEME_H
32
33#include <IOKit/storage/IOCDTypes.h>
34
35/*!
36 * @defined kIOCDPartitionSchemeClass
37 * @abstract
38 * kIOCDPartitionSchemeClass is the name of the IOCDPartitionScheme class.
39 * @discussion
40 * kIOCDPartitionSchemeClass is the name of the IOCDPartitionScheme class.
41 */
42
43#define kIOCDPartitionSchemeClass "IOCDPartitionScheme"
44
45/*!
46 * @defined kIOMediaSessionIDKey
47 * @abstract
48 * kIOMediaSessionIDKey is property of IOMedia objects. It has an OSNumber
49 * value.
50 * @discussion
51 * The kIOMediaSessionIDKey property is placed into each IOMedia instance
52 * created by the CD partition scheme. It identifies the session number
53 * the track was recorded on.
54 */
55
56#define kIOMediaSessionIDKey "Session ID"
57
58#ifdef KERNEL
59#ifdef __cplusplus
60
61/*
62 * Kernel
63 */
64
65#include <IOKit/storage/IOCDMedia.h>
66#include <IOKit/storage/IOPartitionScheme.h>
67
68/*
69 * Class
70 */
71
72class IOCDPartitionScheme : public IOPartitionScheme
73{
74 OSDeclareDefaultStructors(IOCDPartitionScheme);
75
76protected:
77
78 struct ExpansionData { /* */ };
79 ExpansionData * _expansionData;
80
81 OSSet * _partitions; /* (set of media objects representing partitions) */
82
83 /*
84 * Free all of this object's outstanding resources.
85 */
86
87 virtual void free(void);
88
89 /*
90 * Scan the provider media for CD partitions (in TOC). Returns the set
91 * of media objects representing each of the partitions (the retain for
92 * the set is passed to the caller), or null should no CD partitions be
93 * found. The default probe score can be adjusted up or down, based on
94 * the confidence of the scan.
95 */
96
97 virtual OSSet * scan(SInt32 * score);
98
99 /*
100 * Ask whether the given partition appears to be corrupt. A partition that
101 * is corrupt will cause the failure of the CD partition scheme altogether.
102 */
103
104 virtual bool isPartitionCorrupt( CDTOCDescriptor * partition,
105 UInt64 partitionSize,
106 UInt32 partitionBlockSize,
107 CDSectorType partitionBlockType,
108 CDTOC * toc );
109
110 /*
111 * Ask whether the given partition appears to be invalid. A partition that
112 * is invalid will cause it to be skipped in the scan, but will not cause a
113 * failure of the CD partition scheme.
114 */
115
116 virtual bool isPartitionInvalid( CDTOCDescriptor * partition,
117 UInt64 partitionSize,
118 UInt32 partitionBlockSize,
119 CDSectorType partitionBlockType,
120 CDTOC * toc );
121
122 /*
123 * Instantiate a new media object to represent the given partition.
124 */
125
126 virtual IOMedia * instantiateMediaObject(
127 CDTOCDescriptor * partition,
128 UInt64 partitionSize,
129 UInt32 partitionBlockSize,
130 CDSectorType partitionBlockType,
131 CDTOC * toc );
132
133 /*
134 * Allocate a new media object (called from instantiateMediaObject).
135 */
136
137 virtual IOMedia * instantiateDesiredMediaObject(
138 CDTOCDescriptor * partition,
139 UInt64 partitionSize,
140 UInt32 partitionBlockSize,
141 CDSectorType partitionBlockType,
142 CDTOC * toc );
143
144public:
145
146 /*
147 * Initialize this object's minimal state.
148 */
149
150 virtual bool init(OSDictionary * properties = 0);
151
152 /*
153 * Scan the provider media for CD partitions.
154 */
155
156 virtual IOService * probe(IOService * provider, SInt32 * score);
157
158 /*
159 * Determine whether the provider media contains CD partitions.
160 */
161
162 virtual bool start(IOService * provider);
163
164 /*
165 * Read data from the storage object at the specified byte offset into the
166 * specified buffer, asynchronously. When the read completes, the caller
167 * will be notified via the specified completion action.
168 *
169 * The buffer will be retained for the duration of the read.
170 *
171 * For the CD partition scheme, we convert the read from a partition
172 * object into the appropriate readCD command to our provider media.
173 */
174
175 virtual void read(IOService * client,
176 UInt64 byteStart,
177 IOMemoryDescriptor * buffer,
178 IOStorageAttributes * attributes,
179 IOStorageCompletion * completion);
180
181 /*
182 * Write data into the storage object at the specified byte offset from the
183 * specified buffer, asynchronously. When the write completes, the caller
184 * will be notified via the specified completion action.
185 *
186 * The buffer will be retained for the duration of the write.
187 *
188 * For the CD partition scheme, we convert the write from a partition
189 * object into the appropriate writeCD command to our provider media.
190 */
191
192 virtual void write(IOService * client,
193 UInt64 byteStart,
194 IOMemoryDescriptor * buffer,
195 IOStorageAttributes * attributes,
196 IOStorageCompletion * completion);
197
198 /*
199 * Obtain this object's provider. We override the superclass's method
200 * to return a more specific subclass of OSObject -- IOCDMedia. This
201 * method serves simply as a convenience to subclass developers.
202 */
203
204 virtual IOCDMedia * getProvider() const;
205
206 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 0);
207 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 1);
208 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 2);
209 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 3);
210 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 4);
211 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 5);
212 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 6);
213 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 7);
214 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 8);
215 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 9);
216 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 10);
217 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 11);
218 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 12);
219 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 13);
220 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 14);
221 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 15);
222};
223
224#endif /* __cplusplus */
225#endif /* KERNEL */
226#endif /* !_IOCDPARTITIONSCHEME_H */
227

Archive Download this file

Revision: 296