]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/storage/IOCDPartitionScheme.h
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / IOKit / storage / IOCDPartitionScheme.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 /*!
24 * @header IOCDPartitionScheme
25 * @abstract
26 * This header contains the IOCDPartitionScheme class definition.
27 */
28
29 #ifndef _IOCDPARTITIONSCHEME_H
30 #define _IOCDPARTITIONSCHEME_H
31
32 #include <IOKit/storage/IOCDTypes.h>
33
34 /*!
35 * @defined kIOMediaSessionIDKey
36 * @abstract
37 * kIOMediaSessionIDKey is property of IOMedia objects. It has an OSNumber
38 * value.
39 * @discussion
40 * The kIOMediaSessionIDKey property is placed into each IOMedia instance
41 * created by the CD partition scheme. It identifies the session number
42 * the track was recorded on.
43 */
44
45 #define kIOMediaSessionIDKey "Session ID"
46
47 /*
48 * Kernel
49 */
50
51 #if defined(KERNEL) && defined(__cplusplus)
52
53 #include <IOKit/storage/IOCDMedia.h>
54 #include <IOKit/storage/IOPartitionScheme.h>
55
56 /*
57 * Class
58 */
59
60 class IOCDPartitionScheme : public IOPartitionScheme
61 {
62 OSDeclareDefaultStructors(IOCDPartitionScheme);
63
64 protected:
65
66 struct ExpansionData { /* */ };
67 ExpansionData * _expansionData;
68
69 OSSet * _partitions; /* (set of media objects representing partitions) */
70
71 /*
72 * Free all of this object's outstanding resources.
73 */
74
75 virtual void free(void);
76
77 /*
78 * Scan the provider media for CD partitions (in TOC). Returns the set
79 * of media objects representing each of the partitions (the retain for
80 * the set is passed to the caller), or null should no CD partitions be
81 * found. The default probe score can be adjusted up or down, based on
82 * the confidence of the scan.
83 */
84
85 virtual OSSet * scan(SInt32 * score);
86
87 /*
88 * Ask whether the given partition appears to be corrupt. A partition that
89 * is corrupt will cause the failure of the CD partition scheme altogether.
90 */
91
92 virtual bool isPartitionCorrupt( CDTOCDescriptor * partition,
93 UInt64 partitionSize,
94 UInt32 partitionBlockSize,
95 CDSectorType partitionBlockType,
96 CDTOC * toc );
97
98 /*
99 * Ask whether the given partition appears to be invalid. A partition that
100 * is invalid will cause it to be skipped in the scan, but will not cause a
101 * failure of the CD partition scheme.
102 */
103
104 virtual bool isPartitionInvalid( CDTOCDescriptor * partition,
105 UInt64 partitionSize,
106 UInt32 partitionBlockSize,
107 CDSectorType partitionBlockType,
108 CDTOC * toc );
109
110 /*
111 * Instantiate a new media object to represent the given partition.
112 */
113
114 virtual IOMedia * instantiateMediaObject(
115 CDTOCDescriptor * partition,
116 UInt64 partitionSize,
117 UInt32 partitionBlockSize,
118 CDSectorType partitionBlockType,
119 CDTOC * toc );
120
121 /*
122 * Allocate a new media object (called from instantiateMediaObject).
123 */
124
125 virtual IOMedia * instantiateDesiredMediaObject(
126 CDTOCDescriptor * partition,
127 UInt64 partitionSize,
128 UInt32 partitionBlockSize,
129 CDSectorType partitionBlockType,
130 CDTOC * toc );
131
132 public:
133
134 /*
135 * Initialize this object's minimal state.
136 */
137
138 virtual bool init(OSDictionary * properties = 0);
139
140 /*
141 * Scan the provider media for CD partitions.
142 */
143
144 virtual IOService * probe(IOService * provider, SInt32 * score);
145
146 /*
147 * Determine whether the provider media contains CD partitions.
148 */
149
150 virtual bool start(IOService * provider);
151
152 /*
153 * Read data from the storage object at the specified byte offset into the
154 * specified buffer, asynchronously. When the read completes, the caller
155 * will be notified via the specified completion action.
156 *
157 * The buffer will be retained for the duration of the read.
158 *
159 * For the CD partition scheme, we convert the read from a partition
160 * object into the appropriate readCD command to our provider media.
161 */
162
163 virtual void read(IOService * client,
164 UInt64 byteStart,
165 IOMemoryDescriptor * buffer,
166 IOStorageCompletion completion);
167
168 /*
169 * Obtain this object's provider. We override the superclass's method
170 * to return a more specific subclass of OSObject -- IOCDMedia. This
171 * method serves simply as a convenience to subclass developers.
172 */
173
174 virtual IOCDMedia * getProvider() const;
175
176 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 0);
177 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 1);
178 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 2);
179 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 3);
180 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 4);
181 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 5);
182 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 6);
183 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 7);
184 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 8);
185 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 9);
186 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 10);
187 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 11);
188 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 12);
189 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 13);
190 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 14);
191 OSMetaClassDeclareReservedUnused(IOCDPartitionScheme, 15);
192 };
193
194 #endif /* defined(KERNEL) && defined(__cplusplus) */
195
196 #endif /* !_IOCDPARTITIONSCHEME_H */