1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\partitions.h
25 #ifndef __PARTITIONS_H__
26 #define __PARTITIONS_H__
29 const TUint KPartitionTypeEmpty=0x00;
30 const TUint KPartitionTypeFAT12=0x01;
31 const TUint KPartitionTypeXENIXroot=0x02;
32 const TUint KPartitionTypeXENIXusr=0x03;
33 const TUint KPartitionTypeFAT16small=0x04;
34 const TUint KPartitionTypeExtended=0x05;
35 const TUint KPartitionTypeFAT16=0x06;
36 const TUint KPartitionTypeNTFS=0x07;
37 const TUint KPartitionTypeAIX=0x08;
38 const TUint KPartitionTypeAIXboot=0x09;
39 const TUint KPartitionTypeOS2BootManager=0x0a;
40 const TUint KPartitionTypeWin95FAT32=0x0b;
41 const TUint KPartitionTypeWin95FAT32LBA=0x0c;
42 const TUint KPartitionTypeWin95FAT16LBA=0x0e;
43 const TUint KPartitionTypeWin95ExtdLBA=0x0f;
44 const TUint KPartitionTypeOPUS=0x10;
45 const TUint KPartitionTypeHiddenFAT12=0x11;
46 const TUint KPartitionTypeCompaqDiag=0x12;
47 const TUint KPartitionTypeHiddenFAT16small=0x14;
48 const TUint KPartitionTypeHiddenFAT16=0x16;
49 const TUint KPartitionTypeHiddenNTFS=0x17;
50 const TUint KPartitionTypeASTSmartSleep=0x18;
51 const TUint KPartitionTypeHiddenWin95FAT32=0x1b;
52 const TUint KPartitionTypeHiddenWin95FAT32LBA=0x1c;
53 const TUint KPartitionTypeHiddenWin95FAT16LBA=0x1e;
54 const TUint KPartitionTypeNECDOS=0x24;
55 const TUint KPartitionTypePlan9=0x39;
56 const TUint KPartitionTypePartitionMagic=0x3c;
57 const TUint KPartitionTypeVenix80286=0x40;
58 const TUint KPartitionTypePPCPRePBoot=0x41;
59 const TUint KPartitionTypeSFS=0x42;
60 const TUint KPartitionTypeQNX4x=0x4d;
61 const TUint KPartitionTypeQNX4x_2=0x4e;
62 const TUint KPartitionTypeQNX4x_3=0x4f;
63 const TUint KPartitionTypeOnTrackDM=0x50;
64 const TUint KPartitionTypeOnTrackDM6Aux=0x51;
65 const TUint KPartitionTypeCPM=0x52;
66 const TUint KPartitionTypeOnTrackDM6Aux_2=0x53;
67 const TUint KPartitionTypeOnTrackDM6=0x54;
68 const TUint KPartitionTypeEZDrive=0x55;
69 const TUint KPartitionTypeGoldenBow=0x56;
70 const TUint KPartitionTypePriamEdisk=0x5c;
71 const TUint KPartitionTypeSpeedStor=0x61;
72 const TUint KPartitionTypeGNU_HURD=0x63;
73 const TUint KPartitionTypeNovellNetware=0x64;
74 const TUint KPartitionTypeNovellNetware_2=0x65;
75 const TUint KPartitionTypeDiskSecure=0x70;
76 const TUint KPartitionTypePCIX=0x75;
77 const TUint KPartitionTypeOldMinix=0x80;
78 const TUint KPartitionTypeMinixOldLinux=0x81;
79 const TUint KPartitionTypeLinuxSwap=0x82;
80 const TUint KPartitionTypeLinux=0x83;
81 const TUint KPartitionTypeOS2Hidden=0x84;
82 const TUint KPartitionTypeLinuxExtended=0x85;
83 const TUint KPartitionTypeNTFSvolset=0x86;
84 const TUint KPartitionTypeNTFSvolset_2=0x87;
85 const TUint KPartitionTypeLinuxLVM=0x8e;
86 const TUint KPartitionTypeAmoeba=0x93;
87 const TUint KPartitionTypeAmoebaBBT=0x94;
88 const TUint KPartitionTypeBSD_OS=0x9f;
89 const TUint KPartitionTypeIBMThinkpad=0xa0;
90 const TUint KPartitionTypeFreeBSD=0xa5;
91 const TUint KPartitionTypeOpenBSD=0xa6;
92 const TUint KPartitionTypeNeXTSTEP=0xa7;
93 const TUint KPartitionTypeNetBSD=0xa9;
94 const TUint KPartitionTypeBSDIfs=0xb7;
95 const TUint KPartitionTypeBSDIswap=0xb8;
96 const TUint KPartitionTypeBootWizardHidden=0xbb;
97 const TUint KPartitionTypeDRDOS=0xc1;
98 const TUint KPartitionTypeDRDOS_2=0xc4;
99 const TUint KPartitionTypeDRDOS_3=0xc6;
100 const TUint KPartitionTypeSyrinx=0xc7;
101 const TUint KPartitionTypeNonFSData=0xda;
102 const TUint KPartitionTypeCPM_CTOS=0xdb;
103 const TUint KPartitionTypeDellUtility=0xde;
104 const TUint KPartitionTypeBootIt=0xdf;
105 const TUint KPartitionTypeDOSaccess=0xe1;
106 const TUint KPartitionTypeDOS_RO=0xe3;
107 const TUint KPartitionTypeSymbianCrashLog=0xf0;
108 const TUint KPartitionTypeSpeedStor_2=0xf1;
109 const TUint KPartitionTypeDOSsecondary=0xf2;
110 const TUint KPartitionTypeSpeedStor_3=0xf4;
111 const TUint KPartitionTypeRofs=0xfa; // HACK
112 const TUint KPartitionTypeIso9660=0xfb; // hack
113 const TUint KPartitionTypeEneaLFFS=0xfc; // hack
114 const TUint KPartitionTypeLinuxRaidAuto=0xfd;
115 const TUint KPartitionTypeLANStep=0xfe;
116 const TUint KPartitionTypeBBT=0xff;
118 inline TBool PartitionIsFAT(TUint a)
121 a==KPartitionTypeFAT12 ||
122 a==KPartitionTypeFAT16small ||
123 a==KPartitionTypeFAT16 ||
124 a==KPartitionTypeFAT16 ||
125 a==KPartitionTypeWin95FAT16LBA ||
126 a==KPartitionTypeHiddenFAT12 ||
127 a==KPartitionTypeHiddenFAT16small ||
128 a==KPartitionTypeHiddenFAT16 ||
129 a==KPartitionTypeHiddenWin95FAT16LBA
133 inline TBool PartitionIsFAT32(TUint a)
136 a==KPartitionTypeWin95FAT32 ||
137 a==KPartitionTypeWin95FAT32LBA ||
138 a==KPartitionTypeHiddenWin95FAT32 ||
139 a==KPartitionTypeHiddenWin95FAT32LBA
143 inline TBool PartitionIsNTFS(TUint a)
146 a==KPartitionTypeNTFS ||
147 a==KPartitionTypeHiddenNTFS
152 // Entry in MBR partition table
154 const TUint KBootIndicatorBootable=0x80;
156 class TMBRPartitionEntry
159 TBool IsValidPartition()
160 { return (iNumSectors>0 && iPartitionType!=KPartitionTypeEmpty); }
161 TBool IsValidDosPartition()
162 { return (iNumSectors>0 && PartitionIsFAT(iPartitionType)); }
163 TBool IsDefaultBootPartition()
164 { return(iX86BootIndicator==KBootIndicatorBootable && (IsValidDosPartition() || IsValidFAT32Partition())); }
165 TBool IsValidFAT32Partition()
166 { return (iNumSectors>0 && PartitionIsFAT32(iPartitionType)); }
168 TUint8 iX86BootIndicator;
171 TUint8 iStartCylinder;
172 TUint8 iPartitionType;
176 TUint32 iFirstSector;
181 // Defines for Master boot record
183 const TUint KMBRFirstPartitionOffset=0x1BE;
184 const TUint KMBRSignatureOffset=0x1FE;
185 const TUint KMBRSignature=0xAA55;
186 const TInt KMBRMaxPrimaryPartitions=4;
188 class TMasterBootRecord
191 TUint8 iBootCode[KMBRFirstPartitionOffset];
192 TMBRPartitionEntry iPartitionEntry[KMBRMaxPrimaryPartitions];