2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
24 * @header IOCDPartitionScheme
26 * This header contains the IOCDPartitionScheme class definition.
29 #ifndef _IOCDPARTITIONSCHEME_H
30 #define _IOCDPARTITIONSCHEME_H
32 #include <IOKit/storage/IOCDTypes.h>
35 * @defined kIOMediaSessionIDKey
37 * kIOMediaSessionIDKey is property of IOMedia objects. It has an OSNumber
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.
45 #define kIOMediaSessionIDKey "Session ID"
51 #if defined(KERNEL) && defined(__cplusplus)
53 #include <IOKit/storage/IOCDMedia.h>
54 #include <IOKit/storage/IOPartitionScheme.h>
60 class IOCDPartitionScheme
: public IOPartitionScheme
62 OSDeclareDefaultStructors(IOCDPartitionScheme
);
66 struct ExpansionData
{ /* */ };
67 ExpansionData
* _expansionData
;
69 OSSet
* _partitions
; /* (set of media objects representing partitions) */
72 * Free all of this object's outstanding resources.
75 virtual void free(void);
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.
85 virtual OSSet
* scan(SInt32
* score
);
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.
92 virtual bool isPartitionCorrupt( CDTOCDescriptor
* partition
,
94 UInt32 partitionBlockSize
,
95 CDSectorType partitionBlockType
,
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.
104 virtual bool isPartitionInvalid( CDTOCDescriptor
* partition
,
105 UInt64 partitionSize
,
106 UInt32 partitionBlockSize
,
107 CDSectorType partitionBlockType
,
111 * Instantiate a new media object to represent the given partition.
114 virtual IOMedia
* instantiateMediaObject(
115 CDTOCDescriptor
* partition
,
116 UInt64 partitionSize
,
117 UInt32 partitionBlockSize
,
118 CDSectorType partitionBlockType
,
122 * Allocate a new media object (called from instantiateMediaObject).
125 virtual IOMedia
* instantiateDesiredMediaObject(
126 CDTOCDescriptor
* partition
,
127 UInt64 partitionSize
,
128 UInt32 partitionBlockSize
,
129 CDSectorType partitionBlockType
,
135 * Initialize this object's minimal state.
138 virtual bool init(OSDictionary
* properties
= 0);
141 * Scan the provider media for CD partitions.
144 virtual IOService
* probe(IOService
* provider
, SInt32
* score
);
147 * Determine whether the provider media contains CD partitions.
150 virtual bool start(IOService
* provider
);
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.
157 * The buffer will be retained for the duration of the read.
159 * For the CD partition scheme, we convert the read from a partition
160 * object into the appropriate readCD command to our provider media.
163 virtual void read(IOService
* client
,
165 IOMemoryDescriptor
* buffer
,
166 IOStorageCompletion completion
);
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.
174 virtual IOCDMedia
* getProvider() const;
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);
194 #endif /* defined(KERNEL) && defined(__cplusplus) */
196 #endif /* !_IOCDPARTITIONSCHEME_H */