Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/modules/Disk/Partition.cpp

Source at commit 1158 created 13 years 16 days ago.
By azimutz, Match nvidia.c with the one on my branch (Chazi) adding dev id's from issue 99 and Asus G74SX (0DF4, 1251).
1/*
2 * Copyright (c) 2011 Evan Lojewski. All rights reserved.
3 *
4 */
5#include <Partition.hpp>
6
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: 1158