Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/modules/Disk/Partition.cpp

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>
7Partition::Partition(Disk* disk, UInt8 partitionNumber)
8{
9 mDisk = disk;
10 mNumSectors = 0;
11 mBeginSector = 0;
12 mPartitionNumber = partitionNumber;
13 mNumPartitions = 0;
14}
15
16Partition::~Partition()
17{
18
19}
20
21IOReturn 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
27IOReturn 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
33bool Partition::probe()
34{
35 return (mDisk != NULL) && (mPartitionNumber != INVALID_PARTITION) && mNumSectors;
36}
37
38/*
39Partition::getUUID()
40{
41 return mUUID;
42}
43*/

Archive Download this file

Revision: 1406