Author: korli Date: 2010-11-01 17:33:25 +0100 (Mon, 01 Nov 2010) New Revision: 39253 Changeset: http://dev.haiku-os.org/changeset/39253 Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.h haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.h haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp Log: fixed warnings, added a better label for >1TB sized volumes Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp 2010-11-01 16:31:09 UTC (rev 39252) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp 2010-11-01 16:33:25 UTC (rev 39253) @@ -100,9 +100,8 @@ size_t length = entry->NameLength(); TRACE("block %lu, displacement %lu: entry ino %lu, length %u, " - "name length %lu, type %lu\n", fLogicalBlock, fDisplacement, - entry->InodeID(), entry->Length(), (uint32)length, - (uint32)entry->FileType()); + "name length %lu, type %u\n", fLogicalBlock, fDisplacement, + entry->InodeID(), entry->Length(), length, entry->FileType()); if (*_nameLength > 0) { if (*_nameLength < length) @@ -145,7 +144,7 @@ entry = (ext2_dir_entry*)(block + fDisplacement); do { - TRACE("Checking entry at block %lu, displacement %lu\n", fPhysicalBlock, + TRACE("Checking entry at block %llu, displacement %lu\n", fPhysicalBlock, fDisplacement); if (entry->Length() == 0) { @@ -215,7 +214,7 @@ DirectoryIterator::Restart() { TRACE("DirectoryIterator::Restart(): (logical, physical, displacement): " - "current: (%lu, %lu, %lu), start: (%lu, %lu, %lu)\n", fLogicalBlock, + "current: (%lu, %llu, %lu), start: (%lu, %llu, %lu)\n", fLogicalBlock, fPhysicalBlock, fDisplacement, fStartLogicalBlock, fStartPhysicalBlock, fStartDisplacement); fLogicalBlock = fStartLogicalBlock; @@ -442,7 +441,7 @@ return B_DEVICE_FULL; TRACE("DirectoryIterator::_AllocateBestEntryInBlock(): Found a suitable " - "location: %lu\n", (uint32)bestPos); + "location: %u\n", bestPos); pos = bestPos; newLength = bestRealLength; @@ -455,9 +454,8 @@ uint8 nameLength, ino_t id, uint8 type, uint16 newLength, uint16 pos, bool hasPrevious) { - TRACE("DirectoryIterator::_AddEntry(%s, %d, %d, %d, %d, %d, %c)\n", - name, (int)nameLength, (int)id, (int)type, (int)newLength, (int)pos, - hasPrevious ? 't' : 'f'); + TRACE("DirectoryIterator::_AddEntry(%s, %d, %llu, %d, %d, %d, %c)\n", + name, nameLength, id, type, newLength, pos, hasPrevious ? 't' : 'f'); CachedBlock cached(fVolume); uint8* block = cached.SetToWritable(transaction, fPhysicalBlock); @@ -492,8 +490,8 @@ uint32 newBlocksPos, bool firstSplit) { // Block is full, split required - TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %lu, %lu, %c)\n", - name, (unsigned int)nameLength, (uint32)id, newBlocksPos, + TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %llu, %lu, %c)\n", + name, nameLength, id, newBlocksPos, firstSplit ? 't' : 'f'); // Allocate a buffer for the entries in the block Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.h 2010-11-01 16:31:09 UTC (rev 39252) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.h 2010-11-01 16:33:25 UTC (rev 39253) @@ -70,7 +70,7 @@ uint32 fDisplacement; uint32 fPreviousDisplacement; - uint32 fStartPhysicalBlock; + off_t fStartPhysicalBlock; uint32 fStartLogicalBlock; uint32 fStartDisplacement; Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp 2010-11-01 16:31:09 UTC (rev 39252) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp 2010-11-01 16:33:25 UTC (rev 39253) @@ -269,7 +269,7 @@ uint32 HTreeEntryIterator::BlocksNeededForNewEntry() { - TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %lu, " + TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %llu, " "volume: %p\n", fBlockNum, fVolume); CachedBlock cached(fVolume); @@ -303,9 +303,9 @@ status_t HTreeEntryIterator::InsertEntry(Transaction& transaction, uint32 hash, - uint32 blockNum, uint32 newBlocksPos, bool hasCollision) + off_t blockNum, off_t newBlocksPos, bool hasCollision) { - TRACE("HTreeEntryIterator::InsertEntry(): block num: %lu\n", fBlockNum); + TRACE("HTreeEntryIterator::InsertEntry(): block num: %llu\n", fBlockNum); CachedBlock cached(fVolume); uint8* blockData = cached.SetToWritable(transaction, fBlockNum); @@ -345,10 +345,10 @@ } TRACE("HTreeEntryIterator::InsertEntry(): Inserting node. Count: %u, " - "current entry: %lu\n", (uint16)count, (uint32)fCurrentEntry); + "current entry: %u\n", count, fCurrentEntry); if (count > 0) { - TRACE("HTreeEntryIterator::InsertEntry(): memmove(%lu, %lu, %lu)\n", + TRACE("HTreeEntryIterator::InsertEntry(): memmove(%u, %u, %u)\n", fCurrentEntry + 2, fCurrentEntry + 1, count + fFirstEntry - fCurrentEntry - 1); memmove(&entries[fCurrentEntry + 2], &entries[fCurrentEntry + 1], Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.h 2010-11-01 16:31:09 UTC (rev 39252) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.h 2010-11-01 16:33:25 UTC (rev 39253) @@ -34,8 +34,8 @@ uint32 BlocksNeededForNewEntry(); status_t InsertEntry(Transaction& transaction, - uint32 hash, uint32 block, - uint32 newBlocksPos, bool hasCollision); + uint32 hash, off_t block, + off_t newBlocksPos, bool hasCollision); private: HTreeEntryIterator(uint32 block, uint32 blockSize, Inode* directory, Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp 2010-11-01 16:31:09 UTC (rev 39252) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp 2010-11-01 16:33:25 UTC (rev 39253) @@ -184,7 +184,7 @@ } if (_size) { - *_size = 1LL * geometry.head_count * geometry.cylinder_count + *_size = 1ULL * geometry.head_count * geometry.cylinder_count * geometry.sectors_per_track * geometry.bytes_per_sector; } if (_blockSize) @@ -420,11 +420,15 @@ if (!fSuperBlock.name[0]) { // generate a more or less descriptive volume name - uint32 divisor = 1UL << 30; - char unit = 'G'; + off_t divisor = 1ULL << 40; + char unit = 'T'; if (diskSize < divisor) { - divisor = 1UL << 20; - unit = 'M'; + divisor = 1UL << 30; + unit = 'G'; + if (diskSize < divisor) { + divisor = 1UL << 20; + unit = 'M'; + } } double size = double((10 * diskSize + divisor - 1) / divisor); @@ -558,13 +562,12 @@ return B_NO_MEMORY; memcpy(fGroupBlocks[blockIndex], block, fBlockSize); - - TRACE("group [%ld]: inode table %ld\n", index, - (fGroupBlocks[blockIndex] + index % fGroupsPerBlock)->InodeTable()); } *_group = (ext2_block_group*)(fGroupBlocks[blockIndex] + (index % fGroupsPerBlock) * fGroupDescriptorSize); + TRACE("group [%ld]: inode table %lld\n", index, + (*_group)->InodeTable(Has64bitFeature())); return B_OK; } @@ -760,10 +763,10 @@ if (status != B_OK) return status; - TRACE("Volume::FreeBlocks(): number of free blocks (before): %lu\n", + TRACE("Volume::FreeBlocks(): number of free blocks (before): %llu\n", fFreeBlocks); fFreeBlocks += length; - TRACE("Volume::FreeBlocks(): number of free blocks (after): %lu\n", + TRACE("Volume::FreeBlocks(): number of free blocks (after): %llu\n", fFreeBlocks); return WriteSuperBlock(transaction); @@ -799,8 +802,8 @@ fSuperBlock.SetFreeInodes(fFreeInodes); // TODO: Rest of fields that can be modified - TRACE("Volume::WriteSuperBlock(): free blocks: %lu, free inodes: %lu\n", - fSuperBlock.FreeBlocks(), fSuperBlock.FreeInodes()); + TRACE("Volume::WriteSuperBlock(): free blocks: %llu, free inodes: %lu\n", + fSuperBlock.FreeBlocks(Has64bitFeature()), fSuperBlock.FreeInodes()); CachedBlock cached(this); uint8* block = cached.SetToWritable(transaction, fFirstDataBlock);