os/kernelhwsrv/kernel/eka/include/partitions.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-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	KPartitionTypePagedData=0xf8;		// Symbian defined 
   110 const TUint	KPartitionTypeROM=0xf9;				// Symbian defined 
   111 const TUint	KPartitionTypeRofs=0xfa;			// Symbian defined 
   112 const TUint KPartitionTypeIso9660=0xfb;			// Symbian defined 
   113 const TUint KPartitionTypeEneaLFFS=0xfc;		// Symbian defined 
   114 const TUint KPartitionTypeLinuxRaidAuto=0xfd;
   115 const TUint KPartitionTypeLANStep=0xfe;
   116 const TUint KPartitionTypeBBT=0xff;
   117 
   118 inline TBool PartitionIsFAT(TUint a)
   119 	{
   120 	return (
   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
   130 		);
   131 	}
   132 
   133 inline TBool PartitionIsFAT32(TUint a)
   134 	{
   135 	return (
   136 		a==KPartitionTypeWin95FAT32					||
   137 		a==KPartitionTypeWin95FAT32LBA				||
   138 		a==KPartitionTypeHiddenWin95FAT32			||
   139 		a==KPartitionTypeHiddenWin95FAT32LBA
   140 		);
   141 	}
   142 
   143 inline TBool PartitionIsNTFS(TUint a)
   144 	{
   145 	return (
   146 		a==KPartitionTypeNTFS						||
   147 		a==KPartitionTypeHiddenNTFS
   148 		);
   149 	}
   150 
   151 //
   152 // Entry in MBR partition table
   153 //
   154 const TUint KBootIndicatorBootable=0x80;
   155 
   156 class TMBRPartitionEntry
   157 	{
   158 public:
   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)); }
   167 	TBool IsValidExFATPartition()
   168 		{ return (iNumSectors>0 && PartitionIsNTFS(iPartitionType)); }
   169 public:
   170 	TUint8 iX86BootIndicator;
   171 	TUint8 iStartHead;
   172 	TUint8 iStartSector;
   173 	TUint8 iStartCylinder;
   174 	TUint8 iPartitionType;
   175 	TUint8 iEndHead;
   176 	TUint8 iEndSector;
   177 	TUint8 iEndCylinder;
   178 	TUint32 iFirstSector;
   179 	TUint32 iNumSectors;
   180 	};
   181 
   182 //
   183 // Defines for Master boot record
   184 //
   185 const TUint KMBRFirstPartitionOffset=0x1BE;
   186 const TUint KMBRSignatureOffset=0x1FE;
   187 const TUint KMBRSignature=0xAA55;
   188 const TInt KMBRMaxPrimaryPartitions=4;
   189 
   190 class TMasterBootRecord
   191 	{
   192 public:
   193 	TUint8 iBootCode[KMBRFirstPartitionOffset];
   194 	TMBRPartitionEntry iPartitionEntry[KMBRMaxPrimaryPartitions];
   195 	TUint16 iSignature;
   196 	};
   197 
   198 
   199 
   200 #endif
   201