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 | #ifndef DISK_H␊ |
6 | #define DISK_H␊ |
7 | ␊ |
8 | #include <IOKit/IOTypes.h>␊ |
9 | #include <Partition.hpp>␊ |
10 | ␊ |
11 | class Disk␊ |
12 | {␊ |
13 | public:␊ |
14 | Disk();␊ |
15 | Disk(const char* name);␊ |
16 | ~Disk();␊ |
17 | ␊ |
18 | // TODO: add cacheing␊ |
19 | virtual IOReturn Read(UInt64 sector, UInt64 size, UInt8* buffer) = 0;␊ |
20 | virtual IOReturn Write(UInt64 sector, UInt64 size, UInt8* buffer) = 0;␊ |
21 | ␊ |
22 | virtual bool isValid() { return mName != NULL && mBytesPerSector; };␊ |
23 | virtual bool probe() { return isValid(); };␊ |
24 | virtual UInt32 bytesPerSector() { return mBytesPerSector; };␊ |
25 | ␊ |
26 | virtual void addPartition(Partition* partition);␊ |
27 | virtual Partition* getPartition(UInt32 index);␊ |
28 | ␉␊ |
29 | ␉static Disk*␉␉getDiskList() { return gFirstDisk; };␊ |
30 | ␉virtual Disk*␉␉getNextDisk() { return mNextDisk; };␊ |
31 | ␉virtual Disk*␉␉getPrevDisk() { return mPrevDisk; };␊ |
32 | ␉␊ |
33 | protected:␊ |
34 | PartitionList␉␉*mPartitions;␊ |
35 | const char␉␉␉*mName;␊ |
36 | const char␉␉␉*mBusType;␊ |
37 | ␊ |
38 | UInt32␉␉␉␉mBytesPerSector;␊ |
39 | ␉␊ |
40 | ␉virtual void␉␉setNextDisk(Disk* next) { mNextDisk = next; };␊ |
41 | ␉virtual void␉␉setPrevDisk(Disk* prev) { mPrevDisk = prev; };␊ |
42 | private:␊ |
43 | ␉Disk*␉␉␉mPrevDisk;␊ |
44 | ␉Disk*␉␉␉mNextDisk;␊ |
45 | ␉static Disk*␉gFirstDisk;␊ |
46 | ␊ |
47 | };␊ |
48 | #endif /* DISK_H */␊ |
49 |