Chameleon

Chameleon Svn Source Tree

Root/branches/xZen/src/modules/Disk/include/Disk.hpp

Source at commit 1249 created 12 years 8 months ago.
By meklort, Update disk class... disks are now doubly linked
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
11class Disk
12{
13public:
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
29static Disk*getDiskList() { return gFirstDisk; };
30virtual Disk*getNextDisk() { return mNextDisk; };
31virtual Disk*getPrevDisk() { return mPrevDisk; };
32
33protected:
34 PartitionList*mPartitions;
35 const char*mName;
36 const char*mBusType;
37
38 UInt32mBytesPerSector;
39
40virtual voidsetNextDisk(Disk* next) { mNextDisk = next; };
41virtual voidsetPrevDisk(Disk* prev) { mPrevDisk = prev; };
42private:
43Disk*mPrevDisk;
44Disk*mNextDisk;
45static Disk*gFirstDisk;
46
47};
48#endif /* DISK_H */
49

Archive Download this file

Revision: 1249