symport/e32/include/partitions.h
changeset 1 0a7b44b10206
child 2 806186ab5e14
equal deleted inserted replaced
0:c55016431358 1:0a7b44b10206
       
     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"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\partitions.h
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21 */
       
    22 
       
    23 #ifndef __PARTITIONS_H__
       
    24 #define __PARTITIONS_H__
       
    25 #include <e32def.h>
       
    26 
       
    27 const TUint KPartitionTypeEmpty=0x00;
       
    28 const TUint KPartitionTypeFAT12=0x01;
       
    29 const TUint KPartitionTypeXENIXroot=0x02;
       
    30 const TUint KPartitionTypeXENIXusr=0x03;
       
    31 const TUint KPartitionTypeFAT16small=0x04;
       
    32 const TUint KPartitionTypeExtended=0x05;
       
    33 const TUint KPartitionTypeFAT16=0x06;
       
    34 const TUint KPartitionTypeNTFS=0x07;
       
    35 const TUint KPartitionTypeAIX=0x08;
       
    36 const TUint KPartitionTypeAIXboot=0x09;
       
    37 const TUint KPartitionTypeOS2BootManager=0x0a;
       
    38 const TUint KPartitionTypeWin95FAT32=0x0b;
       
    39 const TUint KPartitionTypeWin95FAT32LBA=0x0c;
       
    40 const TUint KPartitionTypeWin95FAT16LBA=0x0e;
       
    41 const TUint KPartitionTypeWin95ExtdLBA=0x0f;
       
    42 const TUint KPartitionTypeOPUS=0x10;
       
    43 const TUint KPartitionTypeHiddenFAT12=0x11;
       
    44 const TUint KPartitionTypeCompaqDiag=0x12;
       
    45 const TUint KPartitionTypeHiddenFAT16small=0x14;
       
    46 const TUint KPartitionTypeHiddenFAT16=0x16;
       
    47 const TUint KPartitionTypeHiddenNTFS=0x17;
       
    48 const TUint KPartitionTypeASTSmartSleep=0x18;
       
    49 const TUint KPartitionTypeHiddenWin95FAT32=0x1b;
       
    50 const TUint KPartitionTypeHiddenWin95FAT32LBA=0x1c;
       
    51 const TUint KPartitionTypeHiddenWin95FAT16LBA=0x1e;
       
    52 const TUint KPartitionTypeNECDOS=0x24;
       
    53 const TUint KPartitionTypePlan9=0x39;
       
    54 const TUint KPartitionTypePartitionMagic=0x3c;
       
    55 const TUint KPartitionTypeVenix80286=0x40;
       
    56 const TUint KPartitionTypePPCPRePBoot=0x41;
       
    57 const TUint KPartitionTypeSFS=0x42;
       
    58 const TUint KPartitionTypeQNX4x=0x4d;
       
    59 const TUint KPartitionTypeQNX4x_2=0x4e;
       
    60 const TUint KPartitionTypeQNX4x_3=0x4f;
       
    61 const TUint KPartitionTypeOnTrackDM=0x50;
       
    62 const TUint KPartitionTypeOnTrackDM6Aux=0x51;
       
    63 const TUint KPartitionTypeCPM=0x52;
       
    64 const TUint KPartitionTypeOnTrackDM6Aux_2=0x53;
       
    65 const TUint KPartitionTypeOnTrackDM6=0x54;
       
    66 const TUint KPartitionTypeEZDrive=0x55;
       
    67 const TUint KPartitionTypeGoldenBow=0x56;
       
    68 const TUint KPartitionTypePriamEdisk=0x5c;
       
    69 const TUint KPartitionTypeSpeedStor=0x61;
       
    70 const TUint KPartitionTypeGNU_HURD=0x63;
       
    71 const TUint KPartitionTypeNovellNetware=0x64;
       
    72 const TUint KPartitionTypeNovellNetware_2=0x65;
       
    73 const TUint KPartitionTypeDiskSecure=0x70;
       
    74 const TUint KPartitionTypePCIX=0x75;
       
    75 const TUint KPartitionTypeOldMinix=0x80;
       
    76 const TUint KPartitionTypeMinixOldLinux=0x81;
       
    77 const TUint KPartitionTypeLinuxSwap=0x82;
       
    78 const TUint KPartitionTypeLinux=0x83;
       
    79 const TUint KPartitionTypeOS2Hidden=0x84;
       
    80 const TUint KPartitionTypeLinuxExtended=0x85;
       
    81 const TUint KPartitionTypeNTFSvolset=0x86;
       
    82 const TUint KPartitionTypeNTFSvolset_2=0x87;
       
    83 const TUint KPartitionTypeLinuxLVM=0x8e;
       
    84 const TUint KPartitionTypeAmoeba=0x93;
       
    85 const TUint KPartitionTypeAmoebaBBT=0x94;
       
    86 const TUint KPartitionTypeBSD_OS=0x9f;
       
    87 const TUint KPartitionTypeIBMThinkpad=0xa0;
       
    88 const TUint KPartitionTypeFreeBSD=0xa5;
       
    89 const TUint KPartitionTypeOpenBSD=0xa6;
       
    90 const TUint KPartitionTypeNeXTSTEP=0xa7;
       
    91 const TUint KPartitionTypeNetBSD=0xa9;
       
    92 const TUint KPartitionTypeBSDIfs=0xb7;
       
    93 const TUint KPartitionTypeBSDIswap=0xb8;
       
    94 const TUint KPartitionTypeBootWizardHidden=0xbb;
       
    95 const TUint KPartitionTypeDRDOS=0xc1;
       
    96 const TUint KPartitionTypeDRDOS_2=0xc4;
       
    97 const TUint KPartitionTypeDRDOS_3=0xc6;
       
    98 const TUint KPartitionTypeSyrinx=0xc7;
       
    99 const TUint KPartitionTypeNonFSData=0xda;
       
   100 const TUint KPartitionTypeCPM_CTOS=0xdb;
       
   101 const TUint KPartitionTypeDellUtility=0xde;
       
   102 const TUint KPartitionTypeBootIt=0xdf;
       
   103 const TUint KPartitionTypeDOSaccess=0xe1;
       
   104 const TUint KPartitionTypeDOS_RO=0xe3;
       
   105 const TUint KPartitionTypeSymbianCrashLog=0xf0;
       
   106 const TUint KPartitionTypeSpeedStor_2=0xf1;
       
   107 const TUint KPartitionTypeDOSsecondary=0xf2;
       
   108 const TUint KPartitionTypeSpeedStor_3=0xf4;
       
   109 const TUint	KPartitionTypeRofs=0xfa;			// HACK
       
   110 const TUint KPartitionTypeIso9660=0xfb;			// hack
       
   111 const TUint KPartitionTypeEneaLFFS=0xfc;		// hack
       
   112 const TUint KPartitionTypeLinuxRaidAuto=0xfd;
       
   113 const TUint KPartitionTypeLANStep=0xfe;
       
   114 const TUint KPartitionTypeBBT=0xff;
       
   115 
       
   116 inline TBool PartitionIsFAT(TUint a)
       
   117 	{
       
   118 	return (
       
   119 		a==KPartitionTypeFAT12						||
       
   120 		a==KPartitionTypeFAT16small					||
       
   121 		a==KPartitionTypeFAT16						||
       
   122 		a==KPartitionTypeFAT16						||
       
   123 		a==KPartitionTypeWin95FAT16LBA				||
       
   124 		a==KPartitionTypeHiddenFAT12				||
       
   125 		a==KPartitionTypeHiddenFAT16small			||
       
   126 		a==KPartitionTypeHiddenFAT16				||
       
   127 		a==KPartitionTypeHiddenWin95FAT16LBA
       
   128 		);
       
   129 	}
       
   130 
       
   131 inline TBool PartitionIsFAT32(TUint a)
       
   132 	{
       
   133 	return (
       
   134 		a==KPartitionTypeWin95FAT32					||
       
   135 		a==KPartitionTypeWin95FAT32LBA				||
       
   136 		a==KPartitionTypeHiddenWin95FAT32			||
       
   137 		a==KPartitionTypeHiddenWin95FAT32LBA
       
   138 		);
       
   139 	}
       
   140 
       
   141 inline TBool PartitionIsNTFS(TUint a)
       
   142 	{
       
   143 	return (
       
   144 		a==KPartitionTypeNTFS						||
       
   145 		a==KPartitionTypeHiddenNTFS
       
   146 		);
       
   147 	}
       
   148 
       
   149 //
       
   150 // Entry in MBR partition table
       
   151 //
       
   152 const TUint KBootIndicatorBootable=0x80;
       
   153 
       
   154 class TMBRPartitionEntry
       
   155 	{
       
   156 public:
       
   157 	TBool IsValidPartition()
       
   158 		{ return (iNumSectors>0 && iPartitionType!=KPartitionTypeEmpty); }
       
   159 	TBool IsValidDosPartition()
       
   160 		{ return (iNumSectors>0 && PartitionIsFAT(iPartitionType)); }
       
   161 	TBool IsDefaultBootPartition()
       
   162 		{ return(iX86BootIndicator==KBootIndicatorBootable && (IsValidDosPartition() || IsValidFAT32Partition())); }
       
   163 	TBool IsValidFAT32Partition()
       
   164 		{ return (iNumSectors>0 && PartitionIsFAT32(iPartitionType)); }
       
   165 public:
       
   166 	TUint8 iX86BootIndicator;
       
   167 	TUint8 iStartHead;
       
   168 	TUint8 iStartSector;
       
   169 	TUint8 iStartCylinder;
       
   170 	TUint8 iPartitionType;
       
   171 	TUint8 iEndHead;
       
   172 	TUint8 iEndSector;
       
   173 	TUint8 iEndCylinder;
       
   174 	TUint32 iFirstSector;
       
   175 	TUint32 iNumSectors;
       
   176 	};
       
   177 
       
   178 //
       
   179 // Defines for Master boot record
       
   180 //
       
   181 const TUint KMBRFirstPartitionOffset=0x1BE;
       
   182 const TUint KMBRSignatureOffset=0x1FE;
       
   183 const TUint KMBRSignature=0xAA55;
       
   184 const TInt KMBRMaxPrimaryPartitions=4;
       
   185 
       
   186 class TMasterBootRecord
       
   187 	{
       
   188 public:
       
   189 	TUint8 iBootCode[KMBRFirstPartitionOffset];
       
   190 	TMBRPartitionEntry iPartitionEntry[KMBRMaxPrimaryPartitions];
       
   191 	TUint16 iSignature;
       
   192 	};
       
   193 
       
   194 
       
   195 
       
   196 #endif
       
   197