- int ret;
- int disk, part;
- Uint64 sector, count;
-
- disk = Node->Inode >> 8;
- part = Node->Inode & 0xFF;
-
- // Aligned Read
- if(Offset % SECTOR_SIZE == 0 && Length % SECTOR_SIZE == 0)
- {
- sector = Offset / SECTOR_SIZE;
- count = Length / SECTOR_SIZE;
- // Raw Disk?
- if(part == 0xFF)
- {
- // Bounds Check
- if( sector >= gATA_Disks[disk].Sectors ) return 0;
- if( sector + count > gATA_Disks[disk].Sectors )
- count = gATA_Disks[disk].Sectors - sector;
- // Read Data
- ret = ATA_Read(disk, sector, count, Buffer);
- }
- else // Or a partition
- {
- //Log(" ATA_ReadFS: %i:%i 0x%llx + 0x%llx\n", disk, part,
- // gATA_Disks[disk].Partitions[part].Start,
- // gATA_Disks[disk].Partitions[part].Length );
-
- // Bounds Check
- if( sector >= gATA_Disks[disk].Partitions[part].Length ) return 0;
- if( sector + count > gATA_Disks[disk].Partitions[part].Length )
- count = gATA_Disks[disk].Partitions[part].Length - sector;
- // Read Disk
- ret = ATA_Read(disk,
- gATA_Disks[disk].Partitions[part].Start + sector,
- count,
- Buffer);
- }
- // Check return value
- if(ret == 1)
- return count * SECTOR_SIZE;
- else {
- Warning("ATA_ReadFS: RETURN 0 (Read failed with ret = %i)", ret);
- return 0;
- }
- }
- Warning("ATA_ReadFS: RETURN 0 (Non-Aligned Read 0x%llx 0x%llx)", Offset, Length);
- return 0;
+ //Log("ATA_ReadFS: (Node=%p, Offset=0x%llx, Length=0x%llx, Buffer=%p)", Node, Offset, Length, Buffer);
+ return DrvUtil_ReadBlock(Offset, Length, Buffer, ATA_Read, SECTOR_SIZE, Node->Inode);