| 18 | } |
| 19 | |
| 20 | int DiskDevice::InitializePartitions(){ |
| 21 | static char letter = 'a'; |
| 22 | for(unsigned i = 0; i < partitions.get_length(); i++){ |
| 23 | if(fs::FAT32::Identify(partitions.get_at(i)) > 0) { |
| 24 | char vname[] = {'h', 'd', letter++, 0}; |
| 25 | auto vol = new fs::FAT32::Fat32Volume(partitions.get_at(i),vname); |
| 26 | fs::volumes->add_back(vol); |
| 27 | } else if(fs::Ext2::Identify(partitions.get_at(i)) > 0) { |
| 28 | bool systemFound = false; |
| 29 | |
| 30 | for(auto& vol : *fs::volumes){ // First Ext2 partition is mounted as /system |
| 31 | if(strcmp(vol->mountPointDirent.name, "system") == 0){ |
| 32 | systemFound = true; // System partition found |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | fs::Ext2::Ext2Volume* vol = nullptr; |
| 37 | |
| 38 | if(systemFound){ |
| 39 | char vname[] = {'h', 'd', letter++, 0}; |
| 40 | vol = new fs::Ext2::Ext2Volume(partitions.get_at(i), vname); |
| 41 | } else { |
| 42 | vol = new fs::Ext2::Ext2Volume(partitions.get_at(i), "system"); |
| 43 | } |
| 44 | |
| 45 | if(!vol->Error()) |
| 46 | fs::volumes->add_back(vol); |
| 47 | else |
| 48 | delete vol; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | int DiskDevice::ReadDiskBlock(uint64_t lba, uint32_t count, void* buffer){ |
| 56 | return -1; |