Root/
Source at commit 1129 created 12 years 11 months ago. By meklort, Change options.o so that it reloads the system config as well. Also change it so that it uses that config for variables (NOTE: if the calue exists in chameleonConfig, it's used instead. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2011 Evan Lojewski. All rights reserved.␊ |
3 | *␊ |
4 | */␊ |
5 | #include <FDiskPartition.hpp>␊ |
6 | ␊ |
7 | ␊ |
8 | FDiskPartition::FDiskPartition(Disk* disk, UInt8 partitionNumber) : Partition(disk, partitionNumber)␊ |
9 | {␊ |
10 | mDisk = disk;␊ |
11 | mNumSectors = 0;␊ |
12 | mBeginSector = 0;␊ |
13 | mPartitionNumber = partitionNumber;␊ |
14 | mNumPartitions = 0;␊ |
15 | mFdiskEntry = NULL;␊ |
16 | ␊ |
17 | if(mDisk)␊ |
18 | {␊ |
19 | // read in lba0, this contains the partition map if it's FDisk / MBR␊ |
20 | mDisk->Read(0, 1, (UInt8*)&mLBA0);␊ |
21 | ␊ |
22 | if(isMBRDisk())␊ |
23 | {␊ |
24 | // Determine number of partition. TODO: Extended partitions␊ |
25 | UInt8 i = 0;␊ |
26 | for(i = 0; i < DISK_NPART; i++)␊ |
27 | {␊ |
28 | if(mLBA0.parts[i].systid != 0)␊ |
29 | {␊ |
30 | if(mPartitionNumber == mNumPartitions) mFdiskEntry = &mLBA0.parts[i];␊ |
31 | mNumPartitions++;␊ |
32 | }␊ |
33 | ␊ |
34 | }␊ |
35 | ␊ |
36 | if(mFdiskEntry)␊ |
37 | {␊ |
38 | mNumSectors = mFdiskEntry->numsect;␊ |
39 | mBeginSector = mFdiskEntry->relsect;␊ |
40 | }␊ |
41 | }␊ |
42 | } ␊ |
43 | }␊ |
44 | ␊ |
45 | FDiskPartition::~FDiskPartition()␊ |
46 | {␊ |
47 | ␊ |
48 | }␊ |
49 | ␊ |
50 | bool FDiskPartition::isMBRDisk()␊ |
51 | {␊ |
52 | return mLBA0.signature == DISK_SIGNATURE;␊ |
53 | }␊ |
54 |