Initial revision
[reactos.git] / reactos / drivers / dd / ide / partitio.h
1 /**
2 *** Partition.h - defines and structs for harddrive partition info
3 ***
4 *** 05/30/98 RJJ Created
5 **/
6
7 #ifndef __PARTITION_H
8 #define __PARTITION_H
9
10 #define PARTITION_MAGIC 0xaa55
11 #define PART_MAGIC_OFFSET 0x01fe
12 #define PARTITION_OFFSET 0x01be
13 #define PARTITION_TBL_SIZE 4
14 #define PTCHSToLBA(c, h, s, scnt, hcnt) ((s) & 0x3f) + \
15 (scnt) * ( (h) + (hcnt) * ((c) | (((s) & 0xc0) << 2)))
16 #define PTLBAToCHS(lba, c, h, s, scnt, hcnt) ( \
17 (s) = (lba) % (scnt) + 1, \
18 (lba) /= (scnt), \
19 (h) = (lba) % (hcnt), \
20 (lba) /= (heads), \
21 (c) = (lba) & 0xff, \
22 (s) |= ((lba) >> 2) & 0xc0)
23
24
25 typedef enum PartitionTypes {
26 PTEmpty = 0,
27 PTDOS3xPrimary = 1,
28 PT_OLDDOS16Bit = 4,
29 PTDosExtended = 5,
30 PTDos5xPrimary = 6
31 } PARTITIONTYPES;
32
33 #define PartitionIsSupported(P) ((P)->PartitionType == PTDOS3xPrimary || \
34 (P)->PartitionType == PT_OLDDOS16Bit || (P)->PartitionType == PTDos5xPrimary)
35
36 typedef struct Partition {
37 __u8 BootFlags;
38 __u8 StartingHead;
39 __u8 StartingSector;
40 __u8 StartingCylinder;
41 __u8 PartitionType;
42 __u8 EndingHead;
43 __u8 EndingSector;
44 __u8 EndingCylinder;
45 unsigned int StartingBlock;
46 unsigned int SectorCount;
47
48 } PARTITION;
49
50 #endif // PARTITION_H
51
52