Root/
Source at commit 1406 created 12 years 10 months ago. By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. Added some comments about it too. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2011 Evan Lojewski. All rights reserved.␊ |
3 | *␊ |
4 | */␊ |
5 | #include <Partition.hpp>␊ |
6 | #include <Disk.hpp> ␊ |
7 | Partition::Partition(Disk* disk, UInt8 partitionNumber)␊ |
8 | {␊ |
9 | mDisk = disk;␊ |
10 | mNumSectors = 0;␊ |
11 | mBeginSector = 0;␊ |
12 | mPartitionNumber = partitionNumber;␊ |
13 | mNumPartitions = 0;␊ |
14 | }␊ |
15 | ␊ |
16 | Partition::~Partition()␊ |
17 | {␊ |
18 | ␊ |
19 | }␊ |
20 | ␊ |
21 | IOReturn Partition::Read(UInt64 sector, UInt64 size, UInt8* buffer)␊ |
22 | {␊ |
23 | if(probe() && mDisk->probe()) return mDisk->Read(sector + mBeginSector, size, buffer);␊ |
24 | else return kIOReturnUnsupported;␊ |
25 | }␊ |
26 | ␊ |
27 | IOReturn Partition::Write(UInt64 sector, UInt64 size, UInt8* buffer)␊ |
28 | {␊ |
29 | if(probe() && mDisk->probe()) return mDisk->Write(sector + mBeginSector, size, buffer);␊ |
30 | else return kIOReturnUnsupported;␊ |
31 | }␊ |
32 | ␊ |
33 | bool Partition::probe()␊ |
34 | {␊ |
35 | return (mDisk != NULL) && (mPartitionNumber != INVALID_PARTITION) && mNumSectors;␊ |
36 | }␊ |
37 | ␊ |
38 | /*␊ |
39 | Partition::getUUID()␊ |
40 | {␊ |
41 | return mUUID;␊ |
42 | }␊ |
43 | */ |