Chameleon

Chameleon Commit Details

Date:2011-08-01 04:49:50 (7 years 10 months ago)
Author:Evan Lojewski
Commit:1249
Parents: 1248
Message:Update disk class... disks are now doubly linked
Changes:
M/branches/xZen/src/modules/Disk/include/Disk.hpp
M/branches/xZen/src/modules/Disk/Disk.cpp

File differences

branches/xZen/src/modules/Disk/include/Disk.hpp
2525
2626
2727
28
29
30
31
32
2833
29
30
31
32
33
34
35
36
37
38
39
40
41
3442
43
44
45
3546
3647
37
3848
virtual void addPartition(Partition* partition);
virtual Partition* getPartition(UInt32 index);
static Disk*getDiskList() { return gFirstDisk; };
virtual Disk*getNextDisk() { return mNextDisk; };
virtual Disk*getPrevDisk() { return mPrevDisk; };
protected:
PartitionList *mPartitions;
const char *mName;
const char *mBusType;
UInt32 mBytesPerSector;
PartitionList*mPartitions;
const char*mName;
const char*mBusType;
UInt32mBytesPerSector;
virtual voidsetNextDisk(Disk* next) { mNextDisk = next; };
virtual voidsetPrevDisk(Disk* prev) { mPrevDisk = prev; };
private:
Disk*mPrevDisk;
Disk*mNextDisk;
static Disk*gFirstDisk;
};
#endif /* DISK_H */
branches/xZen/src/modules/Disk/Disk.cpp
44
55
66
7
8
79
810
911
12
1013
1114
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
1230
1331
1432
1533
16
34
35
36
1737
1838
1939
*/
#include <Disk.hpp>
Disk* Disk::gFirstDisk = NULL;
Disk::Disk()
{
mNextDisk = NULL;
mName = NULL;
mPartitions = NULL;
// Add disk entry to list
Disk* list = gFirstDisk;
if(!list) gFirstDisk = this;
else {
while(list->getNextDisk())
{
list = list->getNextDisk();
}
// Last disk found, add use to the end of the list
list->setNextDisk(this);
}
}
Disk::~Disk()
{
// remove disk entry from list
if(getPrevDisk() != NULL) getPrevDisk()->setNextDisk(getNextDisk());
else gFirstDisk = NULL;
}
Partition* Disk::getPartition(UInt32 index)

Archive Download the corresponding diff file

Revision: 1249