| 94 | } |
| 95 | |
| 96 | void* Fat32Volume::ReadClusterChain(uint32_t cluster, int* clusterCount, size_t max){ |
| 97 | uint32_t maxCluster = (max / (bootRecord->bpb.sectorsPerCluster * part->parentDisk->blocksize)) + 1; |
| 98 | List<uint32_t>* clusterChain = GetClusterChain(cluster); |
| 99 | |
| 100 | if(!clusterChain) return nullptr; |
| 101 | |
| 102 | uint8_t* buf = reinterpret_cast<uint8_t*>(kmalloc(clusterChain->get_length() * clusterSizeBytes)); |
| 103 | void* _buf = buf; |
| 104 | |
| 105 | for(unsigned i = 0; i < clusterChain->get_length() && maxCluster; i++){ |
| 106 | part->ReadBlock(ClusterToLBA(clusterChain->get_at(i)), clusterSizeBytes, buf); |
| 107 | |
| 108 | buf += clusterSizeBytes; |
| 109 | } |
| 110 | |
| 111 | if(clusterCount) |
| 112 | *clusterCount = clusterChain->get_length(); |
| 113 | |
| 114 | delete clusterChain; |
| 115 | |
| 116 | return _buf; |
| 117 | } |
| 118 | |
| 119 | void* Fat32Volume::ReadClusterChain(uint32_t cluster, int* clusterCount){ |
| 120 | if(cluster == 0) cluster = bootRecord->ebr.rootClusterNum; |
nothing calls this directly
no test coverage detected