ext2: fixes 64 bit warnings

This commit is contained in:
Jérôme Duval
2013-05-08 20:10:33 +02:00
parent df720531e3
commit a130bab351
19 changed files with 494 additions and 421 deletions
@@ -211,7 +211,7 @@ Attribute::Read(attr_cookie* cookie, off_t pos, uint8* buffer, size_t* _length)
start += EXT2_INODE_NORMAL_SIZE + fInode->Node().ExtraInodeSize()
+ sizeof(uint32);
pos += fBodyEntry->ValueOffset();
if ((pos + length) > (end - start) || length > fBodyEntry->ValueSize())
if ((off_t)(pos + length) > (end - start) || length > fBodyEntry->ValueSize())
return ERANGE;
}
memcpy(buffer, start + (uint32)pos, length);
@@ -28,7 +28,7 @@ BitmapBlock::BitmapBlock(Volume* volume, uint32 numBits)
fNumBits(numBits),
fMaxIndex(fNumBits >> 5)
{
TRACE("BitmapBlock::BitmapBlock(): num bits: %lu\n", fNumBits);
TRACE("BitmapBlock::BitmapBlock(): num bits: %" B_PRIu32 "\n", fNumBits);
}
@@ -95,7 +95,8 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked)
uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]);
if ((bits & mask) != (marked ? mask : 0)) {
TRACE("BitmapBlock::_Check(): start %lx mask %lx\n", bits, mask);
TRACE("BitmapBlock::_Check(): start %" B_PRIx32 " mask %" B_PRIx32
"\n", bits, mask);
return false;
}
@@ -105,8 +106,8 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked)
for (; iterations > 0; --iterations) {
if (data[index++] != (marked ? 0xFFFFFFFF : 0)) {
TRACE("BitmapBlock::_Check(): iterations %lu bits: %lX\n", iterations,
data[index - 1]);
TRACE("BitmapBlock::_Check(): iterations %" B_PRIu32 " bits: %"
B_PRIx32 "\n", iterations, data[index - 1]);
return false;
}
}
@@ -116,8 +117,9 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked)
uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]);
if ((bits & mask) != (marked ? mask : 0)) {
TRACE("BitmapBlock::_Check(): remainingBits %ld remaining %lX mask %lX\n",
remainingBits, bits, mask);
TRACE("BitmapBlock::_Check(): remainingBits %" B_PRIu32
" remaining %" B_PRIx32 " mask %" B_PRIx32 "\n", remainingBits,
bits, mask);
return false;
}
}
@@ -129,8 +131,8 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked)
bool
BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
{
TRACE("BitmapBlock::_Update(%lu, %lu, %c, %c)\n", start, length,
unmark ? 't' : 'f', force ? 't' : 'f');
TRACE("BitmapBlock::_Update(%" B_PRIu32 ", %" B_PRIu32 ", %c, %c)\n",
start, length, mark ? 't' : 'f', force ? 't' : 'f');
if (fData == NULL || start + length > fNumBits)
return false;
@@ -139,23 +141,24 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
uint32 startBit = start & 0x1F;
uint32 remainingBits = (length + startBit) & 0x1F;
TRACE("BitmapBlock::_Update(): start index: %lu, start bit: %lu, remaining "
"bits: %lu)\n", startIndex, startBit, remainingBits);
TRACE("BitmapBlock::_Update(): start index: %" B_PRIu32 ", start bit: %"
B_PRIu32 ", remaining bits: %" B_PRIu32 ")\n", startIndex, startBit,
remainingBits);
uint32 iterations;
if (length < 32) {
if (startBit + length < 32) {
uint32 bits = B_LENDIAN_TO_HOST_INT32(fData[startIndex]);
TRACE("BitmapBlock::_Update(): bits: %lx\n", bits);
TRACE("BitmapBlock::_Update(): bits: %" B_PRIx32 "\n", bits);
uint32 mask = (1 << (startBit + length)) - 1;
mask &= ~((1 << startBit) - 1);
TRACE("BitmapBlock::_Update(): mask: %lx\n", mask);
TRACE("BitmapBlock::_Update(): mask: %" B_PRIx32 "\n", mask);
if ((bits & mask) != (mark ? 0 : mask)) {
ERROR("BitmapBlock::_Update() Marking failed bits %lx "
"startBit %ld\n", bits, startBit);
ERROR("BitmapBlock::_Update() Marking failed bits %" B_PRIx32
" startBit %" B_PRIu32 "\n", bits, startBit);
return false;
}
@@ -164,7 +167,8 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
else
bits &= ~mask;
TRACE("BitmapBlock::_Update(): updated bits: %lx\n", bits);
TRACE("BitmapBlock::_Update(): updated bits: %" B_PRIx32 "\n",
bits);
fData[startIndex] = B_HOST_TO_LENDIAN_INT32(bits);
return true;
@@ -173,14 +177,15 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
} else
iterations = (length - 32 + startBit) >> 5;
TRACE("BitmapBlock::_Update(): iterations: %lu\n", iterations);
TRACE("BitmapBlock::_Update(): iterations: %" B_PRIu32 "\n", iterations);
uint32 index = startIndex;
if (startBit != 0) {
uint32 mask = ~((1 << startBit) - 1);
uint32 bits = B_LENDIAN_TO_HOST_INT32(fData[index]);
TRACE("BitmapBlock::_Update(): mask: %lx, bits: %lx\n", mask, bits);
TRACE("BitmapBlock::_Update(): mask: %" B_PRIx32 ", bits: %" B_PRIx32
"\n", mask, bits);
if (!force && (bits & mask) != (mark ? 0 : mask))
return false;
@@ -191,7 +196,7 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
bits &= ~mask;
fData[index] = B_HOST_TO_LENDIAN_INT32(bits);
TRACE("BitmapBlock::_Update(): updated bits: %lx\n", bits);
TRACE("BitmapBlock::_Update(): updated bits: %" B_PRIx32 "\n", bits);
index += 1;
} else
iterations++;
@@ -199,7 +204,8 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
for (; iterations > 0; --iterations) {
if (!force && fData[index] != (mark ? 0 : 0xFFFFFFFF)) {
ERROR("BitmapBlock::_Update() Marking failed "
"index %ld, iterations %ld\n", index, iterations);
"index %" B_PRIu32 ", iterations %" B_PRId32 "\n", index,
iterations);
return false;
}
fData[index++] = (mark ? 0xFFFFFFFF : 0);
@@ -211,7 +217,8 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
uint32 mask = (1 << remainingBits) - 1;
uint32 bits = B_LENDIAN_TO_HOST_INT32(fData[index]);
TRACE("BitmapBlock::_Update(): mask: %lx, bits: %lx\n", mask, bits);
TRACE("BitmapBlock::_Update(): mask: %" B_PRIx32 ", bits: %" B_PRIx32
"\n", mask, bits);
if (!force && (bits & mask) != (mark ? 0 : mask)) {
ERROR("BitmapBlock::_Update() Marking failed remaining\n");
@@ -224,7 +231,7 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
bits &= ~mask;
fData[index] = B_HOST_TO_LENDIAN_INT32(bits);
TRACE("BitmapBlock::_Update(): updated bits: %lx\n", bits);
TRACE("BitmapBlock::_Update(): updated bits: %" B_PRIx32 "\n", bits);
}
return true;
@@ -234,7 +241,7 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force)
void
BitmapBlock::_FindNext(uint32& pos, bool marked)
{
TRACE("BitmapBlock::_FindNext(): pos: %lu\n", pos);
TRACE("BitmapBlock::_FindNext(): pos: %" B_PRIu32 "\n", pos);
const uint32* data = fData == NULL ? fReadOnlyData : fData;
if (data == NULL)
@@ -252,8 +259,9 @@ BitmapBlock::_FindNext(uint32& pos, bool marked)
uint32 mask = ~((1 << bit) - 1);
uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]);
TRACE("BitmapBlock::_FindNext(): index: %lu, bit: %lu, mask: %lX, "
"bits: %lX\n", index, bit, mask, bits);
TRACE("BitmapBlock::_FindNext(): index: %" B_PRIu32 ", bit: %" B_PRIu32
", mask: %" B_PRIx32 ", bits: %" B_PRIx32 "\n", index, bit, mask,
bits);
bits &= mask;
if (bits == (marked ? 0 : mask) && index < fMaxIndex) {
@@ -271,7 +279,7 @@ BitmapBlock::_FindNext(uint32& pos, bool marked)
if (maxBit == 0) {
// Not found
TRACE("BitmapBlock::_FindNext(): reached end of block, "
"num bits: %lu\n", fNumBits);
"num bits: %" B_PRIu32 "\n", fNumBits);
pos = fNumBits;
return;
}
@@ -279,7 +287,7 @@ BitmapBlock::_FindNext(uint32& pos, bool marked)
mask &= (1 << maxBit) - 1;
if ((bits & mask) == (marked ? 0 : mask)) {
TRACE("BitmapBlock::_FindNext(): reached end of block, "
"num bits: %lu\n", fNumBits);
"num bits: %" B_PRIu32 "\n", fNumBits);
pos = fNumBits;
return;
}
@@ -291,19 +299,19 @@ BitmapBlock::_FindNext(uint32& pos, bool marked)
// Find the marked bit
if ((bits >> bit & 1) != (marked ? 0U : 1U)) {
pos = index << 5 | bit;
TRACE("BitmapBlock::_FindNext(): found bit: %lu\n", pos);
TRACE("BitmapBlock::_FindNext(): found bit: %" B_PRIu32 "\n", pos);
return;
}
}
panic("Couldn't find bit inside an uint32 (%lx)\n", bits);
panic("Couldn't find bit inside an uint32 (%" B_PRIx32 ")\n", bits);
}
void
BitmapBlock::FindPreviousMarked(uint32& pos)
{
TRACE("BitmapBlock::FindPreviousMarked(%lu)\n", pos);
TRACE("BitmapBlock::FindPreviousMarked(%" B_PRIu32 ")\n", pos);
const uint32* data = fData == NULL ? fReadOnlyData : fData;
if (data == NULL)
return;
@@ -321,8 +329,8 @@ BitmapBlock::FindPreviousMarked(uint32& pos)
uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]);
bits = bits & mask;
TRACE("BitmapBlock::FindPreviousMarked(): index: %lu bit: %lu bits: %lx\n",
index, bit, bits);
TRACE("BitmapBlock::FindPreviousMarked(): index: %" B_PRIu32 " bit: %"
B_PRIu32 " bits: %" B_PRIx32 "\n", index, bit, bits);
if (bits == 0) {
// Find an block of 32 bits that has a marked bit
@@ -340,8 +348,8 @@ BitmapBlock::FindPreviousMarked(uint32& pos)
bit = 31;
}
TRACE("BitmapBlock::FindPreviousMarked(): index: %lu bit: %lu bits: %lx\n",
index, bit, bits);
TRACE("BitmapBlock::FindPreviousMarked(): index: %" B_PRIu32 " bit: %"
B_PRIu32 " bits: %" B_PRIx32 "\n", index, bit, bits);
for (; bit >= 0; --bit) {
// Find the marked bit
@@ -368,9 +376,10 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length)
uint32 index = 0;
uint32 bits = B_LENDIAN_TO_HOST_INT32(data[0]);
TRACE("BitmapBlock::FindLargestUnmarkedRange(): word span: %lu, last "
"index: %lu, start index: %lu, index: %lu, bits: %lX, start: %lu, "
"length: %lu\n", wordSpan, fMaxIndex, startIndex, index, bits, start,
TRACE("BitmapBlock::FindLargestUnmarkedRange(): word span: %" B_PRIu32
", last index: %" B_PRIu32 ", start index: %" B_PRIu32 ", index: %"
B_PRIu32 ", bits: %" B_PRIx32 ", start: %" B_PRIu32 ", length: %"
B_PRIu32 "\n", wordSpan, fMaxIndex, startIndex, index, bits, start,
length);
if (wordSpan == 0) {
@@ -390,7 +399,8 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length)
start = startPos;
length = newLength;
TRACE("BitmapBlock::FindLargestUnmarkedRange(): Found "
"larger length %lu starting at %lu\n", length, start);
"larger length %" B_PRIu32 " starting at %" B_PRIu32
"\n", length, start);
}
startPos = endPos;
@@ -442,8 +452,9 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length)
wordSpan = length >> 5;
TRACE("BitmapBlock::FindLargestUnmarkedRange(): Found "
"larger length %lu starting at %lu; word span: "
"%lu\n", length, start, wordSpan);
"larger length %" B_PRIu32 " starting at %" B_PRIu32
"; word span: %" B_PRIu32 "\n", length, start,
wordSpan);
}
}
@@ -458,15 +469,16 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length)
uint32 newStart = (startIndex + 1) << 5;
TRACE("BitmapBlock::FindLargestUnmarkedRange(): Possibly found a "
"larger range. index: %lu, start index: %lu, word span: %lu, "
"new length: %lu, new start: %lu\n", index, startIndex, wordSpan,
"larger range. index: %" B_PRIu32 ", start index: %" B_PRIu32
", word span: %" B_PRIu32 ", new length: %" B_PRIu32
", new start: %" B_PRIu32 "\n", index, startIndex, wordSpan,
newLength, newStart);
if (newStart != 0) {
uint32 startBits = B_LENDIAN_TO_HOST_INT32(data[startIndex]);
TRACE("BitmapBlock::FindLargestUnmarkedRange(): start bits: %lu\n",
startBits);
TRACE("BitmapBlock::FindLargestUnmarkedRange(): start bits: %"
B_PRIu32 "\n", startBits);
for (int32 bit = 31; bit >= 0; --bit) {
if ((startBits >> bit & 1) != 0)
@@ -477,7 +489,8 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length)
}
TRACE("BitmapBlock::FindLargestUnmarkedRange(): updated new start "
"to %lu and new length to %lu\n", newStart, newLength);
"to %" B_PRIu32 " and new length to %" B_PRIu32 "\n", newStart,
newLength);
}
for (int32 bit = 0; bit < 32; ++bit) {
@@ -488,13 +501,14 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length)
}
TRACE("BitmapBlock::FindLargestUnmarkedRange(): updated new length to "
"%lu\n", newLength);
"%" B_PRIu32 "\n", newLength);
if (newLength > length) {
start = newStart;
length = newLength;
TRACE("BitmapBlock::FindLargestUnmarkedRange(): Found "
"largest length %lu starting at %lu\n", length, start);
"largest length %" B_PRIu32 " starting at %" B_PRIu32 "\n",
length, start);
}
}
}
@@ -136,7 +136,7 @@ AllocationBlockGroup::Initialize(Volume* volume, uint32 blockGroup,
fFreeBits = fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature());
fLargestLength = fFreeBits;
fLargestStart = _FirstFreeBlock();
TRACE("Group %ld is uninit\n", fBlockGroup);
TRACE("Group %" B_PRIu32 " is uninit\n", fBlockGroup);
return B_OK;
}
@@ -146,11 +146,11 @@ AllocationBlockGroup::Initialize(Volume* volume, uint32 blockGroup,
if (fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature())
!= fFreeBits) {
ERROR("AllocationBlockGroup(%lu,%lld)::Initialize(): Mismatch between "
"counted free blocks (%lu/%lu) and what is set on the group "
"descriptor (%lu)\n", fBlockGroup, fBitmapBlock, fFreeBits,
fNumBits, fGroupDescriptor->FreeBlocks(
fVolume->Has64bitFeature()));
ERROR("AllocationBlockGroup(%" B_PRIu32 ",%" B_PRIu64 ")::Initialize()"
": Mismatch between counted free blocks (%" B_PRIu32 "/%" B_PRIu32
") and what is set on the group descriptor (%" B_PRIu32 ")\n",
fBlockGroup, fBitmapBlock, fFreeBits, fNumBits,
fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature()));
return B_BAD_DATA;
}
@@ -166,7 +166,7 @@ AllocationBlockGroup::Initialize(Volume* volume, uint32 blockGroup,
status_t
AllocationBlockGroup::_ScanFreeRanges()
{
TRACE("AllocationBlockGroup::_ScanFreeRanges() for group %ld\n",
TRACE("AllocationBlockGroup::_ScanFreeRanges() for group %" B_PRIu32 "\n",
fBlockGroup);
BitmapBlock block(fVolume, fNumBits);
@@ -206,7 +206,8 @@ AllocationBlockGroup::Allocate(Transaction& transaction, fsblock_t _start,
uint32 length)
{
uint32 start = _start - fStart;
TRACE("AllocationBlockGroup::Allocate(%ld,%ld)\n", start, length);
TRACE("AllocationBlockGroup::Allocate(%" B_PRIu32 ",%" B_PRIu32 ")\n",
start, length);
if (length == 0)
return B_OK;
@@ -222,13 +223,13 @@ AllocationBlockGroup::Allocate(Transaction& transaction, fsblock_t _start,
if (!block.SetToWritable(transaction, fBitmapBlock))
return B_ERROR;
TRACE("AllocationBlockGroup::Allocate(): Largest range in %lu-%lu\n",
fLargestStart, fLargestStart + fLargestLength);
TRACE("AllocationBlockGroup::Allocate(): Largest range in %" B_PRIu32 "-%"
B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength);
ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength));
if (!block.Mark(start, length)) {
ERROR("Failed to allocate blocks from %lu to %lu. Some were "
"already allocated.\n", start, start + length);
ERROR("Failed to allocate blocks from %" B_PRIu32 " to %" B_PRIu32
". Some were already allocated.\n", start, start + length);
return B_ERROR;
}
@@ -261,8 +262,8 @@ AllocationBlockGroup::Allocate(Transaction& transaction, fsblock_t _start,
return B_OK;
}
TRACE("AllocationBlockGroup::Allocate(): Largest range in %lu-%lu\n",
fLargestStart, fLargestStart + fLargestLength);
TRACE("AllocationBlockGroup::Allocate(): Largest range in %" B_PRIu32 "-%"
B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength);
ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength));
if (fLargestLength < fNumBits / 2)
@@ -277,8 +278,8 @@ status_t
AllocationBlockGroup::Free(Transaction& transaction, uint32 start,
uint32 length)
{
TRACE("AllocationBlockGroup::Free(): start: %lu, length %lu\n", start,
length);
TRACE("AllocationBlockGroup::Free(): start: %" B_PRIu32 ", length %"
B_PRIu32 "\n", start, length);
if (length == 0)
return B_OK;
@@ -296,13 +297,13 @@ AllocationBlockGroup::Free(Transaction& transaction, uint32 start,
if (!block.SetToWritable(transaction, fBitmapBlock))
return B_ERROR;
TRACE("AllocationBlockGroup::Free(): Largest range in %lu-%lu\n",
fLargestStart, fLargestStart + fLargestLength);
TRACE("AllocationBlockGroup::Free(): Largest range in %" B_PRIu32 "-%"
B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength);
ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength));
if (!block.Unmark(start, length)) {
ERROR("Failed to free blocks from %lu to %lu. Some were "
"already freed.\n", start, start + length);
ERROR("Failed to free blocks from %" B_PRIu32 " to %" B_PRIu32
". Some were already freed.\n", start, start + length);
return B_ERROR;
}
@@ -331,8 +332,8 @@ AllocationBlockGroup::Free(Transaction& transaction, uint32 start,
}
}
TRACE("AllocationBlockGroup::Free(): Largest range in %lu-%lu\n",
fLargestStart, fLargestStart + fLargestLength);
TRACE("AllocationBlockGroup::Free(): Largest range in %" B_PRIu32 "-%"
B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength);
ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength));
fFreeBits += length;
@@ -445,11 +446,11 @@ AllocationBlockGroup::_InitGroup(Transaction& transaction)
if (fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature())
!= fFreeBits) {
ERROR("AllocationBlockGroup(%lu,%lld)::_InitGroup(): Mismatch between "
"counted free blocks (%lu/%lu) and what is set on the group "
"descriptor (%lu)\n", fBlockGroup, fBitmapBlock, fFreeBits,
fNumBits, fGroupDescriptor->FreeBlocks(
fVolume->Has64bitFeature()));
ERROR("AllocationBlockGroup(%" B_PRIu32 ",%" B_PRIu64 ")::_InitGroup()"
": Mismatch between counted free blocks (%" B_PRIu32 "/%" B_PRIu32
") and what is set on the group descriptor (%" B_PRIu32 ")\n",
fBlockGroup, fBitmapBlock, fFreeBits, fNumBits,
fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature()));
return B_BAD_DATA;
}
@@ -561,9 +562,10 @@ BlockAllocator::Initialize()
fFirstBlock = fVolume->FirstDataBlock();
fNumBlocks = fVolume->NumBlocks();
TRACE("BlockAllocator::Initialize(): blocks per group: %lu, block groups: "
"%lu, first block: %llu, num blocks: %llu\n", fBlocksPerGroup,
fNumGroups, fFirstBlock, fNumBlocks);
TRACE("BlockAllocator::Initialize(): blocks per group: %" B_PRIu32
", block groups: %" B_PRIu32 ", first block: %" B_PRIu64
", num blocks: %" B_PRIu64 "\n", fBlocksPerGroup, fNumGroups,
fFirstBlock, fNumBlocks);
fGroups = new(std::nothrow) AllocationBlockGroup[fNumGroups];
if (fGroups == NULL)
@@ -597,9 +599,10 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum,
MutexLocker lock(fLock);
TRACE("BlockAllocator::AllocateBlocks(): Acquired lock\n");
TRACE("BlockAllocator::AllocateBlocks(): transaction: %ld, min: %lu, "
"max: %lu, block group: %lu, start: %llu, num groups: %lu\n",
transaction.ID(), minimum, maximum, blockGroup, start, fNumGroups);
TRACE("BlockAllocator::AllocateBlocks(): transaction: %" B_PRId32 ", min: "
"%" B_PRIu32 ", max: %" B_PRIu32 ", block group: %" B_PRIu32 ", start:"
" %" B_PRIu64 ", num groups: %" B_PRIu32 "\n", transaction.ID(),
minimum, maximum, blockGroup, start, fNumGroups);
fsblock_t bestStart = 0;
uint32 bestLength = 0;
@@ -612,8 +615,9 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum,
for (int32 iterations = 0; iterations < 2; iterations++) {
for (; group < last; ++group, ++groupNum) {
TRACE("BlockAllocator::AllocateBlocks(): Group %lu has largest "
"length of %lu\n", groupNum, group->LargestLength());
TRACE("BlockAllocator::AllocateBlocks(): Group %" B_PRIu32
" has largest length of %" B_PRIu32 "\n", groupNum,
group->LargestLength());
if (group->LargestLength() > bestLength) {
if (start <= group->LargestStart()) {
@@ -622,8 +626,9 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum,
bestGroup = groupNum;
TRACE("BlockAllocator::AllocateBlocks(): Found a better "
"range: block group: %lu, %llu-%llu\n", groupNum,
bestStart, bestStart + bestLength);
"range: block group: %" B_PRIu32 ", %" B_PRIu64 "-%"
B_PRIu64 "\n", groupNum, bestStart,
bestStart + bestLength);
if (bestLength >= maximum)
break;
@@ -643,22 +648,24 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum,
}
if (bestLength < minimum) {
TRACE("BlockAllocator::AllocateBlocks(): best range (length %lu) "
"doesn't have minimum length of %lu\n", bestLength, minimum);
TRACE("BlockAllocator::AllocateBlocks(): best range (length %" B_PRIu32
") doesn't have minimum length of %" B_PRIu32 "\n", bestLength,
minimum);
return B_DEVICE_FULL;
}
if (bestLength > maximum)
bestLength = maximum;
TRACE("BlockAllocator::AllocateBlocks(): Selected range: block group %lu, "
"%llu-%llu\n", bestGroup, bestStart, bestStart + bestLength);
TRACE("BlockAllocator::AllocateBlocks(): Selected range: block group %"
B_PRIu32 ", %" B_PRIu64 "-%" B_PRIu64 "\n", bestGroup, bestStart,
bestStart + bestLength);
status_t status = fGroups[bestGroup].Allocate(transaction, bestStart,
bestLength);
if (status != B_OK) {
TRACE("BlockAllocator::AllocateBlocks(): Failed to allocate %lu blocks "
"inside block group %lu.\n", bestLength, bestGroup);
TRACE("BlockAllocator::AllocateBlocks(): Failed to allocate %" B_PRIu32
" blocks inside block group %" B_PRIu32 ".\n", bestLength, bestGroup);
return status;
}
@@ -753,7 +760,8 @@ BlockAllocator::Allocate(Transaction& transaction, Inode* inode,
status_t
BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length)
{
TRACE("BlockAllocator::Free(%llu, %lu)\n", start, length);
TRACE("BlockAllocator::Free(%" B_PRIu64 ", %" B_PRIu32 ")\n", start,
length);
MutexLocker lock(fLock);
if (start <= fFirstBlock) {
@@ -766,16 +774,16 @@ BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length)
if (start > fNumBlocks || length > fNumBlocks)
return B_BAD_VALUE;
TRACE("BlockAllocator::Free(): first block: %llu, blocks per group: %lu\n",
fFirstBlock, fBlocksPerGroup);
TRACE("BlockAllocator::Free(): first block: %" B_PRIu64
", blocks per group: %" B_PRIu32 "\n", fFirstBlock, fBlocksPerGroup);
start -= fFirstBlock;
off_t end = start + length - 1;
uint32 group = start / fBlocksPerGroup;
if (group >= fNumGroups) {
panic("BlockAllocator::Free() group %ld too big (fNumGroups %ld)\n",
group, fNumGroups);
panic("BlockAllocator::Free() group %" B_PRIu32 " too big (fNumGroups "
"%" B_PRIu32 ")\n", group, fNumGroups);
}
uint32 lastGroup = end / fBlocksPerGroup;
start = start % fBlocksPerGroup;
@@ -783,7 +791,8 @@ BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length)
if (group == lastGroup)
return fGroups[group].Free(transaction, start, length);
TRACE("BlockAllocator::Free(): Freeing from group %lu: %llu, %llu\n", group,
TRACE("BlockAllocator::Free(): Freeing from group %" B_PRIu32 ": %"
B_PRIu64 ", %" B_PRIu64 "\n", group,
start, fGroups[group].NumBits() - start);
status_t status = fGroups[group].Free(transaction, start,
@@ -792,14 +801,15 @@ BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length)
return status;
for (++group; group < lastGroup; ++group) {
TRACE("BlockAllocator::Free(): Freeing all from group %lu\n", group);
TRACE("BlockAllocator::Free(): Freeing all from group %" B_PRIu32 "\n",
group);
status = fGroups[group].FreeAll(transaction);
if (status != B_OK)
return status;
}
TRACE("BlockAllocator::Free(): Freeing from group %lu: 0-%llu \n", group,
end % fBlocksPerGroup);
TRACE("BlockAllocator::Free(): Freeing from group %" B_PRIu32 ": 0-%"
B_PRIu64 " \n", group, end % fBlocksPerGroup);
return fGroups[group].Free(transaction, 0, (end + 1) % fBlocksPerGroup);
}
@@ -815,7 +825,8 @@ BlockAllocator::_Initialize(BlockAllocator* allocator)
uint32 numGroups = allocator->fNumGroups - 1;
off_t freeBlocks = 0;
TRACE("BlockAllocator::_Initialize(): free blocks: %llu\n", freeBlocks);
TRACE("BlockAllocator::_Initialize(): free blocks: %" B_PRIdOFF "\n",
freeBlocks);
for (uint32 i = 0; i < numGroups; ++i) {
status_t status = groups[i].Initialize(volume, i,
@@ -826,7 +837,8 @@ BlockAllocator::_Initialize(BlockAllocator* allocator)
}
freeBlocks += groups[i].FreeBits();
TRACE("BlockAllocator::_Initialize(): free blocks: %llu\n", freeBlocks);
TRACE("BlockAllocator::_Initialize(): free blocks: %" B_PRIdOFF "\n",
freeBlocks);
}
// Last block group may have less blocks
@@ -840,13 +852,15 @@ BlockAllocator::_Initialize(BlockAllocator* allocator)
freeBlocks += groups[numGroups].FreeBits();
TRACE("BlockAllocator::_Initialize(): free blocks: %llu\n", freeBlocks);
TRACE("BlockAllocator::_Initialize(): free blocks: %" B_PRIdOFF "\n",
freeBlocks);
mutex_unlock(&allocator->fLock);
if (freeBlocks != volume->NumFreeBlocks()) {
TRACE("Counted free blocks (%llu) doesn't match value in the "
"superblock (%llu).\n", freeBlocks, volume->NumFreeBlocks());
TRACE("Counted free blocks (%" B_PRIdOFF ") doesn't match value in the"
" superblock (%" B_PRIdOFF ").\n", freeBlocks,
volume->NumFreeBlocks());
return B_BAD_DATA;
}
@@ -170,8 +170,8 @@ DataStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
return B_ERROR;
}
TRACE("inode %Ld: FindBlock(offset %lld): %lld %ld\n", ID(), offset, block,
_count != NULL ? *_count : 1);
TRACE("FindBlock(offset %" B_PRIdOFF "): %" B_PRIu64" %" B_PRIu32 "\n", offset,
block, _count != NULL ? *_count : 1);
return B_OK;
}
@@ -179,8 +179,8 @@ DataStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
status_t
DataStream::Enlarge(Transaction& transaction, off_t& numBlocks)
{
TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n",
fNumBlocks, numBlocks);
TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF ", target size: %"
B_PRIdOFF "\n", fNumBlocks, numBlocks);
off_t targetBlocks = numBlocks;
fWaiting = _BlocksNeeded(numBlocks);
@@ -196,15 +196,15 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks)
return status;
}
TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n",
fNumBlocks, targetBlocks);
TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF
", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks);
if (fNumBlocks == targetBlocks)
return B_OK;
}
TRACE("DataStream::Enlarge(): indirect current size: %llu, target size: %llu\n",
fNumBlocks, targetBlocks);
TRACE("DataStream::Enlarge(): indirect current size: %" B_PRIdOFF
", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks);
if (fNumBlocks <= kMaxIndirect) {
status = _AddForIndirectBlock(transaction, targetBlocks);
@@ -214,15 +214,15 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks)
return status;
}
TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n",
fNumBlocks, targetBlocks);
TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF
", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks);
if (fNumBlocks == targetBlocks)
return B_OK;
}
TRACE("DataStream::Enlarge(): indirect2 current size: %llu, target size: %llu\n",
fNumBlocks, targetBlocks);
TRACE("DataStream::Enlarge(): indirect2 current size: %" B_PRIdOFF
", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks);
if (fNumBlocks <= kMaxDoubleIndirect) {
status = _AddForDoubleIndirectBlock(transaction, targetBlocks);
@@ -232,18 +232,18 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks)
return status;
}
TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n",
fNumBlocks, targetBlocks);
TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF
", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks);
if (fNumBlocks == targetBlocks)
return B_OK;
}
TRACE("DataStream::Enlarge(): indirect3 current size: %llu, target size: %llu\n",
fNumBlocks, targetBlocks);
TRACE("DataStream::Enlarge(): indirect3 current size: %" B_PRIdOFF
", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks);
TRACE("DataStream::Enlarge(): allocated: %lu, waiting: %lu\n", fAllocated,
fWaiting);
TRACE("DataStream::Enlarge(): allocated: %" B_PRIu32 ", waiting: %"
B_PRIu32 "\n", fAllocated, fWaiting);
return _AddForTripleIndirectBlock(transaction, targetBlocks);
}
@@ -252,8 +252,8 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks)
status_t
DataStream::Shrink(Transaction& transaction, off_t& numBlocks)
{
TRACE("DataStream::Shrink(): current size: %llu, target size: %llu\n",
fNumBlocks, numBlocks);
TRACE("DataStream::Shrink(): current size: %" B_PRIdOFF ", target size: %"
B_PRIdOFF "\n", fNumBlocks, numBlocks);
fFreeStart = 0;
fFreeCount = 0;
@@ -329,7 +329,7 @@ DataStream::Shrink(Transaction& transaction, off_t& numBlocks)
uint32
DataStream::_BlocksNeeded(off_t numBlocks)
{
TRACE("DataStream::BlocksNeeded(): num blocks %llu\n", numBlocks);
TRACE("DataStream::BlocksNeeded(): num blocks %" B_PRIdOFF "\n", numBlocks);
off_t blocksNeeded = 0;
if (numBlocks > fNumBlocks) {
@@ -363,7 +363,7 @@ DataStream::_BlocksNeeded(off_t numBlocks)
}
}
TRACE("DataStream::BlocksNeeded(): %llu\n", blocksNeeded);
TRACE("DataStream::BlocksNeeded(): %" B_PRIdOFF "\n", blocksNeeded);
return blocksNeeded;
}
@@ -371,8 +371,8 @@ DataStream::_BlocksNeeded(off_t numBlocks)
status_t
DataStream::_GetBlock(Transaction& transaction, uint32& blockNum)
{
TRACE("DataStream::_GetBlock(): allocated: %lu, pos: %llu, waiting: %lu\n",
fAllocated, fAllocatedPos, fWaiting);
TRACE("DataStream::_GetBlock(): allocated: %" B_PRIu32 ", pos: %" B_PRIu64
", waiting: %" B_PRIu32 "\n", fAllocated, fAllocatedPos, fWaiting);
if (fAllocated == 0) {
uint32 blockGroup = (fAllocatedPos - fFirstBlock)
@@ -387,8 +387,9 @@ DataStream::_GetBlock(Transaction& transaction, uint32& blockNum)
fWaiting -= fAllocated;
TRACE("DataStream::_GetBlock(): newAllocated: %lu, newpos: %llu,"
"newwaiting: %lu\n", fAllocated, fAllocatedPos, fWaiting);
TRACE("DataStream::_GetBlock(): newAllocated: %" B_PRIu32 ", newpos: %"
B_PRIu64 ", newwaiting: %" B_PRIu32 "\n", fAllocated,
fAllocatedPos, fWaiting);
}
fAllocated--;
@@ -408,7 +409,8 @@ DataStream::_PrepareBlock(Transaction& transaction, uint32* pos,
if (blockNum == 0) {
status_t status = _GetBlock(transaction, blockNum);
if (status != B_OK) {
ERROR("DataStream::_PrepareBlock() _GetBlock() failed blockNum %ld\n", blockNum);
ERROR("DataStream::_PrepareBlock() _GetBlock() failed blockNum %"
B_PRIu32 "\n", blockNum);
return status;
}
@@ -424,7 +426,7 @@ status_t
DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t _count)
{
off_t count = _count;
TRACE("DataStream::_AddBlocks(): count: %llu\n", count);
TRACE("DataStream::_AddBlocks(): count: %" B_PRIdOFF "\n", count);
while (count > 0) {
uint32 blockNum;
@@ -446,8 +448,8 @@ status_t
DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t start,
off_t end, int recursion)
{
TRACE("DataStream::_AddBlocks(): start: %llu, end %llu, recursion: %d\n",
start, end, recursion);
TRACE("DataStream::_AddBlocks(): start: %" B_PRIdOFF ", end %" B_PRIdOFF
", recursion: %d\n", start, end, recursion);
bool clear;
uint32 blockNum;
@@ -477,8 +479,8 @@ DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t start,
uint32 elementPos = start / elementWidth;
uint32 endPos = end / elementWidth;
TRACE("DataStream::_AddBlocks(): element pos: %lu, end pos: %lu\n",
elementPos, endPos);
TRACE("DataStream::_AddBlocks(): element pos: %" B_PRIu32 ", end pos: %"
B_PRIu32 "\n", elementPos, endPos);
recursion--;
@@ -525,8 +527,8 @@ DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t start,
status_t
DataStream::_AddForDirectBlocks(Transaction& transaction, uint32 numBlocks)
{
TRACE("DataStream::_AddForDirectBlocks(): current size: %llu, target size: "
"%lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_AddForDirectBlocks(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32* direct = &fStream->direct[fNumBlocks];
uint32 end = numBlocks > kMaxDirect ? kMaxDirect : numBlocks;
@@ -537,8 +539,8 @@ DataStream::_AddForDirectBlocks(Transaction& transaction, uint32 numBlocks)
status_t
DataStream::_AddForIndirectBlock(Transaction& transaction, uint32 numBlocks)
{
TRACE("DataStream::_AddForIndirectBlocks(): current size: %llu, target "
"size: %lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_AddForIndirectBlocks(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32 *indirect = &fStream->indirect;
uint32 start = fNumBlocks - kMaxDirect;
uint32 end = numBlocks - kMaxDirect;
@@ -554,8 +556,8 @@ status_t
DataStream::_AddForDoubleIndirectBlock(Transaction& transaction,
uint32 numBlocks)
{
TRACE("DataStream::_AddForDoubleIndirectBlock(): current size: %llu, "
"target size: %lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_AddForDoubleIndirectBlock(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32 *doubleIndirect = &fStream->double_indirect;
uint32 start = fNumBlocks - kMaxIndirect;
uint32 end = numBlocks - kMaxIndirect;
@@ -571,8 +573,8 @@ status_t
DataStream::_AddForTripleIndirectBlock(Transaction& transaction,
uint32 numBlocks)
{
TRACE("DataStream::_AddForTripleIndirectBlock(): current size: %llu, "
"target size: %lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_AddForTripleIndirectBlock(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32 *tripleIndirect = &fStream->triple_indirect;
uint32 start = fNumBlocks - kMaxDoubleIndirect;
uint32 end = numBlocks - kMaxDoubleIndirect;
@@ -584,8 +586,8 @@ DataStream::_AddForTripleIndirectBlock(Transaction& transaction,
status_t
DataStream::_PerformFree(Transaction& transaction)
{
TRACE("DataStream::_PerformFree(): start: %lu, count: %lu\n", fFreeStart,
fFreeCount);
TRACE("DataStream::_PerformFree(): start: %" B_PRIu32 ", count: %" B_PRIu32
"\n", fFreeStart, fFreeCount);
status_t status;
if (fFreeCount == 0)
@@ -604,9 +606,9 @@ status_t
DataStream::_MarkBlockForRemoval(Transaction& transaction, uint32* block)
{
TRACE("DataStream::_MarkBlockForRemoval(*(%p) = %lu): free start: %lu, "
"free count: %lu\n", block, B_LENDIAN_TO_HOST_INT32(*block),
fFreeStart, fFreeCount);
TRACE("DataStream::_MarkBlockForRemoval(*(%p) = %" B_PRIu32
"): free start: %" B_PRIu32 ", free count: %" B_PRIu32 "\n", block,
B_LENDIAN_TO_HOST_INT32(*block), fFreeStart, fFreeCount);
uint32 blockNum = B_LENDIAN_TO_HOST_INT32(*block);
*block = 0;
@@ -632,7 +634,7 @@ status_t
DataStream::_FreeBlocks(Transaction& transaction, uint32* block, uint32 _count)
{
uint32 count = _count;
TRACE("DataStream::_FreeBlocks(%p, %lu)\n", block, count);
TRACE("DataStream::_FreeBlocks(%p, %" B_PRIu32 ")\n", block, count);
while (count > 0) {
status_t status = _MarkBlockForRemoval(transaction, block);
@@ -654,8 +656,8 @@ DataStream::_FreeBlocks(Transaction& transaction, uint32* block, off_t start,
off_t end, bool freeParent, int recursion)
{
// TODO: Designed specifically for shrinking. Perhaps make it more general?
TRACE("DataStream::_FreeBlocks(%p, %llu, %llu, %c, %d)\n",
block, start, end, freeParent ? 't' : 'f', recursion);
TRACE("DataStream::_FreeBlocks(%p, %" B_PRIdOFF ", %" B_PRIdOFF
", %c, %d)\n", block, start, end, freeParent ? 't' : 'f', recursion);
uint32 blockNum = B_LENDIAN_TO_HOST_INT32(*block);
@@ -726,8 +728,8 @@ DataStream::_FreeBlocks(Transaction& transaction, uint32* block, off_t start,
status_t
DataStream::_RemoveFromDirectBlocks(Transaction& transaction, uint32 numBlocks)
{
TRACE("DataStream::_RemoveFromDirectBlocks(): current size: %llu, "
"target size: %lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_RemoveFromDirectBlocks(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32* direct = &fStream->direct[numBlocks];
off_t end = fNumBlocks > kMaxDirect ? kMaxDirect : fNumBlocks;
@@ -738,8 +740,8 @@ DataStream::_RemoveFromDirectBlocks(Transaction& transaction, uint32 numBlocks)
status_t
DataStream::_RemoveFromIndirectBlock(Transaction& transaction, uint32 numBlocks)
{
TRACE("DataStream::_RemoveFromIndirectBlock(): current size: %llu, "
"target size: %lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_RemoveFromIndirectBlock(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32* indirect = &fStream->indirect;
off_t start = numBlocks <= kMaxDirect ? 0 : numBlocks - kMaxDirect;
off_t end = fNumBlocks - kMaxDirect;
@@ -757,8 +759,8 @@ status_t
DataStream::_RemoveFromDoubleIndirectBlock(Transaction& transaction,
uint32 numBlocks)
{
TRACE("DataStream::_RemoveFromDoubleIndirectBlock(): current size: %llu, "
"target size: %lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_RemoveFromDoubleIndirectBlock(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32* doubleIndirect = &fStream->double_indirect;
off_t start = numBlocks <= kMaxIndirect ? 0 : numBlocks - kMaxIndirect;
off_t end = fNumBlocks - kMaxIndirect;
@@ -776,8 +778,8 @@ status_t
DataStream::_RemoveFromTripleIndirectBlock(Transaction& transaction,
uint32 numBlocks)
{
TRACE("DataStream::_RemoveFromTripleIndirectBlock(): current size: %llu, "
"target size: %lu\n", fNumBlocks, numBlocks);
TRACE("DataStream::_RemoveFromTripleIndirectBlock(): current size: %" B_PRIdOFF
", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks);
uint32* tripleIndirect = &fStream->triple_indirect;
off_t start = numBlocks <= kMaxDoubleIndirect ? 0
: numBlocks - kMaxDoubleIndirect;
@@ -56,8 +56,8 @@ DirectoryIterator::DirectoryIterator(Inode* directory, off_t start,
fStartLogicalBlock(fLogicalBlock),
fStartDisplacement(fDisplacement)
{
TRACE("DirectoryIterator::DirectoryIterator() %lld: num blocks: %lu\n",
fDirectory->ID(), fNumBlocks);
TRACE("DirectoryIterator::DirectoryIterator() %" B_PRIdINO ": num blocks: "
"%" B_PRIu32 "\n", fDirectory->ID(), fNumBlocks);
fIndexing = parent != NULL;
fInitStatus = fDirectory->FindBlock(start, fPhysicalBlock);
fStartPhysicalBlock = fPhysicalBlock;
@@ -83,7 +83,7 @@ DirectoryIterator::InitCheck()
status_t
DirectoryIterator::Get(char* name, size_t* _nameLength, ino_t* _id)
{
TRACE("DirectoryIterator::Get() ID %lld\n", fDirectory->ID());
TRACE("DirectoryIterator::Get() ID %" B_PRIdINO "\n", fDirectory->ID());
if (_Offset() >= fDirectory->Size()) {
TRACE("DirectoryIterator::Get() out of entries\n");
return B_ENTRY_NOT_FOUND;
@@ -94,7 +94,8 @@ DirectoryIterator::Get(char* name, size_t* _nameLength, ino_t* _id)
if (block == NULL)
return B_IO_ERROR;
TRACE("DirectoryIterator::Get(): Displacement: %lu\n", fDisplacement);
TRACE("DirectoryIterator::Get(): Displacement: %" B_PRIu32 "\n",
fDisplacement);
const ext2_dir_entry* entry = (const ext2_dir_entry*)&block[fDisplacement];
if (entry->Length() == 0 || entry->InodeID() == 0)
@@ -103,9 +104,10 @@ DirectoryIterator::Get(char* name, size_t* _nameLength, ino_t* _id)
if (entry->NameLength() != 0) {
size_t length = entry->NameLength();
TRACE("block %lu, displacement %lu: entry ino %lu, length %u, "
"name length %lu, type %u\n", fLogicalBlock, fDisplacement,
entry->InodeID(), entry->Length(), length, entry->FileType());
TRACE("block %" B_PRIu32 ", displacement %" B_PRIu32 ": entry ino %"
B_PRIu32 ", length %u, name length %" B_PRIuSIZE ", type %u\n",
fLogicalBlock, fDisplacement, entry->InodeID(), entry->Length(),
length, entry->FileType());
if (*_nameLength > 0) {
if (length + 1 > *_nameLength)
@@ -141,7 +143,8 @@ DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id)
status_t
DirectoryIterator::Next()
{
TRACE("DirectoryIterator::Next() fDirectory->ID() %lld\n", fDirectory->ID());
TRACE("DirectoryIterator::Next() fDirectory->ID() %" B_PRIdINO "\n",
fDirectory->ID());
if (_Offset() >= fDirectory->Size()) {
TRACE("DirectoryIterator::Next() out of entries\n");
@@ -161,8 +164,9 @@ DirectoryIterator::Next()
entry = (ext2_dir_entry*)(block + fDisplacement);
do {
TRACE("Checking entry at block %llu, displacement %lu entry inodeid %ld\n", fPhysicalBlock,
fDisplacement, entry->InodeID());
TRACE("Checking entry at block %" B_PRIu64 ", displacement %" B_PRIu32
" entry inodeid %" B_PRIu32 "\n", fPhysicalBlock, fDisplacement,
entry->InodeID());
if (entry->Length() != 0) {
if (!entry->IsValid()) {
@@ -183,7 +187,7 @@ DirectoryIterator::Next()
if (status != B_OK)
return status;
if (_Offset() + ext2_dir_entry::MinimumSize()
if ((off_t)(_Offset() + ext2_dir_entry::MinimumSize())
>= fDirectory->Size()) {
TRACE("DirectoryIterator::Next() end of directory file\n");
return B_ENTRY_NOT_FOUND;
@@ -203,7 +207,8 @@ DirectoryIterator::Next()
entry = (ext2_dir_entry*)(block + fDisplacement);
TRACE("DirectoryIterator::Next() skipping entry %d %ld\n", entry->Length(), entry->InodeID());
TRACE("DirectoryIterator::Next() skipping entry %d %" B_PRIu32 "\n",
entry->Length(), entry->InodeID());
} while (entry->Length() == 0 || entry->InodeID() == 0);
TRACE("DirectoryIterator::Next() entry->Length() %d entry->name %*s\n",
@@ -228,7 +233,8 @@ void
DirectoryIterator::Restart()
{
TRACE("DirectoryIterator::Restart(): (logical, physical, displacement): "
"current: (%lu, %llu, %lu), start: (%lu, %llu, %lu)\n", fLogicalBlock,
"current: (%" B_PRIu32 ", %" B_PRIu64 ", %" B_PRIu32 "), start: (%"
B_PRIu32 ", %" B_PRIu64 ", %" B_PRIu32 ")\n", fLogicalBlock,
fPhysicalBlock, fDisplacement, fStartLogicalBlock, fStartPhysicalBlock,
fStartDisplacement);
fLogicalBlock = fStartLogicalBlock;
@@ -365,7 +371,8 @@ DirectoryIterator::RemoveEntry(Transaction& transaction)
return B_OK;
}
TRACE("DirectoryIterator::RemoveEntry() fDisplacement %ld\n", fDisplacement);
TRACE("DirectoryIterator::RemoveEntry() fDisplacement %" B_PRIu32 "\n",
fDisplacement);
if (fPreviousDisplacement == fDisplacement) {
char buffer[EXT2_NAME_LENGTH + 1];
@@ -471,8 +478,9 @@ DirectoryIterator::_AddEntry(Transaction& transaction, const char* name,
uint8 nameLength, ino_t id, uint8 type, uint16 newLength, uint16 pos,
bool hasPrevious)
{
TRACE("DirectoryIterator::_AddEntry(%s, %d, %llu, %d, %d, %d, %c)\n",
name, nameLength, id, type, newLength, pos, hasPrevious ? 't' : 'f');
TRACE("DirectoryIterator::_AddEntry(%s, %d, %" B_PRIdINO ", %d, %d, %d, "
"%c)\n", name, nameLength, id, type, newLength, pos,
hasPrevious ? 't' : 'f');
CachedBlock cached(fVolume);
uint8* block = cached.SetToWritable(transaction, fPhysicalBlock);
@@ -507,8 +515,8 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction,
uint32 newBlocksPos, bool firstSplit)
{
// Block is full, split required
TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %llu, %lu, %c)\n",
name, nameLength, id, newBlocksPos,
TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %" B_PRIdINO ", %"
B_PRIu32 ", %c)\n", name, nameLength, id, newBlocksPos,
firstSplit ? 't' : 'f');
// Allocate a buffer for the entries in the block
@@ -598,14 +606,14 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction,
TRACE("DirectoryIterator::_SplitIndexedBlock(): pos: %p, name "
"length: %u, entry length: %u\n", entry.position,
(unsigned int)dirEntry->name_length,
(unsigned int)dirEntry->Length());
dirEntry->name_length,
dirEntry->Length());
char cbuffer[256];
memcpy(cbuffer, dirEntry->name, dirEntry->name_length);
cbuffer[dirEntry->name_length] = '\0';
entry.hash = htree.Hash(dirEntry->name, dirEntry->name_length);
TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %lu\n",
TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %" B_PRIu32 "\n",
cbuffer, entry.hash);
status = entrySet.Insert(entry);
@@ -630,7 +638,7 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction,
entry.position = (uint8*)&newEntry;
entry.hash = htree.Hash(name, nameLength);
TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %lu\n",
TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %" B_PRIu32 "\n",
name, entry.hash);
entrySet.Insert(entry);
@@ -639,8 +647,8 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction,
VectorSet<HashedEntry>::Iterator iterator = entrySet.Begin();
int32 median = entrySet.Count() / 2;
displacement = 0;
TRACE("DirectoryIterator::_SplitIndexedBlock(): Count: %ld, median: %ld\n",
entrySet.Count(), median);
TRACE("DirectoryIterator::_SplitIndexedBlock(): Count: %" B_PRId32
", median: %" B_PRId32 "\n", entrySet.Count(), median);
uint32 previousHash = (*iterator).hash;
@@ -49,7 +49,7 @@ status_t
ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
{
fileblock_t index = offset >> fVolume->BlockShift();
TRACE("FindBlock(%lld, %lld)\n", offset, index);
TRACE("FindBlock(%" B_PRIdOFF ", %" B_PRIu64 ")\n", offset, index);
if (offset >= fSize) {
TRACE("FindBlock: offset larger than inode size\n");
@@ -69,8 +69,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
&& stream->extent_index[i].LogicalBlock() <= index) {
i++;
}
TRACE("FindBlock() getting index %ld at %lld\n", i - 1,
stream->extent_index[i - 1].PhysicalBlock());
TRACE("FindBlock() getting index %" B_PRId32 " at %" B_PRIu64 "\n",
i - 1, stream->extent_index[i - 1].PhysicalBlock());
stream = (ext2_extent_stream *)cached.SetTo(
stream->extent_index[i - 1].PhysicalBlock());
if (!stream->extent_header.IsValid())
@@ -97,8 +97,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
- stream->extent_entries[middle].LogicalBlock();
if (diff > stream->extent_entries[middle].Length()) {
// sparse block
TRACE("FindBlock() sparse block index %lld at %ld\n", index,
stream->extent_entries[middle].LogicalBlock());
TRACE("FindBlock() sparse block index %" B_PRIu64 " at %" B_PRIu32
"\n", index, stream->extent_entries[middle].LogicalBlock());
block = 0xffffffff;
return B_OK;
}
@@ -106,16 +106,16 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
block = stream->extent_entries[middle].PhysicalBlock() + diff;
if (_count)
*_count = stream->extent_entries[middle].Length() - diff;
TRACE("FindBlock(offset %lld): %lld %ld\n", offset,
block, _count != NULL ? *_count : 1);
TRACE("FindBlock(offset %" B_PRIdOFF "): %" B_PRIu64 " %" B_PRIu32
"\n", offset, block, _count != NULL ? *_count : 1);
return B_OK;
}
for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) {
if (stream->extent_entries[i].LogicalBlock() > index) {
// sparse block
TRACE("FindBlock() sparse block index %lld at %ld\n", index,
stream->extent_entries[i].LogicalBlock());
TRACE("FindBlock() sparse block index %" B_PRIu64 " at %" B_PRIu32
"\n", index, stream->extent_entries[i].LogicalBlock());
block = 0xffffffff;
return B_OK;
}
@@ -124,8 +124,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
block = stream->extent_entries[i].PhysicalBlock() + diff;
if (_count)
*_count = stream->extent_entries[i].Length() - diff;
TRACE("FindBlock(offset %lld): %lld %ld\n", offset,
block, _count != NULL ? *_count : 1);
TRACE("FindBlock(offset %" B_PRIdOFF "): %" B_PRIu64 " %" B_PRIu32
"\n", offset, block, _count != NULL ? *_count : 1);
return B_OK;
}
}
@@ -137,8 +137,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count)
status_t
ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
{
TRACE("Enlarge(): current size: %llu, target size: %llu\n",
fNumBlocks, numBlocks);
TRACE("Enlarge(): current size: %" B_PRIdOFF ", target size: %" B_PRIdOFF
"\n", fNumBlocks, numBlocks);
off_t targetBlocks = numBlocks;
numBlocks = targetBlocks - fNumBlocks;
@@ -172,8 +172,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
panic("stream->extent_header.NumEntries() == 0\n");
int32 lastIndex = stream->extent_header.NumEntries() - 1;
TRACE("Enlarge() depth %d\n", stream->extent_header.Depth());
TRACE("Enlarge() getting index %ld at %lld\n", lastIndex,
stream->extent_index[lastIndex].PhysicalBlock());
TRACE("Enlarge() getting index %" B_PRId32 " at %" B_PRIu64 "\n",
lastIndex, stream->extent_index[lastIndex].PhysicalBlock());
path[++level] = stream->extent_index[lastIndex].PhysicalBlock();
stream = (ext2_extent_stream *)cached.SetTo(path[level]);
if (stream == NULL)
@@ -184,7 +184,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
if (stream->extent_header.NumEntries() > 0) {
ext2_extent_entry &last = stream->extent_entries[
stream->extent_header.NumEntries() - 1];
TRACE("Enlarge() last %lld allocatedPos %lld\n",
TRACE("Enlarge() last %" B_PRIu64 " allocatedPos %" B_PRIu64 "\n",
last.PhysicalBlock() + last.Length(), fAllocatedPos);
if (last.PhysicalBlock() + last.Length() == fAllocatedPos
&& (last.Length() + allocated) <= EXT2_EXTENT_MAX_LENGTH) {
@@ -205,8 +205,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
if (stream->extent_header.NumEntries()
>= stream->extent_header.MaxEntries()) {
TRACE("Enlarge() adding leaf and indexes at depth %d level %ld\n",
stream->extent_header.Depth(), level);
TRACE("Enlarge() adding leaf and indexes at depth %d level %"
B_PRId32 "\n", stream->extent_header.Depth(), level);
// try to add a leaf and indexes
while (--level >= 0) {
stream = (ext2_extent_stream *)cached.SetTo(path[level]);
@@ -216,7 +216,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
< stream->extent_header.MaxEntries()) {
break;
}
TRACE("Enlarge() going up from level %ld\n", level);
TRACE("Enlarge() going up from level %" B_PRId32 "\n", level);
}
if (level < 0 && fStream->extent_header.NumEntries()
@@ -231,7 +231,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
return status;
}
ASSERT(_CheckBlock(fStream, newBlock) == B_OK);
TRACE("Enlarge() move root to block %lld\n", newBlock);
TRACE("Enlarge() move root to block %" B_PRIu64 "\n",
newBlock);
numBlocks++;
stream = (ext2_extent_stream *)cached.SetToWritable(
transaction, newBlock);
@@ -277,7 +278,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
path[level++] = newBlock;
depth = stream->extent_header.Depth() - 1;
TRACE("Enlarge() init index block %lld at depth %d\n",
TRACE("Enlarge() init index block %" B_PRIu64 " at depth %d\n",
newBlock, depth);
stream = (ext2_extent_stream *)cached.SetToWritable(
transaction, newBlock);
@@ -293,12 +294,12 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
ASSERT(Check());
}
TRACE("Enlarge() depth %d level %ld\n",
TRACE("Enlarge() depth %d level %" B_PRId32 "\n",
stream->extent_header.Depth(), level);
if (stream->extent_header.Depth() == 1) {
TRACE("Enlarge() adding an entry block at depth %d level %ld\n",
depth, level);
TRACE("Enlarge() adding an entry block at depth %d level %"
B_PRId32 "\n", depth, level);
fsblock_t newBlock;
if (level >= 0)
newBlock = path[level];
@@ -319,8 +320,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
stream->extent_index[index].SetPhysicalBlock(newBlock);
stream->extent_header.SetNumEntries(index + 1);
TRACE("Enlarge() init entry block %lld at depth %d\n",
newBlock, depth);
TRACE("Enlarge() init entry block %" B_PRIu64
" at depth %d\n", newBlock, depth);
stream = (ext2_extent_stream *)cached.SetToWritable(
transaction, newBlock);
if (stream == NULL)
@@ -336,7 +337,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
}
// add a new entry
TRACE("Enlarge() add entry %lld\n", fAllocatedPos);
TRACE("Enlarge() add entry %" B_PRIu64 "\n", fAllocatedPos);
if (stream != fStream) {
stream = (ext2_extent_stream *)cached.SetToWritable(
transaction, cached.BlockNumber());
@@ -348,7 +349,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
stream->extent_entries[index].SetLength(allocated);
stream->extent_entries[index].SetPhysicalBlock(fAllocatedPos);
stream->extent_header.SetNumEntries(index + 1);
TRACE("Enlarge() entry added at index %ld\n", index);
TRACE("Enlarge() entry added at index %" B_PRId32 "\n", index);
ASSERT(stream->extent_header.IsValid());
fNumBlocks += allocated;
@@ -362,8 +363,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks)
status_t
ExtentStream::Shrink(Transaction& transaction, off_t& numBlocks)
{
TRACE("DataStream::Shrink(): current size: %llu, target size: %llu\n",
fNumBlocks, numBlocks);
TRACE("DataStream::Shrink(): current size: %" B_PRIdOFF ", target size: %"
B_PRIdOFF "\n", fNumBlocks, numBlocks);
off_t targetBlocks = numBlocks;
numBlocks = fNumBlocks - targetBlocks;
@@ -380,8 +381,8 @@ ExtentStream::Shrink(Transaction& transaction, off_t& numBlocks)
panic("stream->extent_header.NumEntries() == 0\n");
int32 lastIndex = stream->extent_header.NumEntries() - 1;
TRACE("Shrink() depth %d\n", stream->extent_header.Depth());
TRACE("Shrink() getting index %ld at %lld\n", lastIndex,
stream->extent_index[lastIndex].PhysicalBlock());
TRACE("Shrink() getting index %" B_PRId32 " at %" B_PRIu64 "\n",
lastIndex, stream->extent_index[lastIndex].PhysicalBlock());
path[++level] = stream->extent_index[lastIndex].PhysicalBlock();
stream = (ext2_extent_stream *)cached.SetToWritable(transaction,
path[level]);
@@ -401,19 +402,20 @@ ExtentStream::Shrink(Transaction& transaction, off_t& numBlocks)
}
uint16 length = min_c(last.Length(), fNumBlocks - targetBlocks);
fsblock_t block = last.PhysicalBlock() + last.Length() - length;
TRACE("Shrink() free block %lld length %d\n", block, length);
TRACE("Shrink() free block %" B_PRIu64 " length %d\n", block,
length);
status = fVolume->FreeBlocks(transaction, block, length);
if (status != B_OK)
break;
fNumBlocks -= length;
stream->extent_entries[index].SetLength(last.Length() - length);
TRACE("Shrink() new length for %ld: %d\n", index, last.Length());
TRACE("Shrink() new length for %" B_PRId32 ": %d\n", index, last.Length());
if (last.Length() != 0)
break;
index--;
TRACE("Shrink() next index: %ld\n", index);
TRACE("Shrink() next index: %" B_PRId32 "\n", index);
}
TRACE("Shrink() new entry count: %ld\n", index + 1);
TRACE("Shrink() new entry count: %" B_PRId32 "\n", index + 1);
stream->extent_header.SetNumEntries(index + 1);
ASSERT(Check());
@@ -476,8 +478,8 @@ ExtentStream::_Check(ext2_extent_stream *stream, fileblock_t &block)
for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) {
ext2_extent_entry &entry = stream->extent_entries[i];
if (entry.LogicalBlock() < block) {
panic("_Check() entry %ld %lld %ld\n", i, block,
entry.LogicalBlock());
panic("_Check() entry %" B_PRId32 " %" B_PRIu64 " %" B_PRIu32
"\n", i, block, entry.LogicalBlock());
return B_BAD_VALUE;
}
block = entry.LogicalBlock() + entry.Length();
@@ -489,8 +491,8 @@ ExtentStream::_Check(ext2_extent_stream *stream, fileblock_t &block)
for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) {
ext2_extent_index &index = stream->extent_index[i];
if (index.LogicalBlock() < block) {
panic("_Check() index %ld %lld %ld\n", i, block,
index.LogicalBlock());
panic("_Check() index %" B_PRId32 " %" B_PRIu64 " %" B_PRIu32
"\n", i, block, index.LogicalBlock());
return B_BAD_VALUE;
}
ext2_extent_stream *child = (ext2_extent_stream *)cached.SetTo(
@@ -519,8 +521,9 @@ ExtentStream::_CheckBlock(ext2_extent_stream *stream, fsblock_t block)
ext2_extent_entry &entry = stream->extent_entries[i];
if (entry.PhysicalBlock() <= block
&& (entry.PhysicalBlock() + entry.Length()) > block) {
panic("_CheckBlock() entry %ld %lld %lld %d\n", i, block,
entry.PhysicalBlock(), entry.Length());
panic("_CheckBlock() entry %" B_PRId32 " %" B_PRIu64 " %"
B_PRIu64 " %d\n", i, block, entry.PhysicalBlock(),
entry.Length());
return B_BAD_VALUE;
}
}
@@ -531,7 +534,7 @@ ExtentStream::_CheckBlock(ext2_extent_stream *stream, fsblock_t block)
for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) {
ext2_extent_index &index = stream->extent_index[i];
if (index.PhysicalBlock() == block) {
panic("_CheckBlock() index %ld %lld\n", i, block);
panic("_CheckBlock() index %" B_PRId32 " %" B_PRIu64 "\n", i, block);
return B_BAD_VALUE;
}
ext2_extent_stream *child = (ext2_extent_stream *)cached.SetTo(
@@ -62,8 +62,8 @@ HTree::HTree(Volume* volume, Inode* directory)
fHashSeed[2] = superBlock.HashSeed(2);
fHashSeed[3] = superBlock.HashSeed(3);
TRACE("HTree::HTree() %lx %lx %lx %lx\n", fHashSeed[0],
fHashSeed[1], fHashSeed[2], fHashSeed[3]);
TRACE("HTree::HTree() %" B_PRIx32 " %" B_PRIx32 " %" B_PRIx32 " %" B_PRIx32
"\n", fHashSeed[0], fHashSeed[1], fHashSeed[2], fHashSeed[3]);
if (fHashSeed[0] == 0 && fHashSeed[1] == 0 && fHashSeed[2] == 0
&& fHashSeed[3] == 0) {
@@ -179,7 +179,7 @@ HTree::Hash(const char* name, uint8 length)
hash = 0;
#endif
TRACE("HTree::_Hash(): filename hash 0x%lX\n", hash);
TRACE("HTree::_Hash(): filename hash 0x%" B_PRIx32 "\n", hash);
return hash & ~1;
}
@@ -366,7 +366,8 @@ HTree::_HashTEA(const char* name, uint8 _length)
uint32 blocks[4];
_PrepareBlocksForHash(name, (uint32)length, blocks, 4);
TRACE("_HashTEA %lx %lx %lx\n", blocks[0], blocks[1], blocks[2]);
TRACE("_HashTEA %" B_PRIx32 " %" B_PRIx32 " %" B_PRIx32 "\n",
blocks[0], blocks[1], blocks[2]);
_TEATransform(buffer, blocks);
name += 16;
@@ -41,8 +41,8 @@ HTreeEntryIterator::HTreeEntryIterator(off_t offset, Inode* directory)
fCurrentEntry = fFirstEntry;
}
TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %llu, "
"entry no. %lu, parent: %p\n", this, fBlockNum, (uint32)fCurrentEntry,
TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %" B_PRIu64 ", "
"entry no. %u, parent: %p\n", this, fBlockNum, fCurrentEntry,
fParent);
}
@@ -63,16 +63,16 @@ HTreeEntryIterator::HTreeEntryIterator(uint32 block, uint32 blockSize,
// fCurrentEntry is initialized to 1 to skip the fake directory entry
fInitStatus = B_OK;
TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %lu, "
"parent: %p\n", this, block, fParent);
TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %"
B_PRIu32 ", parent: %p\n", this, block, fParent);
}
status_t
HTreeEntryIterator::Init()
{
TRACE("HTreeEntryIterator::Init() first entry: %lu\n",
(uint32)fFirstEntry);
TRACE("HTreeEntryIterator::Init() first entry: %u\n",
fFirstEntry);
if (fInitStatus != B_OK)
return fInitStatus;
@@ -99,15 +99,15 @@ HTreeEntryIterator::Init()
}
if (fLimit != fBlockSize / sizeof(HTreeEntry) - fFirstEntry) {
ERROR("HTreeEntryIterator::Init() bad fLimit %lu should be %lu "
"at block %llu\n", (uint32)fLimit, fBlockSize / sizeof(HTreeEntry)
- fFirstEntry, fBlockNum);
ERROR("HTreeEntryIterator::Init() bad fLimit %u should be %" B_PRIu32
" at block %" B_PRIu64 "\n", fLimit,
(uint32)(fBlockSize / sizeof(HTreeEntry) - fFirstEntry), fBlockNum);
fCount = fLimit = 0;
return B_ERROR;
}
TRACE("HTreeEntryIterator::Init() count %lu limit %lu\n",
(uint32)fCount, (uint32)fLimit);
TRACE("HTreeEntryIterator::Init() count %u limit %u\n",
fCount, fLimit);
return B_OK;
}
@@ -149,8 +149,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections,
HTreeEntry* end = (HTreeEntry*)block + fCount + fFirstEntry - 1;
HTreeEntry* middle = start;
TRACE("HTreeEntryIterator::Lookup() current entry: %lu\n",
(uint32)fCurrentEntry);
TRACE("HTreeEntryIterator::Lookup() current entry: %u\n",
fCurrentEntry);
TRACE("HTreeEntryIterator::Lookup() indirections: %d s:%p m:%p e:%p\n",
indirections, start, middle, end);
@@ -161,7 +161,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections,
TRACE("HTreeEntryIterator::Lookup() indirections: %d s:%p m:%p e:%p\n",
indirections, start, middle, end);
TRACE("HTreeEntryIterator::Lookup() %lx %lx\n", hash, middle->Hash());
TRACE("HTreeEntryIterator::Lookup() %" B_PRIx32 " %" B_PRIx32 "\n",
hash, middle->Hash());
if (hash >= middle->Hash())
start = middle + 1;
@@ -175,8 +176,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections,
if (indirections == 0) {
TRACE("HTreeEntryIterator::Lookup(): Creating an indexed directory "
"iterator starting at block: %lu, hash: 0x%lX\n", start->Block(),
start->Hash());
"iterator starting at block: %" B_PRIu32 ", hash: 0x%" B_PRIx32
"\n", start->Block(), start->Hash());
*directoryIterator = new(std::nothrow)
DirectoryIterator(fDirectory, start->Block() * fBlockSize, this);
@@ -188,7 +189,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections,
}
TRACE("HTreeEntryIterator::Lookup(): Creating a HTree entry iterator "
"starting at block: %lu, hash: 0x%lX\n", start->Block(), start->Hash());
"starting at block: %" B_PRIu32 ", hash: 0x%" B_PRIx32 "\n",
start->Block(), start->Hash());
fsblock_t blockNum;
status_t status = fDirectory->FindBlock(start->Block() * fBlockSize,
blockNum);
@@ -215,8 +217,8 @@ status_t
HTreeEntryIterator::GetNext(uint32& childBlock)
{
fCurrentEntry++;
TRACE("HTreeEntryIterator::GetNext(): current entry: %lu count: %lu, "
"limit: %lu\n", (uint32)fCurrentEntry, (uint32)fCount, (uint32)fLimit);
TRACE("HTreeEntryIterator::GetNext(): current entry: %u count: %u, "
"limit: %u\n", fCurrentEntry, fCount, fLimit);
bool endOfBlock = fCurrentEntry >= (fCount + fFirstEntry);
if (endOfBlock) {
@@ -231,8 +233,8 @@ HTreeEntryIterator::GetNext(uint32& childBlock)
if (status != B_OK)
return status;
TRACE("HTreeEntryIterator::GetNext(): moving to next block: %lu\n",
logicalBlock);
TRACE("HTreeEntryIterator::GetNext(): moving to next block: %" B_PRIx32
"\n", logicalBlock);
status = fDirectory->FindBlock(logicalBlock * fBlockSize, fBlockNum);
if (status != B_OK)
@@ -257,7 +259,7 @@ HTreeEntryIterator::GetNext(uint32& childBlock)
if (!endOfBlock)
fHasCollision = (entry[fCurrentEntry].Hash() & 1) == 1;
TRACE("HTreeEntryIterator::GetNext(): next block: %lu\n",
TRACE("HTreeEntryIterator::GetNext(): next block: %" B_PRIu32 "\n",
entry->Block());
childBlock = entry->Block();
@@ -269,8 +271,8 @@ HTreeEntryIterator::GetNext(uint32& childBlock)
uint32
HTreeEntryIterator::BlocksNeededForNewEntry()
{
TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %llu, "
"volume: %p\n", fBlockNum, fVolume);
TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %"
B_PRIu64 ", volume: %p\n", fBlockNum, fVolume);
CachedBlock cached(fVolume);
const uint8* blockData = cached.SetTo(fBlockNum);
@@ -305,7 +307,8 @@ status_t
HTreeEntryIterator::InsertEntry(Transaction& transaction, uint32 hash,
off_t blockNum, off_t newBlocksPos, bool hasCollision)
{
TRACE("HTreeEntryIterator::InsertEntry(): block num: %llu\n", fBlockNum);
TRACE("HTreeEntryIterator::InsertEntry(): block num: %" B_PRIu64 "\n",
fBlockNum);
CachedBlock cached(fVolume);
uint8* blockData = cached.SetToWritable(transaction, fBlockNum);
@@ -134,8 +134,8 @@ HashRevokeManager::Compare(void* _revoked, const void *_block)
/*static*/ uint32
HashRevokeManager::Hash(void* _revoked, const void* _block, uint32 range)
{
TRACE("HashRevokeManager::Hash(): revoked: %p, block: %p, range: %lu\n",
_revoked, _block, range);
TRACE("HashRevokeManager::Hash(): revoked: %p, block: %p, range: %"
B_PRIu32 "\n", _revoked, _block, range);
RevokeElement* revoked = (RevokeElement*)_revoked;
if (revoked != NULL)
@@ -161,8 +161,8 @@ HashRevokeManager::_ForceInsert(uint32 block, uint32 commitID)
if (retValue == B_OK) {
fRevokeCount++;
TRACE("HashRevokeManager::_ForceInsert(): revoke count: %lu\n",
fRevokeCount);
TRACE("HashRevokeManager::_ForceInsert(): revoke count: %" B_PRIu32
"\n", fRevokeCount);
}
return retValue;
+46 -34
View File
@@ -43,8 +43,8 @@ Inode::Inode(Volume* volume, ino_t id)
rw_lock_init(&fLock, "ext2 inode");
recursive_lock_init(&fSmallDataLock, "ext2 inode small data");
TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %lu\n",
sizeof(ext2_inode), fVolume->InodeSize());
TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %" B_PRIu32
"\n", sizeof(ext2_inode), fVolume->InodeSize());
fNodeSize = sizeof(ext2_inode) > fVolume->InodeSize()
? fVolume->InodeSize() : sizeof(ext2_inode);
@@ -78,7 +78,7 @@ Inode::Inode(Volume* volume)
rw_lock_init(&fLock, "ext2 inode");
recursive_lock_init(&fSmallDataLock, "ext2 inode small data");
TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %lu\n",
TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %" B_PRIu32 "\n",
sizeof(ext2_inode), fVolume->InodeSize());
fNodeSize = sizeof(ext2_inode) > fVolume->InodeSize()
? fVolume->InodeSize() : sizeof(ext2_inode);
@@ -138,15 +138,16 @@ Inode::WriteBack(Transaction& transaction)
if (inodeBlockData == NULL)
return B_IO_ERROR;
TRACE("Inode::WriteBack(): Inode ID: %lld, inode block: %llu, data: %p, "
"index: %lu, inode size: %lu, node size: %lu, this: %p, node: %p\n",
TRACE("Inode::WriteBack(): Inode ID: %" B_PRIdINO ", inode block: %"
B_PRIdOFF ", data: %p, index: %" B_PRIu32 ", inode size: %" B_PRIu32
", node size: %" B_PRIu32 ", this: %p, node: %p\n",
fID, blockNum, inodeBlockData, fVolume->InodeBlockIndex(fID),
fVolume->InodeSize(), fNodeSize, this, &fNode);
memcpy(inodeBlockData +
fVolume->InodeBlockIndex(fID) * fVolume->InodeSize(),
(uint8*)&fNode, fNodeSize);
TRACE("Inode::WriteBack() finished %ld\n", Node().stream.direct[0]);
TRACE("Inode::WriteBack() finished %" B_PRId32 "\n", Node().stream.direct[0]);
return B_OK;
}
@@ -161,7 +162,7 @@ Inode::UpdateNodeFromDisk()
if (status != B_OK)
return status;
TRACE("inode %lld at block %llu\n", fID, blockNum);
TRACE("inode %" B_PRIdINO " at block %" B_PRIdOFF "\n", fID, blockNum);
CachedBlock cached(fVolume);
const uint8* inodeBlock = cached.SetTo(blockNum);
@@ -169,13 +170,13 @@ Inode::UpdateNodeFromDisk()
if (inodeBlock == NULL)
return B_IO_ERROR;
TRACE("Inode size: %lu, inode index: %lu\n", fVolume->InodeSize(),
fVolume->InodeBlockIndex(fID));
TRACE("Inode size: %" B_PRIu32 ", inode index: %" B_PRIu32 "\n",
fVolume->InodeSize(), fVolume->InodeBlockIndex(fID));
ext2_inode* inode = (ext2_inode*)(inodeBlock
+ fVolume->InodeBlockIndex(fID) * fVolume->InodeSize());
TRACE("Attempting to copy inode data from %p to %p, ext2_inode "
"size: %lu\n", inode, &fNode, fNodeSize);
"size: %" B_PRIu32 "\n", inode, &fNode, fNodeSize);
memcpy(&fNode, inode, fNodeSize);
@@ -244,13 +245,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length)
// set/check boundaries for pos/length
if (pos < 0) {
ERROR("inode %lld: ReadAt failed(pos %lld, length %lu)\n", ID(), pos,
length);
ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF
", length %" B_PRIuSIZE ")\n", ID(), pos, length);
return B_BAD_VALUE;
}
if (pos >= Size() || length == 0) {
TRACE("inode %lld: ReadAt 0 (pos %lld, length %lu)\n", ID(), pos, length);
TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF ", length %"
B_PRIuSIZE ")\n", ID(), pos, length);
*_length = 0;
return B_NO_ERROR;
}
@@ -263,8 +265,8 @@ status_t
Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
size_t* _length)
{
TRACE("Inode::WriteAt(%lld, %p, *(%p) = %ld)\n", pos, buffer,
_length, *_length);
TRACE("Inode::WriteAt(%" B_PRIdOFF ", %p, *(%p) = %" B_PRIuSIZE ")\n", pos,
buffer, _length, *_length);
ReadLocker readLocker(fLock);
if (IsFileCacheDisabled())
@@ -296,9 +298,10 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
off_t end = pos + (off_t)length;
off_t oldSize = Size();
TRACE("Inode::WriteAt(): Old size: %x:%x, new size: %x:%x\n",
(int)(oldSize >> 32), (int)(oldSize & 0xFFFFFFFF),
(int)(end >> 32), (int)(end & 0xFFFFFFFF));
TRACE("Inode::WriteAt(): Old size: %" B_PRIdOFF ":%" B_PRIdOFF
", new size: %" B_PRIdOFF ":%" B_PRIdOFF "\n",
oldSize >> 32, oldSize & 0xFFFFFFFF,
end >> 32, end & 0xFFFFFFFF);
if (end > oldSize) {
status_t status = Resize(transaction, end);
@@ -326,9 +329,10 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
return B_OK;
}
TRACE("Inode::WriteAt(): Performing write: %p, %lld, %p, %ld\n",
FileCache(), pos, buffer, *_length);
status_t status = file_cache_write(FileCache(), NULL, pos, buffer, _length);
TRACE("Inode::WriteAt(): Performing write: %p, %" B_PRIdOFF ", %p, %"
B_PRIuSIZE "\n", FileCache(), pos, buffer, *_length);
status_t status = file_cache_write(FileCache(), NULL, pos, buffer,
_length);
WriteLockInTransaction(transaction);
@@ -341,7 +345,8 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
status_t
Inode::FillGapWithZeros(off_t start, off_t end)
{
TRACE("Inode::FileGapWithZeros(%lld - %lld)\n", start, end);
TRACE("Inode::FileGapWithZeros(%" B_PRIdOFF " - %" B_PRIdOFF ")\n", start,
end);
while (start < end) {
size_t size;
@@ -352,7 +357,8 @@ Inode::FillGapWithZeros(off_t start, off_t end)
size = end - start;
TRACE("Inode::FillGapWithZeros(): Calling file_cache_write(%p, NULL, "
"%lld, NULL, &(%ld) = %p)\n", fCache, start, size, &size);
"%" B_PRIdOFF ", NULL, &(%" B_PRIuSIZE ") = %p)\n", fCache, start,
size, &size);
status_t status = file_cache_write(fCache, NULL, start, NULL,
&size);
if (status != B_OK)
@@ -368,7 +374,8 @@ Inode::FillGapWithZeros(off_t start, off_t end)
status_t
Inode::Resize(Transaction& transaction, off_t size)
{
TRACE("Inode::Resize() ID:%lld size: %lld\n", ID(), size);
TRACE("Inode::Resize() ID:%" B_PRIdINO " size: %" B_PRIdOFF "\n", ID(),
size);
if (size < 0)
return B_BAD_VALUE;
@@ -377,7 +384,8 @@ Inode::Resize(Transaction& transaction, off_t size)
if (size == oldSize)
return B_OK;
TRACE("Inode::Resize(): old size: %lld, new size: %lld\n", oldSize, size);
TRACE("Inode::Resize(): old size: %" B_PRIdOFF ", new size: %" B_PRIdOFF
"\n", oldSize, size);
status_t status;
if (size > oldSize) {
@@ -397,7 +405,8 @@ Inode::Resize(Transaction& transaction, off_t size)
file_cache_set_size(FileCache(), size);
file_map_set_size(Map(), size);
TRACE("Inode::Resize(): Writing back inode changes. Size: %lld\n", Size());
TRACE("Inode::Resize(): Writing back inode changes. Size: %" B_PRIdOFF
"\n", Size());
return WriteBack(transaction);
}
@@ -451,7 +460,7 @@ status_t
Inode::Unlink(Transaction& transaction)
{
uint32 numLinks = fNode.NumLinks();
TRACE("Inode::Unlink(): Current links: %lu\n", numLinks);
TRACE("Inode::Unlink(): Current links: %" B_PRIu32 "\n", numLinks);
if (numLinks == 0)
return B_BAD_VALUE;
@@ -727,8 +736,8 @@ Inode::EnableFileCache()
return B_OK;
}
TRACE("Inode::EnableFileCache(): Creating file cache: %ld, %lld, %lld\n",
fVolume->ID(), ID(), Size());
TRACE("Inode::EnableFileCache(): Creating file cache: %" B_PRIu32 ", %"
B_PRIdINO ", %" B_PRIdOFF "\n", fVolume->ID(), ID(), Size());
fCache = file_cache_create(fVolume->ID(), ID(), Size());
fMap = file_map_create(fVolume->ID(), ID(), Size());
@@ -819,7 +828,8 @@ Inode::_EnlargeDataStream(Transaction& transaction, off_t size)
if (size <= maxSize) {
// No need to allocate more blocks
TRACE("Inode::_EnlargeDataStream(): No need to allocate more blocks\n");
TRACE("Inode::_EnlargeDataStream(): Setting size to %Ld\n", size);
TRACE("Inode::_EnlargeDataStream(): Setting size to %" B_PRIdOFF "\n",
size);
fNode.SetSize(size);
return B_OK;
}
@@ -833,10 +843,11 @@ Inode::_EnlargeDataStream(Transaction& transaction, off_t size)
DataStream stream(fVolume, &fNode.stream, oldSize);
stream.Enlarge(transaction, end);
}
TRACE("Inode::_EnlargeDataStream(): Setting size to %lld\n", size);
TRACE("Inode::_EnlargeDataStream(): Setting size to %" B_PRIdOFF "\n",
size);
fNode.SetSize(size);
TRACE("Inode::_EnlargeDataStream(): Setting allocated block count to %llu\n",
end);
TRACE("Inode::_EnlargeDataStream(): Setting allocated block count to %"
B_PRIdOFF "\n", end);
return _SetNumBlocks(_NumBlocks() + end * (fVolume->BlockSize() / 512));
}
@@ -858,7 +869,8 @@ Inode::_ShrinkDataStream(Transaction& transaction, off_t size)
if (size > minSize) {
// No need to allocate more blocks
TRACE("Inode::_ShrinkDataStream(): No need to allocate more blocks\n");
TRACE("Inode::_ShrinkDataStream(): Setting size to %lld\n", size);
TRACE("Inode::_ShrinkDataStream(): Setting size to %" B_PRIdOFF "\n",
size);
fNode.SetSize(size);
return B_OK;
}
+4 -4
View File
@@ -224,10 +224,10 @@ public:
status_t status = B_OK;
if (!inode->IsSymLink() && volume->ID() >= 0) {
TRACEI("Vnode::Publish(): Publishing vnode: %d, %d, %p, %p, %x, "
"%x\n", (int)volume->FSVolume(), (int)inode->ID(), inode,
vnodeOps != NULL ? vnodeOps : &gExt2VnodeOps, (int)inode->Mode(),
(int)publishFlags);
TRACEI("Vnode::Publish(): Publishing volume: %p, %" B_PRIdINO
", %p, %p, %" B_PRIu16 ", %" B_PRIx32 "\n", volume->FSVolume(),
inode->ID(), inode, vnodeOps != NULL ? vnodeOps : &gExt2VnodeOps,
inode->Mode(), publishFlags);
status = publish_vnode(volume->FSVolume(), inode->ID(), inode,
vnodeOps != NULL ? vnodeOps : &gExt2VnodeOps, inode->Mode(),
publishFlags);
@@ -139,7 +139,7 @@ InodeAllocator::_AllocateInGroup(Transaction& transaction, uint32 blockGroup,
uint32 freeInodes = group->FreeInodes(fVolume->Has64bitFeature());
if (freeInodes == 0)
return B_DEVICE_FULL;
TRACE("InodeAllocator::_Allocate() freeInodes %ld\n",
TRACE("InodeAllocator::_Allocate() freeInodes %" B_PRId32 "\n",
freeInodes);
group->SetFreeInodes(freeInodes - 1, fVolume->Has64bitFeature());
if (isDirectory) {
@@ -177,8 +177,8 @@ InodeAllocator::_MarkInBitmap(Transaction& transaction, fsblock_t bitmapBlock,
BitmapBlock inodeBitmap(fVolume, numInodes);
if (!inodeBitmap.SetToWritable(transaction, bitmapBlock)) {
ERROR("Unable to open inode bitmap (block number: %llu) for block group "
"%lu\n", bitmapBlock, blockGroup);
ERROR("Unable to open inode bitmap (block number: %" B_PRIu64
") for block group %" B_PRIu32 "\n", bitmapBlock, blockGroup);
return B_IO_ERROR;
}
@@ -186,15 +186,16 @@ InodeAllocator::_MarkInBitmap(Transaction& transaction, fsblock_t bitmapBlock,
inodeBitmap.FindNextUnmarked(pos);
if (pos == inodeBitmap.NumBits()) {
ERROR("Even though the block group %lu indicates there are free "
"inodes, no unmarked bit was found in the inode bitmap at block "
"%llu (numInodes %lu).\n", blockGroup, bitmapBlock, numInodes);
ERROR("Even though the block group %" B_PRIu32 " indicates there are "
"free inodes, no unmarked bit was found in the inode bitmap at "
"block %" B_PRIu64 " (numInodes %" B_PRIu32 ").\n", blockGroup,
bitmapBlock, numInodes);
return B_ERROR;
}
if (!inodeBitmap.Mark(pos, 1)) {
ERROR("Failed to mark bit %lu at bitmap block %llu\n", pos,
bitmapBlock);
ERROR("Failed to mark bit %" B_PRIu32 " at bitmap block %" B_PRIu64
"\n", pos, bitmapBlock);
return B_BAD_DATA;
}
@@ -209,14 +210,15 @@ InodeAllocator::_UnmarkInBitmap(Transaction& transaction, fsblock_t bitmapBlock,
BitmapBlock inodeBitmap(fVolume, numInodes);
if (!inodeBitmap.SetToWritable(transaction, bitmapBlock)) {
ERROR("Unable to open inode bitmap at block %llu\n", bitmapBlock);
ERROR("Unable to open inode bitmap at block %" B_PRIu64 "\n",
bitmapBlock);
return B_IO_ERROR;
}
uint32 pos = (id - 1) % fVolume->InodesPerGroup();
if (!inodeBitmap.Unmark(pos, 1)) {
ERROR("Unable to unmark bit %lu in inode bitmap block %llu\n", pos,
bitmapBlock);
ERROR("Unable to unmark bit %" B_PRIu32 " in inode bitmap block %"
B_PRIu64 "\n", pos, bitmapBlock);
return B_BAD_DATA;
}
@@ -268,7 +268,7 @@ Journal::Lock(Transaction* owner, bool separateSubTransactions)
/*virtual*/ status_t
Journal::Unlock(Transaction* owner, bool success)
{
TRACE("Journal::Unlock(): Lock recursion: %ld\n",
TRACE("Journal::Unlock(): Lock recursion: %" B_PRId32 "\n",
recursive_lock_get_recursion(&fLock));
if (fSeparateSubTransactions
|| recursive_lock_get_recursion(&fLock) == 1) {
@@ -317,8 +317,8 @@ Journal::MapBlock(off_t logical, fsblock_t& physical)
inline uint32
Journal::FreeLogBlocks() const
{
TRACE("Journal::FreeLogBlocks(): start: %lu, end: %lu, size: %lu\n",
fLogStart, fLogEnd, fLogSize);
TRACE("Journal::FreeLogBlocks(): start: %" B_PRIu32 ", end: %" B_PRIu32
", size: %" B_PRIu32 "\n", fLogStart, fLogEnd, fLogSize);
return fLogStart <= fLogEnd
? fLogSize - fLogEnd + fLogStart - 1
: fLogStart - fLogEnd;
@@ -381,7 +381,7 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock,
if (escapedData == NULL) {
TRACE("Journal::_WritePartialTransactionToLog(): Allocating "
"space for escaped block (%lu)\n", fBlockSize);
"space for escaped block (%" B_PRIu32 ")\n", fBlockSize);
escapedData = new(std::nothrow) uint8[fBlockSize];
if (escapedData == NULL) {
TRACE("Journal::_WritePartialTransactionToLof(): Failed to "
@@ -411,7 +411,7 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock,
off_t logOffset = physicalBlock * fBlockSize;
TRACE("Journal::_WritePartialTransactionToLog(): Writing from memory: "
"%p, to disk: %llu\n", finalData, logOffset);
"%p, to disk: %" B_PRIdOFF "\n", finalData, logOffset);
size_t written = write_pos(fJournalVolume->Device(), logOffset,
finalData, fBlockSize);
if (written != fBlockSize) {
@@ -420,7 +420,7 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock,
}
TRACE("Journal::_WritePartialTransactionToLog(): Wrote a journal block "
"at: %lu\n", logBlock);
"at: %" B_PRIu32 "\n", logBlock);
blockCount++;
tag++;
@@ -442,8 +442,8 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock,
off_t descriptorBlockOffset = physicalBlock * fBlockSize;
TRACE("Journal::_WritePartialTransactionToLog(): Writing to: %lld\n",
descriptorBlockOffset);
TRACE("Journal::_WritePartialTransactionToLog(): Writing to: %" B_PRIdOFF
"\n", descriptorBlockOffset);
size_t written = write_pos(fJournalVolume->Device(),
descriptorBlockOffset, descriptorBlock, fBlockSize);
if (written != fBlockSize) {
@@ -467,14 +467,15 @@ Journal::_WriteTransactionToLog()
TRACE("Journal::_WriteTransactionToLog(): Attempting to get transaction "
"size\n");
size_t size = _FullTransactionSize();
TRACE("Journal::_WriteTransactionToLog(): transaction size: %lu\n", size);
TRACE("Journal::_WriteTransactionToLog(): transaction size: %" B_PRIuSIZE
"\n", size);
if (size > fMaxTransactionSize) {
TRACE("Journal::_WriteTransactionToLog(): not enough free space "
"for the transaction. Attempting to free some space.\n");
size = _MainTransactionSize();
TRACE("Journal::_WriteTransactionToLog(): main transaction size: %lu\n",
size);
TRACE("Journal::_WriteTransactionToLog(): main transaction size: %"
B_PRIuSIZE "\n", size);
if(fHasSubTransaction && size < fMaxTransactionSize) {
TRACE("Journal::_WriteTransactionToLog(): transaction doesn't fit, "
@@ -482,22 +483,23 @@ Journal::_WriteTransactionToLog()
detached = true;
} else {
// Error: transaction can't fit in log
panic("transaction too large (size: %lu, max size: %lu, log size: "
"%lu)\n", size, fMaxTransactionSize, fLogSize);
panic("transaction too large (size: %" B_PRIuSIZE ", max size: %"
B_PRIu32 ", log size: %" B_PRIu32 ")\n", size,
fMaxTransactionSize, fLogSize);
return B_BUFFER_OVERFLOW;
}
}
TRACE("Journal::_WriteTransactionToLog(): free log blocks: %lu\n",
FreeLogBlocks());
TRACE("Journal::_WriteTransactionToLog(): free log blocks: %" B_PRIu32
"\n", FreeLogBlocks());
if (size > FreeLogBlocks()) {
TRACE("Journal::_WriteTransactionToLog(): Syncing block cache\n");
cache_sync_transaction(fFilesystemBlockCache, fTransactionID);
if (size > FreeLogBlocks()) {
panic("Transaction fits, but sync didn't result in enough"
"free space.\n\tGot %ld when at least %ld was expected.",
FreeLogBlocks(), size);
"free space.\n\tGot %" B_PRIu32 " when at least %" B_PRIuSIZE
" was expected.", FreeLogBlocks(), size);
}
}
@@ -510,7 +512,7 @@ Journal::_WriteTransactionToLog()
// Prepare Descriptor block
TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for "
"the descriptor block, block size %lu\n", fBlockSize);
"the descriptor block, block size %" B_PRIu32 "\n", fBlockSize);
JournalHeader* descriptorBlock =
(JournalHeader*)new(std::nothrow) uint8[fBlockSize];
if (descriptorBlock == NULL) {
@@ -524,7 +526,7 @@ Journal::_WriteTransactionToLog()
// Prepare Commit block
TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for "
"the commit block, block size %lu\n", fBlockSize);
"the commit block, block size %" B_PRIu32 "\n", fBlockSize);
JournalHeader* commitBlock =
(JournalHeader*)new(std::nothrow) uint8[fBlockSize];
if (descriptorBlock == NULL) {
@@ -588,7 +590,7 @@ Journal::_WriteTransactionToLog()
off_t logOffset = physicalBlock * fBlockSize;
TRACE("Journal::_WriteTransactionToLog(): Writting commit block to "
"%lld\n", logOffset);
"%" B_PRIdOFF "\n", logOffset);
off_t written = write_pos(fJournalVolume->Device(), logOffset,
commitBlock, fBlockSize);
if (written != fBlockSize) {
@@ -610,7 +612,8 @@ Journal::_WriteTransactionToLog()
off_t logOffset = physicalBlock * fBlockSize;
TRACE("Journal::_WriteTransactionToLog(): Writing to: %lld\n", logOffset);
TRACE("Journal::_WriteTransactionToLog(): Writing to: %" B_PRIdOFF "\n",
logOffset);
off_t written = write_pos(fJournalVolume->Device(), logOffset, commitBlock,
fBlockSize);
if (written != fBlockSize) {
@@ -644,8 +647,8 @@ Journal::_WriteTransactionToLog()
if (status == B_OK && _FullTransactionSize() > fLogSize) {
// If the transaction is too large after writing, there is no way to
// recover, so let this transaction fail.
ERROR("transaction too large (%ld blocks, log size %ld)!\n",
_FullTransactionSize(), fLogSize);
ERROR("transaction too large (%" B_PRIuSIZE " blocks, log size %"
B_PRIu32 ")!\n", _FullTransactionSize(), fLogSize);
return B_BUFFER_OVERFLOW;
}
} else {
@@ -679,7 +682,8 @@ Journal::_SaveSuperBlock()
superblock.SetFirstCommitID(fFirstCommitID);
superblock.SetLogStart(fLogStart);
TRACE("Journal::SaveSuperBlock(): Write to %lld\n", superblockPos);
TRACE("Journal::SaveSuperBlock(): Write to %" B_PRIdOFF "\n",
superblockPos);
size_t bytesWritten = write_pos(fJournalVolume->Device(), superblockPos,
&superblock, sizeof(superblock));
@@ -702,8 +706,8 @@ Journal::_LoadSuperBlock()
if (status != B_OK)
return status;
TRACE("Journal::_LoadSuperBlock(): superblock physical block: %llu\n",
superblockPos);
TRACE("Journal::_LoadSuperBlock(): superblock physical block: %" B_PRIu64
"\n", superblockPos);
JournalSuperBlock superblock;
size_t bytesRead = read_pos(fJournalVolume->Device(), superblockPos
@@ -715,8 +719,8 @@ Journal::_LoadSuperBlock()
}
if (!superblock.header.CheckMagic()) {
ERROR("Journal::_LoadSuperBlock(): Invalid superblock magic %lX\n",
superblock.header.Magic());
ERROR("Journal::_LoadSuperBlock(): Invalid superblock magic %" B_PRIx32
"\n", superblock.header.Magic());
return B_BAD_VALUE;
}
@@ -757,9 +761,10 @@ Journal::_LoadSuperBlock()
// TODO: Why is "superblock.MaxTransactionBlocks();" zero?
//fFirstCacheCommitID = fFirstCommitID - fTransactionID /*+ 1*/;
TRACE("Journal::_LoadSuperBlock(): block size: %lu, first commit id: %lu, "
"first log block: %lu, log start: %lu, log size: %lu, max transaction "
"size: %lu\n", fBlockSize, fFirstCommitID, fFirstLogBlock, fLogStart,
TRACE("Journal::_LoadSuperBlock(): block size: %" B_PRIu32 ", first commit"
" id: %" B_PRIu32 ", first log block: %" B_PRIu32 ", log start: %"
B_PRIu32 ", log size: %" B_PRIu32 ", max transaction size: %" B_PRIu32
"\n", fBlockSize, fFirstCommitID, fFirstLogBlock, fLogStart,
fLogSize, fMaxTransactionSize);
return B_OK;
@@ -795,7 +800,8 @@ Journal::_CountTags(JournalHeader* descriptorBlock)
tags += 2; // Skip new UUID
}
TRACE("Journal::_CountTags(): Tag block: %lu\n", tags->BlockNumber());
TRACE("Journal::_CountTags(): Tag block: %" B_PRIu32 "\n",
tags->BlockNumber());
tags++; // Go to next tag
count++;
@@ -804,7 +810,7 @@ Journal::_CountTags(JournalHeader* descriptorBlock)
if ((tags->Flags() & JOURNAL_FLAG_LAST_TAG) != 0)
count++;
TRACE("Journal::_CountTags(): counted tags: %lu\n", count);
TRACE("Journal::_CountTags(): counted tags: %" B_PRIu32 "\n", count);
return count;
}
@@ -858,11 +864,11 @@ Journal::_RecoverPassScan(uint32& lastCommitID)
uint32 tags = _CountTags(header);
nextBlock += tags;
TRACE("Journal recover pass scan: Found a descriptor block with "
"%lu tags\n", tags);
"%" B_PRIu32 " tags\n", tags);
} else if (blockType == JOURNAL_COMMIT_BLOCK) {
nextCommitID++;
TRACE("Journal recover pass scan: Found a commit block. Next "
"commit ID: %lu\n", nextCommitID);
"commit ID: %" B_PRIu32 "\n", nextCommitID);
} else if (blockType != JOURNAL_REVOKE_BLOCK) {
TRACE("Journal recover pass scan: Reached an unrecognized block, "
"assuming as log's end.\n");
@@ -881,8 +887,8 @@ Journal::_RecoverPassScan(uint32& lastCommitID)
header = (JournalHeader*)cached.SetTo(nextBlockPos);
}
TRACE("Journal Recovery pass scan: Last detected transaction ID: %lu\n",
nextCommitID);
TRACE("Journal Recovery pass scan: Last detected transaction ID: %"
B_PRIu32 "\n", nextCommitID);
lastCommitID = nextCommitID;
return B_OK;
@@ -946,7 +952,7 @@ Journal::_RecoverPassRevoke(uint32 lastCommitID)
return B_ERROR;
}
TRACE("Journal recovery pass revoke: Revoked blocks: %lu\n",
TRACE("Journal recovery pass revoke: Revoked blocks: %" B_PRIu32 "\n",
fRevokeManager->NumRevokes());
return B_OK;
@@ -1016,8 +1022,8 @@ Journal::_RecoverPassReplay(uint32 lastCommitID)
= B_HOST_TO_BENDIAN_INT32(JOURNAL_MAGIC);
}
TRACE("Journal::_RevoverPassReplay(): Write to %lu\n",
tag->BlockNumber() * fBlockSize);
TRACE("Journal::_RevoverPassReplay(): Write to %" B_PRIu32
"\n", tag->BlockNumber() * fBlockSize);
size_t written = write_pos(fFilesystemVolume->Device(),
tag->BlockNumber() * fBlockSize, data, fBlockSize);
@@ -1070,7 +1076,7 @@ Journal::_FlushLog(bool canWait, bool flushBlocks)
status_t status = canWait ? recursive_lock_lock(&fLock)
: recursive_lock_trylock(&fLock);
TRACE("Journal::_FlushLog(): Acquired fLock, recursion: %ld\n",
TRACE("Journal::_FlushLog(): Acquired fLock, recursion: %" B_PRId32 "\n",
recursive_lock_get_recursion(&fLock));
if (status != B_OK)
return status;
@@ -1131,7 +1137,7 @@ Journal::_WrapAroundLog(uint32 block)
size_t
Journal::_CurrentTransactionSize() const
{
TRACE("Journal::_CurrentTransactionSize(): transaction %ld\n",
TRACE("Journal::_CurrentTransactionSize(): transaction %" B_PRIu32 "\n",
fTransactionID);
size_t count;
@@ -1140,12 +1146,12 @@ Journal::_CurrentTransactionSize() const
count = cache_blocks_in_sub_transaction(fFilesystemBlockCache,
fTransactionID);
TRACE("\tSub transaction size: %ld\n", count);
TRACE("\tSub transaction size: %" B_PRIuSIZE "\n", count);
} else {
count = cache_blocks_in_transaction(fFilesystemBlockCache,
fTransactionID);
TRACE("\tTransaction size: %ld\n", count);
TRACE("\tTransaction size: %" B_PRIuSIZE "\n", count);
}
return count;
@@ -1155,13 +1161,14 @@ Journal::_CurrentTransactionSize() const
size_t
Journal::_FullTransactionSize() const
{
TRACE("Journal::_FullTransactionSize(): transaction %ld\n", fTransactionID);
TRACE("Journal::_FullTransactionSize(): transaction %" B_PRIu32 "\n",
fTransactionID);
TRACE("\tFile sytem block cache: %p\n", fFilesystemBlockCache);
size_t count = cache_blocks_in_transaction(fFilesystemBlockCache,
fTransactionID);
TRACE("\tFull transaction size: %ld\n", count);
TRACE("\tFull transaction size: %" B_PRIuSIZE "\n", count);
return count;
}
@@ -1170,12 +1177,13 @@ Journal::_FullTransactionSize() const
size_t
Journal::_MainTransactionSize() const
{
TRACE("Journal::_MainTransactionSize(): transaction %ld\n", fTransactionID);
TRACE("Journal::_MainTransactionSize(): transaction %" B_PRIu32 "\n",
fTransactionID);
size_t count = cache_blocks_in_main_transaction(fFilesystemBlockCache,
fTransactionID);
TRACE("\tMain transaction size: %ld\n", count);
TRACE("\tMain transaction size: %" B_PRIuSIZE "\n", count);
return count;
}
@@ -1186,13 +1194,13 @@ Journal::_TransactionDone(bool success)
{
if (!success) {
if (fHasSubTransaction) {
TRACE("Journal::_TransactionDone(): transaction %ld failed, "
"aborting subtransaction\n", fTransactionID);
TRACE("Journal::_TransactionDone(): transaction %" B_PRIu32
" failed, aborting subtransaction\n", fTransactionID);
cache_abort_sub_transaction(fFilesystemBlockCache, fTransactionID);
// parent is unaffected
} else {
TRACE("Journal::_TransactionDone(): transaction %ld failed,"
" aborting\n", fTransactionID);
TRACE("Journal::_TransactionDone(): transaction %" B_PRIu32
" failed, aborting\n", fTransactionID);
cache_abort_transaction(fFilesystemBlockCache, fTransactionID);
fUnwrittenTransactions = 0;
}
@@ -1203,12 +1211,12 @@ Journal::_TransactionDone(bool success)
// If possible, delay flushing the transaction
uint32 size = _FullTransactionSize();
TRACE("Journal::_TransactionDone(): full transaction size: %lu, max "
"transaction size: %lu, free log blocks: %lu\n", size,
fMaxTransactionSize, FreeLogBlocks());
TRACE("Journal::_TransactionDone(): full transaction size: %" B_PRIu32
", max transaction size: %" B_PRIu32 ", free log blocks: %" B_PRIu32
"\n", size, fMaxTransactionSize, FreeLogBlocks());
if (fMaxTransactionSize > 0 && size < fMaxTransactionSize) {
TRACE("Journal::_TransactionDone(): delaying flush of transaction "
"%ld\n", fTransactionID);
"%" B_PRIu32 "\n", fTransactionID);
// Make sure the transaction fits in the log
if (size < FreeLogBlocks())
@@ -1228,8 +1236,8 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void* _logEntry)
{
LogEntry* logEntry = (LogEntry*)_logEntry;
TRACE("Journal::_TransactionWritten(): Transaction %ld checkpointed\n",
transactionID);
TRACE("Journal::_TransactionWritten(): Transaction %" B_PRIu32
" checkpointed\n", transactionID);
Journal* journal = logEntry->GetJournal();
@@ -1243,12 +1251,12 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void* _logEntry)
TRACE("Journal::_TransactionWritten(): first log entry: %p\n",
journal->fLogEntries.First());
if (logEntry == journal->fLogEntries.First()) {
TRACE("Journal::_TransactionWritten(): Moving start of log to %lu\n",
logEntry->Start());
TRACE("Journal::_TransactionWritten(): Moving start of log to %"
B_PRIu32 "\n", logEntry->Start());
journal->fLogStart = logEntry->Start();
journal->fFirstCommitID = logEntry->CommitID();
TRACE("Journal::_TransactionWritten(): Setting commit ID to %lu\n",
logEntry->CommitID());
TRACE("Journal::_TransactionWritten(): Setting commit ID to %" B_PRIu32
"\n", logEntry->CommitID());
if (journal->_SaveSuperBlock() != B_OK)
panic("ext2: Failed to write journal superblock\n");
@@ -84,8 +84,8 @@ NoJournal::Unlock(Transaction* owner, bool success)
status_t
NoJournal::_WriteTransactionToLog()
{
TRACE("NoJournal::_WriteTransactionToLog(): Ending transaction %ld\n",
fTransactionID);
TRACE("NoJournal::_WriteTransactionToLog(): Ending transaction %" B_PRId32
"\n", fTransactionID);
fTransactionID = cache_end_transaction(fFilesystemBlockCache,
fTransactionID, _TransactionWritten, NULL);
@@ -97,5 +97,5 @@ NoJournal::_WriteTransactionToLog()
/*static*/ void
NoJournal::_TransactionWritten(int32 transactionID, int32 event, void* param)
{
TRACE("Transaction %ld checkpointed\n", transactionID);
TRACE("Transaction %" B_PRId32" checkpointed\n", transactionID);
}
@@ -31,14 +31,16 @@ RevokeManager::~RevokeManager()
status_t
RevokeManager::ScanRevokeBlock(JournalRevokeHeader* revokeBlock, uint32 commitID)
RevokeManager::ScanRevokeBlock(JournalRevokeHeader* revokeBlock,
uint32 commitID)
{
TRACE("RevokeManager::ScanRevokeBlock(): Commit ID: %lu\n", commitID);
TRACE("RevokeManager::ScanRevokeBlock(): Commit ID: %" B_PRIu32 "\n",
commitID);
int count = revokeBlock->NumBytes() / 4;
for (int i = 0; i < count; ++i) {
TRACE("RevokeManager::ScanRevokeBlock(): Found a revoked block: %lu\n",
revokeBlock->RevokeBlock(i));
TRACE("RevokeManager::ScanRevokeBlock(): Found a revoked block: %"
B_PRIu32 "\n", revokeBlock->RevokeBlock(i));
status_t status = Insert(revokeBlock->RevokeBlock(i), commitID);
if (status != B_OK) {
@@ -187,11 +187,11 @@ Transaction::NotifyListeners(bool success)
TRACE("Transaction::NotifyListeners(): fListeners.First(): %p\n",
fListeners.First());
if (success) {
TRACE("Transaction::NotifyListeners(true): Number of listeners: %ld\n",
fListeners.Count());
TRACE("Transaction::NotifyListeners(true): Number of listeners: %"
B_PRId32 "\n", fListeners.Count());
} else {
TRACE("Transaction::NotifyListeners(false): Number of listeners: %ld\n",
fListeners.Count());
TRACE("Transaction::NotifyListeners(false): Number of listeners: %"
B_PRId32 "\n", fListeners.Count());
}
TRACE("Transaction::NotifyListeners(): Finished counting\n");
+28 -22
View File
@@ -296,7 +296,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
if (opener.IsReadOnly())
fFlags |= VOLUME_READ_ONLY;
TRACE("features %lx, incompatible features %lx, read-only features %lx\n",
TRACE("features %" B_PRIx32 ", incompatible features %" B_PRIx32
", read-only features %" B_PRIx32 "\n",
fSuperBlock.CompatibleFeatures(), fSuperBlock.IncompatibleFeatures(),
fSuperBlock.ReadOnlyFeatures());
@@ -336,8 +337,9 @@ Volume::Mount(const char* deviceName, uint32 flags)
fGroupsPerBlock = fBlockSize / fGroupDescriptorSize;
fNumInodes = fSuperBlock.NumInodes();
TRACE("block size %ld, num groups %ld, groups per block %ld, first %lu\n",
fBlockSize, fNumGroups, fGroupsPerBlock, fFirstDataBlock);
TRACE("block size %" B_PRIu32 ", num groups %" B_PRIu32 ", groups per "
"block %" B_PRIu32 ", first %" B_PRIu32 "\n", fBlockSize, fNumGroups,
fGroupsPerBlock, fFirstDataBlock);
uint32 blockCount = (fNumGroups + fGroupsPerBlock - 1) / fGroupsPerBlock;
@@ -523,8 +525,8 @@ Volume::_UnsupportedIncompatibleFeatures(ext2_super_block& superBlock)
& ~supportedIncompatible;
if (unsupported != 0) {
FATAL("ext2: incompatible features not supported: %lx (extents %x)\n",
unsupported, EXT2_INCOMPATIBLE_FEATURE_EXTENTS);
FATAL("ext2: incompatible features not supported: %" B_PRIx32
" (extents %x)\n", unsupported, EXT2_INCOMPATIBLE_FEATURE_EXTENTS);
}
return unsupported;
@@ -545,8 +547,10 @@ Volume::_UnsupportedReadOnlyFeatures(ext2_super_block& superBlock)
uint32 unsupported = superBlock.ReadOnlyFeatures() & ~supportedReadOnly;
if (unsupported != 0)
FATAL("ext2: readonly features not supported: %lx\n", unsupported);
if (unsupported != 0) {
FATAL("ext2: readonly features not supported: %" B_PRIx32 "\n",
unsupported);
}
return unsupported;
}
@@ -611,8 +615,8 @@ Volume::GetBlockGroup(int32 index, ext2_block_group** _group)
memcpy(fGroupBlocks[blockIndex], block, fBlockSize);
TRACE("group [%ld]: inode table %lld\n", index, ((ext2_block_group*)
(fGroupBlocks[blockIndex] + blockOffset
TRACE("group [%" B_PRId32 "]: inode table %" B_PRIu64 "\n", index,
((ext2_block_group*)(fGroupBlocks[blockIndex] + blockOffset
* fGroupDescriptorSize))->InodeTable(Has64bitFeature()));
}
@@ -646,9 +650,9 @@ Volume::WriteBlockGroup(Transaction& transaction, int32 index)
+ blockOffset * fGroupDescriptorSize);
group->checksum = _GroupCheckSum(group, index);
TRACE("Volume::WriteBlockGroup() checksum 0x%x for group %ld "
"(free inodes %ld, unused %ld)\n", group->checksum, index,
group->FreeInodes(Has64bitFeature()),
TRACE("Volume::WriteBlockGroup() checksum 0x%x for group %" B_PRId32 " "
"(free inodes %" B_PRIu32 ", unused %" B_PRIu32 ")\n", group->checksum,
index, group->FreeInodes(Has64bitFeature()),
group->UnusedInodes(Has64bitFeature()));
CachedBlock cached(this);
@@ -822,7 +826,8 @@ Volume::AllocateBlocks(Transaction& transaction, uint32 minimum, uint32 maximum,
if (status != B_OK)
return status;
TRACE("Volume::AllocateBlocks(): Allocated %lu blocks\n", length);
TRACE("Volume::AllocateBlocks(): Allocated %" B_PRIu32 " blocks\n",
length);
fFreeBlocks -= length;
@@ -833,7 +838,7 @@ Volume::AllocateBlocks(Transaction& transaction, uint32 minimum, uint32 maximum,
status_t
Volume::FreeBlocks(Transaction& transaction, fsblock_t start, uint32 length)
{
TRACE("Volume::FreeBlocks(%llu, %lu)\n", start, length);
TRACE("Volume::FreeBlocks(%" B_PRIu64 ", %" B_PRIu32 ")\n", start, length);
if (IsReadOnly())
return B_READ_ONLY_DEVICE;
@@ -841,11 +846,11 @@ Volume::FreeBlocks(Transaction& transaction, fsblock_t start, uint32 length)
if (status != B_OK)
return status;
TRACE("Volume::FreeBlocks(): number of free blocks (before): %llu\n",
fFreeBlocks);
TRACE("Volume::FreeBlocks(): number of free blocks (before): %" B_PRIdOFF
"\n", fFreeBlocks);
fFreeBlocks += length;
TRACE("Volume::FreeBlocks(): number of free blocks (after): %llu\n",
fFreeBlocks);
TRACE("Volume::FreeBlocks(): number of free blocks (after): %" B_PRIdOFF
"\n", fFreeBlocks);
return WriteSuperBlock(transaction);
}
@@ -880,8 +885,9 @@ Volume::WriteSuperBlock(Transaction& transaction)
fSuperBlock.SetFreeInodes(fFreeInodes);
// TODO: Rest of fields that can be modified
TRACE("Volume::WriteSuperBlock(): free blocks: %llu, free inodes: %lu\n",
fSuperBlock.FreeBlocks(Has64bitFeature()), fSuperBlock.FreeInodes());
TRACE("Volume::WriteSuperBlock(): free blocks: %" B_PRIu64 ", free inodes:"
" %" B_PRIu32 "\n", fSuperBlock.FreeBlocks(Has64bitFeature()),
fSuperBlock.FreeInodes());
CachedBlock cached(this);
uint8* block = cached.SetToWritable(transaction, fFirstDataBlock);
@@ -889,8 +895,8 @@ Volume::WriteSuperBlock(Transaction& transaction)
if (block == NULL)
return B_IO_ERROR;
TRACE("Volume::WriteSuperBlock(): first data block: %lu, block: %p, "
"superblock: %p\n", fFirstDataBlock, block, &fSuperBlock);
TRACE("Volume::WriteSuperBlock(): first data block: %" B_PRIu32 ", block:"
" %p, superblock: %p\n", fFirstDataBlock, block, &fSuperBlock);
if (fFirstDataBlock == 0)
memcpy(block + 1024, &fSuperBlock, sizeof(fSuperBlock));
@@ -13,9 +13,6 @@
#include <KernelExport.h>
//#define TRACE_EXT2
typedef uint64 fileblock_t; // file block number
typedef uint64 fsblock_t; // filesystem block number
@@ -217,7 +217,7 @@ ext2_get_vnode(fs_volume* _volume, ino_t id, fs_vnode* _node, int* _type,
Volume* volume = (Volume*)_volume->private_volume;
if (id < 2 || id > volume->NumInodes()) {
ERROR("invalid inode id %lld requested!\n", id);
ERROR("invalid inode id %" B_PRIdINO " requested!\n", id);
return B_BAD_VALUE;
}
@@ -319,7 +319,7 @@ ext2_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
while (true) {
file_io_vec fileVecs[8];
uint32 fileVecCount = 8;
size_t fileVecCount = 8;
status = file_map_translate(inode->Map(), pos, bytesLeft, fileVecs,
&fileVecCount, 0);
@@ -436,8 +436,8 @@ ext2_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset,
return status;
if (block > volume->NumBlocks()) {
panic("ext2_get_file_map() found block %lld for offset %lld\n",
block, offset);
panic("ext2_get_file_map() found block %" B_PRIu64 " for offset %"
B_PRIdOFF "\n", block, offset);
}
off_t blockOffset = block << volume->BlockShift();
@@ -467,10 +467,10 @@ ext2_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset,
offset += blockLength;
size -= blockLength;
if (size <= vecs[index - 1].length || offset >= inode->Size()) {
if ((off_t)size <= vecs[index - 1].length || offset >= inode->Size()) {
// We're done!
*_count = index;
TRACE("ext2_get_file_map for inode %lld\n", inode->ID());
TRACE("ext2_get_file_map for inode %" B_PRIdINO "\n", inode->ID());
return B_OK;
}
}
@@ -518,7 +518,7 @@ static status_t
ext2_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd,
void* buffer, size_t bufferLength)
{
TRACE("ioctl: %lu\n", cmd);
TRACE("ioctl: %" B_PRIu32 "\n", cmd);
Volume* volume = (Volume*)_volume->private_volume;
switch (cmd) {
@@ -537,14 +537,15 @@ ext2_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd,
uint32 group = 0;
uint32 length;
TRACE("ioctl: blocks per group: %lu, block size: %lu, "
"first block: %lu, start: %llu, group: %lu\n", blocksPerGroup,
TRACE("ioctl: blocks per group: %" B_PRIu32 ", block size: %"
B_PRIu32 ", first block: %" B_PRIu32 ", start: %" B_PRIu64
", group: %" B_PRIu32 "\n", blocksPerGroup,
blockSize, firstBlock, start, group);
while (volume->AllocateBlocks(transaction, 1, 2048, group, start,
length) == B_OK) {
TRACE("ioctl: Allocated blocks in group %lu: %llu-%llu\n", group,
start, start + length);
TRACE("ioctl: Allocated blocks in group %" B_PRIu32 ": %"
B_PRIu64 "-%" B_PRIu64 "\n", group, start, start + length);
off_t blockNum = start + group * blocksPerGroup - firstBlock;
for (uint32 i = 0; i < length; ++i) {
@@ -1072,8 +1073,8 @@ ext2_rename(fs_volume* _volume, fs_vnode* _oldDir, const char* oldName,
status = inodeIterator.FindEntry("..");
if (status == B_ENTRY_NOT_FOUND) {
TRACE("Corrupt file sytem. Missing \"..\" in directory %ld\n",
(int32)inode->ID());
TRACE("Corrupt file system. Missing \"..\" in directory %"
B_PRIdINO "\n", inode->ID());
return B_BAD_DATA;
} else if (status != B_OK)
return status;
@@ -1266,7 +1267,7 @@ ext2_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer,
if (!inode->IsSymLink())
return B_BAD_VALUE;
if (inode->Size() < *_bufferSize)
if (inode->Size() < (off_t)*_bufferSize)
*_bufferSize = inode->Size();
if (inode->Size() > EXT2_SHORT_SYMLINK_LENGTH)