]>
git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/storage/IOFDiskPartitionScheme.h
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@
23 #ifndef _IOFDISKPARTITIONSCHEME_H
24 #define _IOFDISKPARTITIONSCHEME_H
26 #include <IOKit/IOTypes.h>
29 * FDisk Partition Map Definitions
32 #pragma pack(2) /* (enable 16-bit struct packing for fdisk_part, disk_blk0) */
34 /* Structure constants. */
36 #define DISK_BLK0SZ sizeof(struct disk_blk0) /* (size of partition map) */
37 #define DISK_BOOTSZ 446 /* (size of boot code in map) */
38 #define DISK_NPART 4 /* (number of entries in map) */
40 /* Partition map entry. */
44 UInt8 bootid
; /* (is active boot partition?) */
45 UInt8 beghead
; /* (beginning head) */
46 UInt8 begsect
; /* (beginning sector; beginning cylinder, high 2 bits) */
47 UInt8 begcyl
; /* (beginning cylinder, low 8 bits) */
48 UInt8 systid
; /* (type) */
49 UInt8 endhead
; /* (ending head) */
50 UInt8 endsect
; /* (ending sector; ending cylinder, high 2 bits) */
51 UInt8 endcyl
; /* (ending cylinder, low 8 bits) */
52 UInt32 relsect
; /* (block start) */
53 UInt32 numsect
; /* (block count) */
56 /* Partition map, as found in block zero of the disk (or extended partition). */
60 UInt8 bootcode
[DISK_BOOTSZ
]; /* (boot code) */
61 struct fdisk_part parts
[DISK_NPART
]; /* (partition entries) */
62 UInt16 signature
; /* (unique signature for map) */
65 /* Partition map signature (signature). */
67 #define DISK_SIGNATURE 0xAA55
69 /* Partition map entry types (systid). */
71 #define FDISK_PARTITION_TYPE_01 "DOS_FAT_12"
72 #define FDISK_PARTITION_TYPE_04 "DOS_FAT_16_S"
73 #define FDISK_PARTITION_TYPE_05 "DOS_Extended"
74 #define FDISK_PARTITION_TYPE_06 "DOS_FAT_16"
75 #define FDISK_PARTITION_TYPE_07 "Windows_NTFS"
76 #define FDISK_PARTITION_TYPE_0A "Boot_Manager"
77 #define FDISK_PARTITION_TYPE_0B "DOS_FAT_32"
78 #define FDISK_PARTITION_TYPE_0C "Windows_FAT_32"
79 #define FDISK_PARTITION_TYPE_0E "Windows_FAT_16"
80 #define FDISK_PARTITION_TYPE_0F "Windows_Extended"
81 #define FDISK_PARTITION_TYPE_11 "DOS_FAT_12_Hidden"
82 #define FDISK_PARTITION_TYPE_14 "DOS_FAT_16_S_Hidden"
83 #define FDISK_PARTITION_TYPE_16 "DOS_FAT_16_Hidden"
84 #define FDISK_PARTITION_TYPE_17 "Windows_NTFS_Hidden"
85 #define FDISK_PARTITION_TYPE_1B "DOS_FAT_32_Hidden"
86 #define FDISK_PARTITION_TYPE_1C "Windows_FAT_32_Hidden"
87 #define FDISK_PARTITION_TYPE_1E "Windows_FAT_16_Hidden"
88 #define FDISK_PARTITION_TYPE_63 "UNIX"
89 #define FDISK_PARTITION_TYPE_82 "Linux_Swap"
90 #define FDISK_PARTITION_TYPE_83 "Linux_Ext2FS"
91 #define FDISK_PARTITION_TYPE_84 "Hibernation"
92 #define FDISK_PARTITION_TYPE_85 "Linux_Extended"
93 #define FDISK_PARTITION_TYPE_86 "Windows_FAT_16_FT"
94 #define FDISK_PARTITION_TYPE_87 "Windows_NTFS_FT"
95 #define FDISK_PARTITION_TYPE_A5 "FreeBSD"
96 #define FDISK_PARTITION_TYPE_A6 "OpenBSD"
97 #define FDISK_PARTITION_TYPE_A7 "Apple_Rhapsody_UFS"
98 #define FDISK_PARTITION_TYPE_A8 "Apple_UFS"
99 #define FDISK_PARTITION_TYPE_A9 "NetBSD"
100 #define FDISK_PARTITION_TYPE_AB "Apple_Boot"
101 #define FDISK_PARTITION_TYPE_AF "Apple_HFS"
102 #define FDISK_PARTITION_TYPE_B7 "BSDI"
103 #define FDISK_PARTITION_TYPE_B8 "BSDI_Swap"
104 #define FDISK_PARTITION_TYPE_C6 "Windows_FAT_16_FT_Corrupt"
105 #define FDISK_PARTITION_TYPE_C7 "Windows_NTFS_FT_Corrupt"
106 #define FDISK_PARTITION_TYPE_EB "BeOS"
107 #define FDISK_PARTITION_TYPE_F2 "DOS_Secondary"
108 #define FDISK_PARTITION_TYPE_FD "Linux_RAID"
110 #pragma options align=reset /* (reset to default struct packing) */
116 #if defined(KERNEL) && defined(__cplusplus)
118 #include <IOKit/storage/IOPartitionScheme.h>
124 class IOFDiskPartitionScheme
: public IOPartitionScheme
126 OSDeclareDefaultStructors(IOFDiskPartitionScheme
);
130 struct ExpansionData
{ /* */ };
131 ExpansionData
* _expansionData
;
133 OSSet
* _partitions
; /* (set of media objects representing partitions) */
136 * Free all of this object's outstanding resources.
139 virtual void free(void);
142 * Scan the provider media for an FDisk partition map. Returns the set
143 * of media objects representing each of the partitions (the retain for
144 * the set is passed to the caller), or null should no partition map be
145 * found. The default probe score can be adjusted up or down, based on
146 * the confidence of the scan.
149 virtual OSSet
* scan(SInt32
* score
);
152 * Ask whether the given partition is extended.
155 virtual bool isPartitionExtended(fdisk_part
* partition
);
158 * Ask whether the given partition is used.
161 virtual bool isPartitionUsed(fdisk_part
* partition
);
164 * Ask whether the given partition appears to be corrupt. A partition that
165 * is corrupt will cause the failure of the FDisk partition map recognition
169 virtual bool isPartitionCorrupt( fdisk_part
* partition
,
174 * Ask whether the given partition appears to be invalid. A partition that
175 * is invalid will cause it to be skipped in the scan, but will not cause a
176 * failure of the FDisk partition map recognition.
179 virtual bool isPartitionInvalid( fdisk_part
* partition
,
184 * Instantiate a new media object to represent the given partition.
187 virtual IOMedia
* instantiateMediaObject( fdisk_part
* partition
,
192 * Allocate a new media object (called from instantiateMediaObject).
195 virtual IOMedia
* instantiateDesiredMediaObject( fdisk_part
* partition
,
202 * Initialize this object's minimal state.
205 virtual bool init(OSDictionary
* properties
= 0);
208 * Determine whether the provider media contains an FDisk partition map.
211 virtual IOService
* probe(IOService
* provider
, SInt32
* score
);
214 * Publish the new media objects which represent our partitions.
217 virtual bool start(IOService
* provider
);
219 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 0);
220 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 1);
221 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 2);
222 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 3);
223 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 4);
224 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 5);
225 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 6);
226 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 7);
227 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 8);
228 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 9);
229 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 10);
230 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 11);
231 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 12);
232 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 13);
233 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 14);
234 OSMetaClassDeclareReservedUnused(IOFDiskPartitionScheme
, 15);
237 #endif /* defined(KERNEL) && defined(__cplusplus) */
239 #endif /* !_IOFDISKPARTITIONSCHEME_H */