os/kernelhwsrv/kernel/eka/include/partitions.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/partitions.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,201 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\include\partitions.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalTechnology
    1.24 +*/
    1.25 +
    1.26 +#ifndef __PARTITIONS_H__
    1.27 +#define __PARTITIONS_H__
    1.28 +#include <e32def.h>
    1.29 +
    1.30 +const TUint KPartitionTypeEmpty=0x00;
    1.31 +const TUint KPartitionTypeFAT12=0x01;
    1.32 +const TUint KPartitionTypeXENIXroot=0x02;
    1.33 +const TUint KPartitionTypeXENIXusr=0x03;
    1.34 +const TUint KPartitionTypeFAT16small=0x04;
    1.35 +const TUint KPartitionTypeExtended=0x05;
    1.36 +const TUint KPartitionTypeFAT16=0x06;
    1.37 +const TUint KPartitionTypeNTFS=0x07;
    1.38 +const TUint KPartitionTypeAIX=0x08;
    1.39 +const TUint KPartitionTypeAIXboot=0x09;
    1.40 +const TUint KPartitionTypeOS2BootManager=0x0a;
    1.41 +const TUint KPartitionTypeWin95FAT32=0x0b;
    1.42 +const TUint KPartitionTypeWin95FAT32LBA=0x0c;
    1.43 +const TUint KPartitionTypeWin95FAT16LBA=0x0e;
    1.44 +const TUint KPartitionTypeWin95ExtdLBA=0x0f;
    1.45 +const TUint KPartitionTypeOPUS=0x10;
    1.46 +const TUint KPartitionTypeHiddenFAT12=0x11;
    1.47 +const TUint KPartitionTypeCompaqDiag=0x12;
    1.48 +const TUint KPartitionTypeHiddenFAT16small=0x14;
    1.49 +const TUint KPartitionTypeHiddenFAT16=0x16;
    1.50 +const TUint KPartitionTypeHiddenNTFS=0x17;
    1.51 +const TUint KPartitionTypeASTSmartSleep=0x18;
    1.52 +const TUint KPartitionTypeHiddenWin95FAT32=0x1b;
    1.53 +const TUint KPartitionTypeHiddenWin95FAT32LBA=0x1c;
    1.54 +const TUint KPartitionTypeHiddenWin95FAT16LBA=0x1e;
    1.55 +const TUint KPartitionTypeNECDOS=0x24;
    1.56 +const TUint KPartitionTypePlan9=0x39;
    1.57 +const TUint KPartitionTypePartitionMagic=0x3c;
    1.58 +const TUint KPartitionTypeVenix80286=0x40;
    1.59 +const TUint KPartitionTypePPCPRePBoot=0x41;
    1.60 +const TUint KPartitionTypeSFS=0x42;
    1.61 +const TUint KPartitionTypeQNX4x=0x4d;
    1.62 +const TUint KPartitionTypeQNX4x_2=0x4e;
    1.63 +const TUint KPartitionTypeQNX4x_3=0x4f;
    1.64 +const TUint KPartitionTypeOnTrackDM=0x50;
    1.65 +const TUint KPartitionTypeOnTrackDM6Aux=0x51;
    1.66 +const TUint KPartitionTypeCPM=0x52;
    1.67 +const TUint KPartitionTypeOnTrackDM6Aux_2=0x53;
    1.68 +const TUint KPartitionTypeOnTrackDM6=0x54;
    1.69 +const TUint KPartitionTypeEZDrive=0x55;
    1.70 +const TUint KPartitionTypeGoldenBow=0x56;
    1.71 +const TUint KPartitionTypePriamEdisk=0x5c;
    1.72 +const TUint KPartitionTypeSpeedStor=0x61;
    1.73 +const TUint KPartitionTypeGNU_HURD=0x63;
    1.74 +const TUint KPartitionTypeNovellNetware=0x64;
    1.75 +const TUint KPartitionTypeNovellNetware_2=0x65;
    1.76 +const TUint KPartitionTypeDiskSecure=0x70;
    1.77 +const TUint KPartitionTypePCIX=0x75;
    1.78 +const TUint KPartitionTypeOldMinix=0x80;
    1.79 +const TUint KPartitionTypeMinixOldLinux=0x81;
    1.80 +const TUint KPartitionTypeLinuxSwap=0x82;
    1.81 +const TUint KPartitionTypeLinux=0x83;
    1.82 +const TUint KPartitionTypeOS2Hidden=0x84;
    1.83 +const TUint KPartitionTypeLinuxExtended=0x85;
    1.84 +const TUint KPartitionTypeNTFSvolset=0x86;
    1.85 +const TUint KPartitionTypeNTFSvolset_2=0x87;
    1.86 +const TUint KPartitionTypeLinuxLVM=0x8e;
    1.87 +const TUint KPartitionTypeAmoeba=0x93;
    1.88 +const TUint KPartitionTypeAmoebaBBT=0x94;
    1.89 +const TUint KPartitionTypeBSD_OS=0x9f;
    1.90 +const TUint KPartitionTypeIBMThinkpad=0xa0;
    1.91 +const TUint KPartitionTypeFreeBSD=0xa5;
    1.92 +const TUint KPartitionTypeOpenBSD=0xa6;
    1.93 +const TUint KPartitionTypeNeXTSTEP=0xa7;
    1.94 +const TUint KPartitionTypeNetBSD=0xa9;
    1.95 +const TUint KPartitionTypeBSDIfs=0xb7;
    1.96 +const TUint KPartitionTypeBSDIswap=0xb8;
    1.97 +const TUint KPartitionTypeBootWizardHidden=0xbb;
    1.98 +const TUint KPartitionTypeDRDOS=0xc1;
    1.99 +const TUint KPartitionTypeDRDOS_2=0xc4;
   1.100 +const TUint KPartitionTypeDRDOS_3=0xc6;
   1.101 +const TUint KPartitionTypeSyrinx=0xc7;
   1.102 +const TUint KPartitionTypeNonFSData=0xda;
   1.103 +const TUint KPartitionTypeCPM_CTOS=0xdb;
   1.104 +const TUint KPartitionTypeDellUtility=0xde;
   1.105 +const TUint KPartitionTypeBootIt=0xdf;
   1.106 +const TUint KPartitionTypeDOSaccess=0xe1;
   1.107 +const TUint KPartitionTypeDOS_RO=0xe3;
   1.108 +const TUint KPartitionTypeSymbianCrashLog=0xf0;
   1.109 +const TUint KPartitionTypeSpeedStor_2=0xf1;
   1.110 +const TUint KPartitionTypeDOSsecondary=0xf2;
   1.111 +const TUint KPartitionTypeSpeedStor_3=0xf4;
   1.112 +const TUint	KPartitionTypePagedData=0xf8;		// Symbian defined 
   1.113 +const TUint	KPartitionTypeROM=0xf9;				// Symbian defined 
   1.114 +const TUint	KPartitionTypeRofs=0xfa;			// Symbian defined 
   1.115 +const TUint KPartitionTypeIso9660=0xfb;			// Symbian defined 
   1.116 +const TUint KPartitionTypeEneaLFFS=0xfc;		// Symbian defined 
   1.117 +const TUint KPartitionTypeLinuxRaidAuto=0xfd;
   1.118 +const TUint KPartitionTypeLANStep=0xfe;
   1.119 +const TUint KPartitionTypeBBT=0xff;
   1.120 +
   1.121 +inline TBool PartitionIsFAT(TUint a)
   1.122 +	{
   1.123 +	return (
   1.124 +		a==KPartitionTypeFAT12						||
   1.125 +		a==KPartitionTypeFAT16small					||
   1.126 +		a==KPartitionTypeFAT16						||
   1.127 +		a==KPartitionTypeFAT16						||
   1.128 +		a==KPartitionTypeWin95FAT16LBA				||
   1.129 +		a==KPartitionTypeHiddenFAT12				||
   1.130 +		a==KPartitionTypeHiddenFAT16small			||
   1.131 +		a==KPartitionTypeHiddenFAT16				||
   1.132 +		a==KPartitionTypeHiddenWin95FAT16LBA
   1.133 +		);
   1.134 +	}
   1.135 +
   1.136 +inline TBool PartitionIsFAT32(TUint a)
   1.137 +	{
   1.138 +	return (
   1.139 +		a==KPartitionTypeWin95FAT32					||
   1.140 +		a==KPartitionTypeWin95FAT32LBA				||
   1.141 +		a==KPartitionTypeHiddenWin95FAT32			||
   1.142 +		a==KPartitionTypeHiddenWin95FAT32LBA
   1.143 +		);
   1.144 +	}
   1.145 +
   1.146 +inline TBool PartitionIsNTFS(TUint a)
   1.147 +	{
   1.148 +	return (
   1.149 +		a==KPartitionTypeNTFS						||
   1.150 +		a==KPartitionTypeHiddenNTFS
   1.151 +		);
   1.152 +	}
   1.153 +
   1.154 +//
   1.155 +// Entry in MBR partition table
   1.156 +//
   1.157 +const TUint KBootIndicatorBootable=0x80;
   1.158 +
   1.159 +class TMBRPartitionEntry
   1.160 +	{
   1.161 +public:
   1.162 +	TBool IsValidPartition()
   1.163 +		{ return (iNumSectors>0 && iPartitionType!=KPartitionTypeEmpty); }
   1.164 +	TBool IsValidDosPartition()
   1.165 +		{ return (iNumSectors>0 && PartitionIsFAT(iPartitionType)); }
   1.166 +	TBool IsDefaultBootPartition()
   1.167 +		{ return(iX86BootIndicator==KBootIndicatorBootable && (IsValidDosPartition() || IsValidFAT32Partition())); }
   1.168 +	TBool IsValidFAT32Partition()
   1.169 +		{ return (iNumSectors>0 && PartitionIsFAT32(iPartitionType)); }
   1.170 +	TBool IsValidExFATPartition()
   1.171 +		{ return (iNumSectors>0 && PartitionIsNTFS(iPartitionType)); }
   1.172 +public:
   1.173 +	TUint8 iX86BootIndicator;
   1.174 +	TUint8 iStartHead;
   1.175 +	TUint8 iStartSector;
   1.176 +	TUint8 iStartCylinder;
   1.177 +	TUint8 iPartitionType;
   1.178 +	TUint8 iEndHead;
   1.179 +	TUint8 iEndSector;
   1.180 +	TUint8 iEndCylinder;
   1.181 +	TUint32 iFirstSector;
   1.182 +	TUint32 iNumSectors;
   1.183 +	};
   1.184 +
   1.185 +//
   1.186 +// Defines for Master boot record
   1.187 +//
   1.188 +const TUint KMBRFirstPartitionOffset=0x1BE;
   1.189 +const TUint KMBRSignatureOffset=0x1FE;
   1.190 +const TUint KMBRSignature=0xAA55;
   1.191 +const TInt KMBRMaxPrimaryPartitions=4;
   1.192 +
   1.193 +class TMasterBootRecord
   1.194 +	{
   1.195 +public:
   1.196 +	TUint8 iBootCode[KMBRFirstPartitionOffset];
   1.197 +	TMBRPartitionEntry iPartitionEntry[KMBRMaxPrimaryPartitions];
   1.198 +	TUint16 iSignature;
   1.199 +	};
   1.200 +
   1.201 +
   1.202 +
   1.203 +#endif
   1.204 +