diff options
-rw-r--r-- | Source/Kernel/FileSystems/FAT/FATFS.class.cpp | 16 | ||||
-rw-r--r-- | Source/Kernel/VFS/BlockCache.class.cpp | 10 | ||||
-rw-r--r-- | Source/Kernel/VFS/Partition.class.cpp | 2 | ||||
-rw-r--r-- | Source/Kernel/VFS/Partition.class.h | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/Source/Kernel/FileSystems/FAT/FATFS.class.cpp b/Source/Kernel/FileSystems/FAT/FATFS.class.cpp index 35c18eb..4c20b3f 100644 --- a/Source/Kernel/FileSystems/FAT/FATFS.class.cpp +++ b/Source/Kernel/FileSystems/FAT/FATFS.class.cpp @@ -63,12 +63,12 @@ FileSystem* FATFS::mount(Partition* p, DirectoryNode* mountpoint, bool readwrite } u32int FATFS::nextCluster(u32int cluster) { - u8int fat_table[m_part->getBlockSize()]; + u8int fat_table[m_part->blockSize()]; u32int val; if (m_fatType == 12) { u32int fat_offset = cluster + (cluster / 2); - u32int fat_sector = m_bs.reserved_sector_count + (fat_offset / m_part->getBlockSize()); - u32int ent_offset = fat_offset % m_part->getBlockSize(); + u32int fat_sector = m_bs.reserved_sector_count + (fat_offset / m_part->blockSize()); + u32int ent_offset = fat_offset % m_part->blockSize(); m_fatCache.readBlocks(fat_sector, 1, fat_table); u16int tblval = *(u16int*)&fat_table[ent_offset]; if (cluster & 1) val = tblval >> 4; @@ -76,16 +76,16 @@ u32int FATFS::nextCluster(u32int cluster) { if (val >= 0xFF7) val = 0; } else if (m_fatType == 16) { u32int fat_offset = cluster * 2; - u32int fat_sector = m_bs.reserved_sector_count + (fat_offset / m_part->getBlockSize()); - u32int ent_offset = fat_offset % m_part->getBlockSize(); + u32int fat_sector = m_bs.reserved_sector_count + (fat_offset / m_part->blockSize()); + u32int ent_offset = fat_offset % m_part->blockSize(); m_fatCache.readBlocks(fat_sector, 1, fat_table); u16int tblval = *(u16int*)&fat_table[ent_offset]; val = tblval; if (tblval >= 0xFFF7) val = 0; } else if (m_fatType == 32) { u32int fat_offset = cluster * 4; - u32int fat_sector = m_bs.reserved_sector_count + (fat_offset / m_part->getBlockSize()); - u32int ent_offset = fat_offset % m_part->getBlockSize(); + u32int fat_sector = m_bs.reserved_sector_count + (fat_offset / m_part->blockSize()); + u32int ent_offset = fat_offset % m_part->blockSize(); m_fatCache.readBlocks(fat_sector, 1, fat_table); val = *(u32int*)&fat_table[ent_offset] & 0x0FFFFFFF; if (val >= 0x0FFFFFF7) val = 0; @@ -175,7 +175,7 @@ bool FATFS::loadContents(DirectoryNode* dir) { u32int entries = m_clusterSize / sizeof(fat_dir_entry_t); if (cluster == 2 and m_fatType != 32) { //This is the value we use for the root directory - e.c = (u8int*)Mem::alloc(m_rootDirSectors * m_part->getBlockSize()); + e.c = (u8int*)Mem::alloc(m_rootDirSectors * m_part->blockSize()); if (!m_part->readBlocks(m_firstDataSector, m_rootDirSectors, e.c)) return false; } else { e.c = (u8int*)Mem::alloc(m_clusterSize); diff --git a/Source/Kernel/VFS/BlockCache.class.cpp b/Source/Kernel/VFS/BlockCache.class.cpp index 458faf6..d505a99 100644 --- a/Source/Kernel/VFS/BlockCache.class.cpp +++ b/Source/Kernel/VFS/BlockCache.class.cpp @@ -17,7 +17,7 @@ BlockCache<T>::~BlockCache() { template <typename T> void BlockCache<T>::sync() { for (u32int i = 0; i < m_count; i++) { - if (m_cacheInfo[i].dirty) m_dev->writeBlocks(m_cacheInfo[i].id, 1, m_cache + (i * m_dev->getBlockSize())); + if (m_cacheInfo[i].dirty) m_dev->writeBlocks(m_cacheInfo[i].id, 1, m_cache + (i * m_dev->blockSize())); } } @@ -30,7 +30,7 @@ void BlockCache<T>::init(u32int count) { m_cacheInfo[i].lastuse = 0; m_cacheInfo[i].dirty = false; } - m_cache = (u8int*)Mem::alloc(m_count * m_dev->getBlockSize()); + m_cache = (u8int*)Mem::alloc(m_count * m_dev->blockSize()); } template <typename T> @@ -45,11 +45,11 @@ bool BlockCache<T>::setCache(u64int block, u8int* data, bool dirty) { } if (best >= m_count) return false; if (m_cacheInfo[best].dirty && (m_cacheInfo[best].id != block or !dirty)) - m_dev->writeBlocks(m_cacheInfo[best].id, 1, m_cache + (best * m_dev->getBlockSize())); + m_dev->writeBlocks(m_cacheInfo[best].id, 1, m_cache + (best * m_dev->blockSize())); m_cacheInfo[best].id = block; m_cacheInfo[best].lastuse = Time::uptime(); m_cacheInfo[best].dirty = dirty; - memcpy(m_cache + (best * m_dev->getBlockSize()), data, m_dev->getBlockSize()); + memcpy(m_cache + (best * m_dev->blockSize()), data, m_dev->blockSize()); return true; } @@ -58,7 +58,7 @@ bool BlockCache<T>::getCache(u64int block, u8int* data) { for (u32int i = 0; i < m_count; i++) { if (m_cacheInfo[i].id == block && m_cacheInfo[i].lastuse != 0) { m_cacheInfo[i].lastuse = Time::uptime(); - memcpy(data, m_cache + (i * m_dev->getBlockSize()), m_dev->getBlockSize()); + memcpy(data, m_cache + (i * m_dev->blockSize()), m_dev->blockSize()); return true; } } diff --git a/Source/Kernel/VFS/Partition.class.cpp b/Source/Kernel/VFS/Partition.class.cpp index 1476b14..8d7de9b 100644 --- a/Source/Kernel/VFS/Partition.class.cpp +++ b/Source/Kernel/VFS/Partition.class.cpp @@ -67,4 +67,4 @@ BlockDevice* Partition::getDevice() { return m_device; } u64int Partition::getStartBlock() { return m_startblock; } u64int Partition::getBlockCount() { return m_blockcount; } u8int Partition::getPartNumber() { return m_partnumber; } -u32int Partition::getBlockSize() { return m_device->blockSize(); } +u32int Partition::blockSize() { return m_device->blockSize(); } diff --git a/Source/Kernel/VFS/Partition.class.h b/Source/Kernel/VFS/Partition.class.h index f511074..eb0aafd 100644 --- a/Source/Kernel/VFS/Partition.class.h +++ b/Source/Kernel/VFS/Partition.class.h @@ -26,7 +26,7 @@ class Partition { u64int getStartBlock(); u64int getBlockCount(); u8int getPartNumber(); - u32int getBlockSize(); + u32int blockSize(); inline u64int blocks() { return getBlockCount(); } }; |