sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\partitions.h sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __PARTITIONS_H__ sl@0: #define __PARTITIONS_H__ sl@0: #include sl@0: sl@0: const TUint KPartitionTypeEmpty=0x00; sl@0: const TUint KPartitionTypeFAT12=0x01; sl@0: const TUint KPartitionTypeXENIXroot=0x02; sl@0: const TUint KPartitionTypeXENIXusr=0x03; sl@0: const TUint KPartitionTypeFAT16small=0x04; sl@0: const TUint KPartitionTypeExtended=0x05; sl@0: const TUint KPartitionTypeFAT16=0x06; sl@0: const TUint KPartitionTypeNTFS=0x07; sl@0: const TUint KPartitionTypeAIX=0x08; sl@0: const TUint KPartitionTypeAIXboot=0x09; sl@0: const TUint KPartitionTypeOS2BootManager=0x0a; sl@0: const TUint KPartitionTypeWin95FAT32=0x0b; sl@0: const TUint KPartitionTypeWin95FAT32LBA=0x0c; sl@0: const TUint KPartitionTypeWin95FAT16LBA=0x0e; sl@0: const TUint KPartitionTypeWin95ExtdLBA=0x0f; sl@0: const TUint KPartitionTypeOPUS=0x10; sl@0: const TUint KPartitionTypeHiddenFAT12=0x11; sl@0: const TUint KPartitionTypeCompaqDiag=0x12; sl@0: const TUint KPartitionTypeHiddenFAT16small=0x14; sl@0: const TUint KPartitionTypeHiddenFAT16=0x16; sl@0: const TUint KPartitionTypeHiddenNTFS=0x17; sl@0: const TUint KPartitionTypeASTSmartSleep=0x18; sl@0: const TUint KPartitionTypeHiddenWin95FAT32=0x1b; sl@0: const TUint KPartitionTypeHiddenWin95FAT32LBA=0x1c; sl@0: const TUint KPartitionTypeHiddenWin95FAT16LBA=0x1e; sl@0: const TUint KPartitionTypeNECDOS=0x24; sl@0: const TUint KPartitionTypePlan9=0x39; sl@0: const TUint KPartitionTypePartitionMagic=0x3c; sl@0: const TUint KPartitionTypeVenix80286=0x40; sl@0: const TUint KPartitionTypePPCPRePBoot=0x41; sl@0: const TUint KPartitionTypeSFS=0x42; sl@0: const TUint KPartitionTypeQNX4x=0x4d; sl@0: const TUint KPartitionTypeQNX4x_2=0x4e; sl@0: const TUint KPartitionTypeQNX4x_3=0x4f; sl@0: const TUint KPartitionTypeOnTrackDM=0x50; sl@0: const TUint KPartitionTypeOnTrackDM6Aux=0x51; sl@0: const TUint KPartitionTypeCPM=0x52; sl@0: const TUint KPartitionTypeOnTrackDM6Aux_2=0x53; sl@0: const TUint KPartitionTypeOnTrackDM6=0x54; sl@0: const TUint KPartitionTypeEZDrive=0x55; sl@0: const TUint KPartitionTypeGoldenBow=0x56; sl@0: const TUint KPartitionTypePriamEdisk=0x5c; sl@0: const TUint KPartitionTypeSpeedStor=0x61; sl@0: const TUint KPartitionTypeGNU_HURD=0x63; sl@0: const TUint KPartitionTypeNovellNetware=0x64; sl@0: const TUint KPartitionTypeNovellNetware_2=0x65; sl@0: const TUint KPartitionTypeDiskSecure=0x70; sl@0: const TUint KPartitionTypePCIX=0x75; sl@0: const TUint KPartitionTypeOldMinix=0x80; sl@0: const TUint KPartitionTypeMinixOldLinux=0x81; sl@0: const TUint KPartitionTypeLinuxSwap=0x82; sl@0: const TUint KPartitionTypeLinux=0x83; sl@0: const TUint KPartitionTypeOS2Hidden=0x84; sl@0: const TUint KPartitionTypeLinuxExtended=0x85; sl@0: const TUint KPartitionTypeNTFSvolset=0x86; sl@0: const TUint KPartitionTypeNTFSvolset_2=0x87; sl@0: const TUint KPartitionTypeLinuxLVM=0x8e; sl@0: const TUint KPartitionTypeAmoeba=0x93; sl@0: const TUint KPartitionTypeAmoebaBBT=0x94; sl@0: const TUint KPartitionTypeBSD_OS=0x9f; sl@0: const TUint KPartitionTypeIBMThinkpad=0xa0; sl@0: const TUint KPartitionTypeFreeBSD=0xa5; sl@0: const TUint KPartitionTypeOpenBSD=0xa6; sl@0: const TUint KPartitionTypeNeXTSTEP=0xa7; sl@0: const TUint KPartitionTypeNetBSD=0xa9; sl@0: const TUint KPartitionTypeBSDIfs=0xb7; sl@0: const TUint KPartitionTypeBSDIswap=0xb8; sl@0: const TUint KPartitionTypeBootWizardHidden=0xbb; sl@0: const TUint KPartitionTypeDRDOS=0xc1; sl@0: const TUint KPartitionTypeDRDOS_2=0xc4; sl@0: const TUint KPartitionTypeDRDOS_3=0xc6; sl@0: const TUint KPartitionTypeSyrinx=0xc7; sl@0: const TUint KPartitionTypeNonFSData=0xda; sl@0: const TUint KPartitionTypeCPM_CTOS=0xdb; sl@0: const TUint KPartitionTypeDellUtility=0xde; sl@0: const TUint KPartitionTypeBootIt=0xdf; sl@0: const TUint KPartitionTypeDOSaccess=0xe1; sl@0: const TUint KPartitionTypeDOS_RO=0xe3; sl@0: const TUint KPartitionTypeSymbianCrashLog=0xf0; sl@0: const TUint KPartitionTypeSpeedStor_2=0xf1; sl@0: const TUint KPartitionTypeDOSsecondary=0xf2; sl@0: const TUint KPartitionTypeSpeedStor_3=0xf4; sl@0: const TUint KPartitionTypePagedData=0xf8; // Symbian defined sl@0: const TUint KPartitionTypeROM=0xf9; // Symbian defined sl@0: const TUint KPartitionTypeRofs=0xfa; // Symbian defined sl@0: const TUint KPartitionTypeIso9660=0xfb; // Symbian defined sl@0: const TUint KPartitionTypeEneaLFFS=0xfc; // Symbian defined sl@0: const TUint KPartitionTypeLinuxRaidAuto=0xfd; sl@0: const TUint KPartitionTypeLANStep=0xfe; sl@0: const TUint KPartitionTypeBBT=0xff; sl@0: sl@0: inline TBool PartitionIsFAT(TUint a) sl@0: { sl@0: return ( sl@0: a==KPartitionTypeFAT12 || sl@0: a==KPartitionTypeFAT16small || sl@0: a==KPartitionTypeFAT16 || sl@0: a==KPartitionTypeFAT16 || sl@0: a==KPartitionTypeWin95FAT16LBA || sl@0: a==KPartitionTypeHiddenFAT12 || sl@0: a==KPartitionTypeHiddenFAT16small || sl@0: a==KPartitionTypeHiddenFAT16 || sl@0: a==KPartitionTypeHiddenWin95FAT16LBA sl@0: ); sl@0: } sl@0: sl@0: inline TBool PartitionIsFAT32(TUint a) sl@0: { sl@0: return ( sl@0: a==KPartitionTypeWin95FAT32 || sl@0: a==KPartitionTypeWin95FAT32LBA || sl@0: a==KPartitionTypeHiddenWin95FAT32 || sl@0: a==KPartitionTypeHiddenWin95FAT32LBA sl@0: ); sl@0: } sl@0: sl@0: inline TBool PartitionIsNTFS(TUint a) sl@0: { sl@0: return ( sl@0: a==KPartitionTypeNTFS || sl@0: a==KPartitionTypeHiddenNTFS sl@0: ); sl@0: } sl@0: sl@0: // sl@0: // Entry in MBR partition table sl@0: // sl@0: const TUint KBootIndicatorBootable=0x80; sl@0: sl@0: class TMBRPartitionEntry sl@0: { sl@0: public: sl@0: TBool IsValidPartition() sl@0: { return (iNumSectors>0 && iPartitionType!=KPartitionTypeEmpty); } sl@0: TBool IsValidDosPartition() sl@0: { return (iNumSectors>0 && PartitionIsFAT(iPartitionType)); } sl@0: TBool IsDefaultBootPartition() sl@0: { return(iX86BootIndicator==KBootIndicatorBootable && (IsValidDosPartition() || IsValidFAT32Partition())); } sl@0: TBool IsValidFAT32Partition() sl@0: { return (iNumSectors>0 && PartitionIsFAT32(iPartitionType)); } sl@0: TBool IsValidExFATPartition() sl@0: { return (iNumSectors>0 && PartitionIsNTFS(iPartitionType)); } sl@0: public: sl@0: TUint8 iX86BootIndicator; sl@0: TUint8 iStartHead; sl@0: TUint8 iStartSector; sl@0: TUint8 iStartCylinder; sl@0: TUint8 iPartitionType; sl@0: TUint8 iEndHead; sl@0: TUint8 iEndSector; sl@0: TUint8 iEndCylinder; sl@0: TUint32 iFirstSector; sl@0: TUint32 iNumSectors; sl@0: }; sl@0: sl@0: // sl@0: // Defines for Master boot record sl@0: // sl@0: const TUint KMBRFirstPartitionOffset=0x1BE; sl@0: const TUint KMBRSignatureOffset=0x1FE; sl@0: const TUint KMBRSignature=0xAA55; sl@0: const TInt KMBRMaxPrimaryPartitions=4; sl@0: sl@0: class TMasterBootRecord sl@0: { sl@0: public: sl@0: TUint8 iBootCode[KMBRFirstPartitionOffset]; sl@0: TMBRPartitionEntry iPartitionEntry[KMBRMaxPrimaryPartitions]; sl@0: TUint16 iSignature; sl@0: }; sl@0: sl@0: sl@0: sl@0: #endif sl@0: