btrfs: fixes 64 bit warnings
This commit is contained in:
parent
a1566b06b7
commit
267a780ab5
@ -162,8 +162,8 @@ Attribute::_Lookup(const char* name, size_t nameLength,
|
||||
status_t status = fInode->GetVolume()->FSTree()->FindExact(key,
|
||||
(void**)&entries, &length);
|
||||
if (status != B_OK) {
|
||||
TRACE("AttributeIterator::Lookup(): Couldn't find entry with hash %lu "
|
||||
"\"%s\"\n", hash, name);
|
||||
TRACE("AttributeIterator::Lookup(): Couldn't find entry with hash %"
|
||||
B_PRIu32 " \"%s\"\n", hash, name);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -89,14 +89,14 @@ status_t
|
||||
BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size,
|
||||
bplustree_traversing type)
|
||||
{
|
||||
TRACE("Find() objectid %lld type %d offset %lld \n", key.ObjectID(),
|
||||
key.Type(), key.Offset());
|
||||
TRACE("Find() objectid %" B_PRId64 " type %d offset %" B_PRId64 " \n",
|
||||
key.ObjectID(), key.Type(), key.Offset());
|
||||
btrfs_stream *stream = fStream;
|
||||
CachedBlock cached(fVolume);
|
||||
fsblock_t physical;
|
||||
if (stream == NULL) {
|
||||
if (fVolume->FindBlock(fRootBlock, physical) != B_OK) {
|
||||
ERROR("Find() unmapped block %lld\n", fRootBlock);
|
||||
ERROR("Find() unmapped block %" B_PRId64 "\n", fRootBlock);
|
||||
return B_ERROR;
|
||||
}
|
||||
stream = (btrfs_stream *)cached.SetTo(physical);
|
||||
@ -107,19 +107,19 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size,
|
||||
uint32 i = 1;
|
||||
for (; i < stream->header.ItemCount(); i++) {
|
||||
int32 comp = _CompareKeys(stream->index[i].key, key);
|
||||
TRACE("Find() found index %ld at %lld comp %ld\n", i,
|
||||
stream->index[i].BlockNum(), comp);
|
||||
TRACE("Find() found index %" B_PRIu32 " at %" B_PRId64 " comp %"
|
||||
B_PRId32 "\n", i, stream->index[i].BlockNum(), comp);
|
||||
if (comp < 0)
|
||||
continue;
|
||||
if (comp > 0 || type == BPLUSTREE_BACKWARD)
|
||||
break;
|
||||
}
|
||||
TRACE("Find() getting index %ld at %lld\n", i - 1,
|
||||
TRACE("Find() getting index %" B_PRIu32 " at %" B_PRId64 "\n", i - 1,
|
||||
stream->index[i - 1].BlockNum());
|
||||
|
||||
if (fVolume->FindBlock(stream->index[i - 1].BlockNum(), physical)
|
||||
!= B_OK) {
|
||||
ERROR("Find() unmapped block %lld\n",
|
||||
ERROR("Find() unmapped block %" B_PRId64 "\n",
|
||||
stream->index[i - 1].BlockNum());
|
||||
return B_ERROR;
|
||||
}
|
||||
@ -128,18 +128,19 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size,
|
||||
|
||||
uint32 i;
|
||||
#ifdef TRACE_BTRFS
|
||||
TRACE("Find() dump count %ld\n", stream->header.ItemCount());
|
||||
TRACE("Find() dump count %" B_PRId32 "\n", stream->header.ItemCount());
|
||||
for (i = 0; i < stream->header.ItemCount(); i++) {
|
||||
int32 comp = _CompareKeys(key, stream->entries[i].key);
|
||||
TRACE("Find() dump %ld %ld offset %lld comp %ld\n",
|
||||
stream->entries[i].Offset(),
|
||||
TRACE("Find() dump %" B_PRIu32 " %" B_PRIu32 " offset %" B_PRId64
|
||||
" comp %" B_PRId32 "\n", stream->entries[i].Offset(),
|
||||
stream->entries[i].Size(), stream->entries[i].key.Offset(), comp);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < stream->header.ItemCount(); i++) {
|
||||
int32 comp = _CompareKeys(key, stream->entries[i].key);
|
||||
TRACE("Find() found %ld %ld oid %lld type %d offset %lld comp %ld\n",
|
||||
TRACE("Find() found %" B_PRIu32 " %" B_PRIu32 " oid %" B_PRId64
|
||||
" type %d offset %" B_PRId64 " comp %" B_PRId32 "\n",
|
||||
stream->entries[i].Offset(), stream->entries[i].Size(),
|
||||
stream->entries[i].key.ObjectID(), stream->entries[i].key.Type(),
|
||||
stream->entries[i].key.Offset(), comp);
|
||||
@ -163,8 +164,8 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size,
|
||||
|
||||
if (i < stream->header.ItemCount()
|
||||
&& stream->entries[i].key.Type() == key.Type()) {
|
||||
TRACE("Find() found %ld %ld\n", stream->entries[i].Offset(),
|
||||
stream->entries[i].Size());
|
||||
TRACE("Find() found %" B_PRIu32 " %" B_PRIu32 "\n",
|
||||
stream->entries[i].Offset(), stream->entries[i].Size());
|
||||
if (_value != NULL) {
|
||||
*_value = malloc(stream->entries[i].Size());
|
||||
memcpy(*_value, ((uint8 *)&stream->entries[0]
|
||||
@ -178,7 +179,8 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size,
|
||||
}
|
||||
|
||||
|
||||
TRACE("Find() not found %lld %lld\n", key.Offset(), key.ObjectID());
|
||||
TRACE("Find() not found %" B_PRId64 " %" B_PRId64 "\n", key.Offset(),
|
||||
key.ObjectID());
|
||||
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
@ -35,13 +35,15 @@ Chunk::Chunk(struct btrfs_chunk* chunk, fsblock_t offset)
|
||||
memcpy(fChunk, chunk, sizeof(struct btrfs_chunk)
|
||||
+ chunk->StripeCount() * sizeof(struct btrfs_stripe));
|
||||
|
||||
TRACE("chunk[0] length %llu owner %llu stripe_length %llu type %llu "
|
||||
"stripe_count %u sub_stripes %u sector_size %lu\n", chunk->Length(),
|
||||
chunk->Owner(), chunk->StripeLength(), chunk->Type(),
|
||||
chunk->StripeCount(), chunk->SubStripes(), chunk->SectorSize());
|
||||
TRACE("chunk[0] length %" B_PRIu64 " owner %" B_PRIu64 " stripe_length %"
|
||||
B_PRIu64 " type %" B_PRIu64 " stripe_count %u sub_stripes %u "
|
||||
"sector_size %" B_PRIu32 "\n", chunk->Length(), chunk->Owner(),
|
||||
chunk->StripeLength(), chunk->Type(), chunk->StripeCount(),
|
||||
chunk->SubStripes(), chunk->SectorSize());
|
||||
for(int32 i = 0; i < chunk->StripeCount(); i++) {
|
||||
TRACE("chunk.stripe[%ld].physical %lld deviceid %lld\n", i,
|
||||
chunk->stripes[i].Offset(), chunk->stripes[i].DeviceID());
|
||||
TRACE("chunk.stripe[%" B_PRId32 "].physical %" B_PRId64 " deviceid %"
|
||||
B_PRId64 "\n", i, chunk->stripes[i].Offset(),
|
||||
chunk->stripes[i].DeviceID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,8 +68,8 @@ Chunk::FindBlock(off_t logical, off_t &physical)
|
||||
if (fChunk == NULL)
|
||||
return B_NO_INIT;
|
||||
|
||||
if (logical < fChunkOffset
|
||||
|| logical > (fChunkOffset + fChunk->Length()))
|
||||
if (logical < (off_t)fChunkOffset
|
||||
|| logical > (off_t)(fChunkOffset + fChunk->Length()))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// only one stripe
|
||||
|
@ -132,8 +132,8 @@ DirectoryIterator::Lookup(const char* name, size_t nameLength, ino_t* _id)
|
||||
status_t status = fInode->GetVolume()->FSTree()->FindExact(key,
|
||||
(void**)&entries, &length);
|
||||
if (status != B_OK) {
|
||||
TRACE("DirectoryIterator::Lookup(): Couldn't find entry with hash %lu "
|
||||
"\"%s\"\n", hash, name);
|
||||
TRACE("DirectoryIterator::Lookup(): Couldn't find entry with hash %" B_PRIu32
|
||||
" \"%s\"\n", hash, name);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,6 @@ Inode::CheckPermissions(int accessMode) const
|
||||
}
|
||||
|
||||
return (accessMode & ~permissions) == 0 ? B_OK : B_NOT_ALLOWED;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -149,12 +148,13 @@ Inode::FindBlock(off_t pos, off_t& physical, off_t *_length)
|
||||
status_t status = fVolume->FSTree()->FindPrevious(search_key,
|
||||
(void**)&extent_data);
|
||||
if (status != B_OK) {
|
||||
ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%lx\n", status);
|
||||
ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%" B_PRIx32
|
||||
"\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
TRACE("Inode::FindBlock(%" B_PRIdINO ") key.Offset() %lld\n", ID(),
|
||||
search_key.Offset());
|
||||
TRACE("Inode::FindBlock(%" B_PRIdINO ") key.Offset() %" B_PRId64 "\n",
|
||||
ID(), search_key.Offset());
|
||||
|
||||
off_t diff = pos - search_key.Offset();
|
||||
off_t logical = 0;
|
||||
@ -165,8 +165,8 @@ Inode::FindBlock(off_t pos, off_t& physical, off_t *_length)
|
||||
status = fVolume->FindBlock(logical, physical);
|
||||
if (_length != NULL)
|
||||
*_length = extent_data->Size() - diff;
|
||||
TRACE("Inode::FindBlock(%" B_PRIdINO ") %lld physical %lld\n", ID(),
|
||||
pos, physical);
|
||||
TRACE("Inode::FindBlock(%" B_PRIdINO ") %" B_PRIdOFF " physical %"
|
||||
B_PRIdOFF "\n", ID(), pos, physical);
|
||||
|
||||
free(extent_data);
|
||||
return status;
|
||||
@ -180,14 +180,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length)
|
||||
|
||||
// set/check boundaries for pos/length
|
||||
if (pos < 0) {
|
||||
ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %lld, length %lu)\n",
|
||||
ID(), pos, length);
|
||||
ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF
|
||||
", length %lu)\n", ID(), pos, length);
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
if (pos >= Size() || length == 0) {
|
||||
TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %lld, length %lu)\n",
|
||||
ID(), pos, length);
|
||||
TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF
|
||||
", length %lu)\n", ID(), pos, length);
|
||||
*_length = 0;
|
||||
return B_NO_ERROR;
|
||||
}
|
||||
@ -204,14 +204,15 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length)
|
||||
status_t status = fVolume->FSTree()->FindPrevious(search_key,
|
||||
(void**)&extent_data, &item_size);
|
||||
if (status != B_OK) {
|
||||
ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%lx\n", status);
|
||||
ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%" B_PRIx32
|
||||
"\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
uint8 compression = extent_data->Compression();
|
||||
if (FileCache() != NULL
|
||||
&& extent_data->Type() == BTRFS_EXTENT_DATA_REGULAR) {
|
||||
TRACE("inode %" B_PRIdINO ": ReadAt cache (pos %lld, length %lu)\n",
|
||||
TRACE("inode %" B_PRIdINO ": ReadAt cache (pos %" B_PRIdOFF ", length %lu)\n",
|
||||
ID(), pos, length);
|
||||
free(extent_data);
|
||||
if (compression == BTRFS_EXTENT_COMPRESS_NONE)
|
||||
@ -222,7 +223,7 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length)
|
||||
panic("unknown extent compression; %d\n", compression);
|
||||
}
|
||||
|
||||
TRACE("Inode::ReadAt(%" B_PRIdINO ") key.Offset() %lld\n", ID(),
|
||||
TRACE("Inode::ReadAt(%" B_PRIdINO ") key.Offset() %" B_PRId64 "\n", ID(),
|
||||
search_key.Offset());
|
||||
|
||||
off_t diff = pos - search_key.Offset();
|
||||
@ -256,8 +257,8 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length)
|
||||
size_t inline_size = item_size - 13;
|
||||
bool headerRead = false;
|
||||
|
||||
TRACE("Inode::ReadAt(%" B_PRIdINO ") diff %lld size %ld\n", ID(),
|
||||
diff, item_size);
|
||||
TRACE("Inode::ReadAt(%" B_PRIdINO ") diff %" B_PRIdOFF " size %"
|
||||
B_PRIuSIZE "\n", ID(), diff, item_size);
|
||||
|
||||
do {
|
||||
ssize_t bytesRead = min_c(sizeof(in), inline_size - offset);
|
||||
|
@ -278,14 +278,15 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
}
|
||||
|
||||
fBlockSize = fSuperBlock.BlockSize();
|
||||
TRACE("block size %ld\n", fBlockSize);
|
||||
TRACE("block size %" B_PRIu32 "\n", fBlockSize);
|
||||
|
||||
uint8* start = (uint8*)&fSuperBlock.system_chunk_array[0];
|
||||
uint8* end = (uint8*)&fSuperBlock.system_chunk_array[2048];
|
||||
while (start < end) {
|
||||
struct btrfs_key* key = (struct btrfs_key*)start;
|
||||
TRACE("system_chunk_array object_id 0x%llx offset 0x%llx type 0x%x\n",
|
||||
key->ObjectID(), key->Offset(), key->Type());
|
||||
TRACE("system_chunk_array object_id 0x%" B_PRIx64 " offset 0x%"
|
||||
B_PRIx64 " type 0x%x\n", key->ObjectID(), key->Offset(),
|
||||
key->Type());
|
||||
if (key->Type() != BTRFS_KEY_TYPE_CHUNK_ITEM) {
|
||||
break;
|
||||
}
|
||||
@ -297,16 +298,17 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
start += sizeof(struct btrfs_key) + fChunk->Size();
|
||||
}
|
||||
|
||||
TRACE("Volume::Mount() generation: %lld\n", fSuperBlock.Generation());
|
||||
TRACE("Volume::Mount() generation: %" B_PRIu64 "\n",
|
||||
fSuperBlock.Generation());
|
||||
fsblock_t physical = 0;
|
||||
FindBlock(fSuperBlock.Root(), physical);
|
||||
TRACE("Volume::Mount() root: %lld (physical %lld)\n",
|
||||
TRACE("Volume::Mount() root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n",
|
||||
fSuperBlock.Root(), physical);
|
||||
FindBlock(fSuperBlock.ChunkRoot(), physical);
|
||||
TRACE("Volume::Mount() chunk_root: %lld (physical %lld)\n",
|
||||
fSuperBlock.ChunkRoot(), physical);
|
||||
TRACE("Volume::Mount() chunk_root: %" B_PRIu64 " (physical %" B_PRIu64
|
||||
")\n", fSuperBlock.ChunkRoot(), physical);
|
||||
FindBlock(fSuperBlock.LogRoot(), physical);
|
||||
TRACE("Volume::Mount() log_root: %lld (physical %lld)\n",
|
||||
TRACE("Volume::Mount() log_root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n",
|
||||
fSuperBlock.LogRoot(), physical);
|
||||
|
||||
// check if the device size is large enough to hold the file system
|
||||
@ -329,13 +331,13 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
FindBlock(fSuperBlock.Root(), physical);
|
||||
TRACE("Volume::Mount() root: %lld (physical %lld)\n",
|
||||
TRACE("Volume::Mount() root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n",
|
||||
fSuperBlock.Root(), physical);
|
||||
FindBlock(fSuperBlock.ChunkRoot(), physical);
|
||||
TRACE("Volume::Mount() chunk_root: %lld (physical %lld)\n",
|
||||
fSuperBlock.ChunkRoot(), physical);
|
||||
TRACE("Volume::Mount() chunk_root: %" B_PRIu64 " (physical %" B_PRIu64
|
||||
")\n", fSuperBlock.ChunkRoot(), physical);
|
||||
FindBlock(fSuperBlock.LogRoot(), physical);
|
||||
TRACE("Volume::Mount() log_root: %lld (physical %lld)\n",
|
||||
TRACE("Volume::Mount() log_root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n",
|
||||
fSuperBlock.LogRoot(), physical);
|
||||
|
||||
fRootTree = new(std::nothrow) BPlusTree(this, fSuperBlock.Root());
|
||||
@ -351,7 +353,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
ERROR("Volume::Mount(): Couldn't find extent root\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
TRACE("Volume::Mount(): Found extent root: %lld\n", root->BlockNum());
|
||||
TRACE("Volume::Mount(): Found extent root: %" B_PRIu64 "\n",
|
||||
root->BlockNum());
|
||||
fExtentTree = new(std::nothrow) BPlusTree(this, root->BlockNum());
|
||||
free(root);
|
||||
if (fExtentTree == NULL)
|
||||
@ -363,7 +366,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
ERROR("Volume::Mount(): Couldn't find fs root\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
TRACE("Volume::Mount(): Found fs root: %lld\n", root->BlockNum());
|
||||
TRACE("Volume::Mount(): Found fs root: %" B_PRIu64 "\n", root->BlockNum());
|
||||
fFSTree = new(std::nothrow) BPlusTree(this, root->BlockNum());
|
||||
free(root);
|
||||
if (fFSTree == NULL)
|
||||
@ -375,7 +378,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
ERROR("Volume::Mount(): Couldn't find dev root\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
TRACE("Volume::Mount(): Found dev root: %lld\n", root->BlockNum());
|
||||
TRACE("Volume::Mount(): Found dev root: %" B_PRIu64 "\n",
|
||||
root->BlockNum());
|
||||
fDevTree = new(std::nothrow) BPlusTree(this, root->BlockNum());
|
||||
free(root);
|
||||
if (fDevTree == NULL)
|
||||
@ -387,7 +391,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
ERROR("Volume::Mount(): Couldn't find checksum root\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
TRACE("Volume::Mount(): Found checksum root: %lld\n", root->BlockNum());
|
||||
TRACE("Volume::Mount(): Found checksum root: %" B_PRIu64 "\n",
|
||||
root->BlockNum());
|
||||
fChecksumTree = new(std::nothrow) BPlusTree(this, root->BlockNum());
|
||||
free(root);
|
||||
if (fChecksumTree == NULL)
|
||||
@ -401,8 +406,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
return status;
|
||||
}
|
||||
|
||||
TRACE("Volume::Mount(): Found root node: %lld (%s)\n", fRootNode->ID(),
|
||||
strerror(fRootNode->InitCheck()));
|
||||
TRACE("Volume::Mount(): Found root node: %" B_PRIu64 " (%s)\n",
|
||||
fRootNode->ID(), strerror(fRootNode->InitCheck()));
|
||||
|
||||
// all went fine
|
||||
opener.Keep();
|
||||
@ -488,7 +493,8 @@ status_t
|
||||
Volume::FindBlock(off_t logical, off_t &physical)
|
||||
{
|
||||
if (fChunkTree == NULL
|
||||
|| (logical >= fChunk->Offset() && logical < fChunk->End())) {
|
||||
|| (logical >= (off_t)fChunk->Offset()
|
||||
&& logical < (off_t)fChunk->End())) {
|
||||
// try with fChunk
|
||||
return fChunk->FindBlock(logical, physical);
|
||||
}
|
||||
@ -509,8 +515,8 @@ Volume::FindBlock(off_t logical, off_t &physical)
|
||||
status = _chunk.FindBlock(logical, physical);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
TRACE("Volume::FindBlock(): logical: %lld, physical: %lld\n", logical,
|
||||
physical);
|
||||
TRACE("Volume::FindBlock(): logical: %" B_PRIdOFF ", physical: %" B_PRIdOFF
|
||||
"\n", logical, physical);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ btrfs_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);
|
||||
@ -321,10 +321,10 @@ btrfs_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("btrfs_get_file_map for inode %lld\n", inode->ID());
|
||||
TRACE("btrfs_get_file_map for inode %" B_PRIdINO "\n", inode->ID());
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
@ -362,7 +362,7 @@ static status_t
|
||||
btrfs_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;*/
|
||||
return B_DEV_INVALID_IOCTL;
|
||||
|
Loading…
Reference in New Issue
Block a user