| 34 | } |
| 35 | |
| 36 | Fat32Volume::Fat32Volume(PartitionDevice* _part, char* name){ |
| 37 | this->part = _part; |
| 38 | |
| 39 | fat32_boot_record_t* bootRecord = (fat32_boot_record_t*)kmalloc(512); |
| 40 | |
| 41 | if(part->ReadBlock(0, 512, (uint8_t*)bootRecord)){ // Read Volume Boot Record (First sector of partition) |
| 42 | Log::Warning("Disk Error Initializing Volume"); // Disk Error |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | this->bootRecord = bootRecord; |
| 47 | |
| 48 | Log::Info("[FAT32] Initializing Volume\tSignature: %d, OEM ID: %s, Size: %d MB", bootRecord->ebr.signature, (char*)bootRecord->bpb.oem, bootRecord->bpb.largeSectorCount * 512 / 1024 / 1024); |
| 49 | |
| 50 | clusterSizeBytes = bootRecord->bpb.sectorsPerCluster * part->parentDisk->blocksize; |
| 51 | |
| 52 | fat32MountPoint.flags = FS_NODE_MOUNTPOINT | FS_NODE_DIRECTORY; |
| 53 | fat32MountPoint.inode = bootRecord->ebr.rootClusterNum; |
| 54 | |
| 55 | fat32MountPoint.vol = this; |
| 56 | fat32MountPoint.size = 0; |
| 57 | |
| 58 | mountPoint = &fat32MountPoint; |
| 59 | |
| 60 | mountPointDirent.flags = DT_DIR; |
| 61 | mountPointDirent.node = &fat32MountPoint; |
| 62 | strcpy(mountPointDirent.name, name); |
| 63 | |
| 64 | } |
| 65 | |
| 66 | List<uint32_t>* Fat32Volume::GetClusterChain(uint32_t cluster){ |
| 67 | List<uint32_t>* list = new List<uint32_t>(); |