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