Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/storage/IOAppleLabelScheme.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 * This header contains the IOAppleLabelScheme class definition.
26 */
27
28#ifndef _IOAPPLELABELSCHEME_H
29#define _IOAPPLELABELSCHEME_H
30
31#include <IOKit/IOTypes.h>
32
33/*
34 * kIOAppleLabelSchemeClass is the name of the IOAppleLabelScheme class.
35 */
36
37#define kIOAppleLabelSchemeClass "IOAppleLabelScheme"
38
39/*
40 * Apple Label Scheme Definitions
41 */
42
43#pragma pack(push, 1) /* (enable 8-bit struct packing) */
44
45/* Label scheme. */
46
47struct applelabel
48{
49 uint8_t al_boot0[416]; /* (reserved for boot area) */
50 uint16_t al_magic; /* (the magic number) */
51 uint16_t al_type; /* (label type) */
52 uint32_t al_flags; /* (generic flags) */
53 uint64_t al_offset; /* (offset of property area, bytes) */
54 uint32_t al_size; /* (size of property area, bytes) */
55 uint32_t al_checksum; /* (checksum of property area) */
56 uint8_t al_boot1[72]; /* (reserved for boot area) */
57};
58
59/* Label scheme signature (al_magic). */
60
61#define AL_MAGIC 0x414C
62
63/* Label scheme version (al_type). */
64
65#define AL_TYPE_DEFAULT 0x0000
66
67/* Label scheme flags (al_flags). */
68
69#define AL_FLAG_DEFAULT 0x00000000
70
71#pragma pack(pop) /* (reset to default struct packing) */
72
73#ifdef KERNEL
74#ifdef __cplusplus
75
76/*
77 * Kernel
78 */
79
80#include <IOKit/storage/IOFilterScheme.h>
81
82/*
83 * Class
84 */
85
86class IOAppleLabelScheme : public IOFilterScheme
87{
88 OSDeclareDefaultStructors(IOAppleLabelScheme);
89
90protected:
91
92 struct ExpansionData { /* */ };
93 ExpansionData * _expansionData;
94
95 IOMedia * _content;
96
97 /*
98 * Free all of this object's outstanding resources.
99 */
100
101 virtual void free(void);
102
103 /*
104 * Scan the provider media for an Apple label scheme.
105 */
106
107 virtual IOMedia * scan(SInt32 * score);
108
109 /*
110 * Ask whether the given content appears to be corrupt.
111 */
112
113 virtual bool isContentCorrupt(OSDictionary * properties);
114
115 /*
116 * Ask whether the given content appears to be invalid.
117 */
118
119 virtual bool isContentInvalid(OSDictionary * properties);
120
121 /*
122 * Instantiate a new media object to represent the given content.
123 */
124
125 virtual IOMedia * instantiateMediaObject(OSDictionary * properties);
126
127 /*
128 * Allocate a new media object (called from instantiateMediaObject).
129 */
130
131 virtual IOMedia * instantiateDesiredMediaObject(OSDictionary * properties);
132
133 /*
134 * Attach the given media object to the device tree plane.
135 */
136
137 virtual bool attachMediaObjectToDeviceTree(IOMedia * media);
138
139 /*
140 * Detach the given media object from the device tree plane.
141 */
142
143 virtual void detachMediaObjectFromDeviceTree(IOMedia * media);
144
145public:
146
147 /*
148 * Initialize this object's minimal state.
149 */
150
151 virtual bool init(OSDictionary * properties = 0);
152
153 /*
154 * Determine whether the provider media contains an Apple label scheme.
155 */
156
157 virtual IOService * probe(IOService * provider, SInt32 * score);
158
159 /*
160 * Publish the new media object which represents our content.
161 */
162
163 virtual bool start(IOService * provider);
164
165 /*
166 * Clean up after the media object we published before terminating.
167 */
168
169 virtual void stop(IOService * provider);
170
171 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 0);
172 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 1);
173 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 2);
174 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 3);
175 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 4);
176 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 5);
177 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 6);
178 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 7);
179 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 8);
180 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 9);
181 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 10);
182 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 11);
183 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 12);
184 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 13);
185 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 14);
186 OSMetaClassDeclareReservedUnused(IOAppleLabelScheme, 15);
187};
188
189#endif /* __cplusplus */
190#endif /* KERNEL */
191#endif /* !_IOAPPLELABELSCHEME_H */
192

Archive Download this file

Revision: 1340