file_systems/reiserfs: Fix -Wformat=

Change-Id: Ic011a5407ff5ecb832606541d258005217dcd6be
Reviewed-on: https://review.haiku-os.org/c/1529
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Murai Takashi
2019-06-29 10:38:12 +00:00
committed by Jérôme Duval
parent bc71f97ed7
commit 44c006d567
9 changed files with 55 additions and 41 deletions
@@ -284,9 +284,10 @@ Node::Check() const
{ {
// check the minimal size of the node against its declared free space // check the minimal size of the node against its declared free space
if (GetFreeSpace() + sizeof(block_head) > GetBlockSize()) { if (GetFreeSpace() + sizeof(block_head) > GetBlockSize()) {
FATAL(("WARNING: bad node %Ld: it declares more free space than " FATAL(("WARNING: bad node %" B_PRIu64
"possibly being available (%u vs %lu)!\n", GetNumber(), ": it declares more free space than "
GetFreeSpace(), GetBlockSize() - sizeof(block_head))); "possibly being available (%u vs %lu)!\n", GetNumber(),
GetFreeSpace(), GetBlockSize() - sizeof(block_head)));
return B_BAD_DATA; return B_BAD_DATA;
} }
return B_OK; return B_OK;
@@ -351,10 +352,12 @@ InternalNode::Check() const
uint32 size = (const uint8*)(GetChilds() + (CountItems() + 1)) uint32 size = (const uint8*)(GetChilds() + (CountItems() + 1))
- (const uint8*)GetData(); - (const uint8*)GetData();
if (size + GetFreeSpace() > GetBlockSize()) { if (size + GetFreeSpace() > GetBlockSize()) {
FATAL(("WARNING: bad internal node %Ld: it declares more free space " FATAL(("WARNING: bad internal node %" B_PRIu64
"than possibly being available (size: %lu, block size: %lu, " ": it declares more free space "
"free space: %u)!\n", GetNumber(), size, GetBlockSize(), "than possibly being available (size: %" B_PRIu32 ", "
GetFreeSpace())); "block size: %" B_PRIu32 ", "
"free space: %u)!\n", GetNumber(), size, GetBlockSize(),
GetFreeSpace()));
return B_BAD_DATA; return B_BAD_DATA;
} }
return B_OK; return B_OK;
@@ -422,10 +425,12 @@ LeafNode::Check() const
// don't need to invoke it. // don't need to invoke it.
uint32 size = GetItemSpaceOffset(); uint32 size = GetItemSpaceOffset();
if (size + GetFreeSpace() > GetBlockSize()) { if (size + GetFreeSpace() > GetBlockSize()) {
FATAL(("WARNING: bad leaf node %Ld: it declares more free space " FATAL(("WARNING: bad leaf node %" B_PRIu64
"than possibly being available (min size: %lu, block size: " ": it declares more free space "
"%lu, free space: %u)!\n", GetNumber(), size, GetBlockSize(), "than possibly being available "
GetFreeSpace())); "(min size: %" B_PRIu32 ", block size: "
"%" B_PRIu32 ", free space: %u)!\n",
GetNumber(), size, GetBlockSize(), GetFreeSpace()));
return B_BAD_DATA; return B_BAD_DATA;
} }
return B_OK; return B_OK;
@@ -68,8 +68,8 @@ BlockCache::~BlockCache()
fLock.Lock(); fLock.Lock();
for (int32 i = 0; Block *block = fBlocks.ItemAt(i); i++) { for (int32 i = 0; Block *block = fBlocks.ItemAt(i); i++) {
if (block->_GetRefCount() > 0) { if (block->_GetRefCount() > 0) {
INFORM(("WARNING: block not put: %p (ref count: %ld)\n", block, INFORM(("WARNING: block not put: %p (ref count: %" B_PRId32 ")\n",
block->_GetRefCount())); block, block->_GetRefCount()));
} }
delete block; delete block;
} }
@@ -96,11 +96,13 @@ public:
uint32 location = entry->GetLocation(); uint32 location = entry->GetLocation();
if (location < GetEntryNameSpaceOffset() || location > GetLen()) { if (location < GetEntryNameSpaceOffset() || location > GetLen()) {
// bad location // bad location
FATAL(("WARNING: bad dir entry %ld in item %ld on node %Ld: " FATAL(("WARNING: bad dir entry %" B_PRId32 " "
"the entry's name location is %lu, which is outside the" "in item %" B_PRId32 " on node %" B_PRIu64 ": "
"entry name space (%lu - %u)!\n", index, GetIndex(), "the entry's name location is %" B_PRIu32 ", "
fNode->GetNumber(), location, GetEntryNameSpaceOffset(), "which is outside the entry name space "
GetLen())); "(%" B_PRIu32 " - %u)!\n",
index, GetIndex(), fNode->GetNumber(), location,
GetEntryNameSpaceOffset(), GetLen()));
} else { } else {
// get the name // get the name
name = (char*)((uint8*)GetData() + location); name = (char*)((uint8*)GetData() + location);
@@ -159,10 +161,11 @@ public:
// check whether the entry headers can possibly fit into the item // check whether the entry headers can possibly fit into the item
if (error == B_OK) { if (error == B_OK) {
if (GetEntryNameSpaceOffset() > GetLen()) { if (GetEntryNameSpaceOffset() > GetLen()) {
FATAL(("WARNING: bad dir item %ld on node %Ld: the item has " FATAL(("WARNING: bad dir item %" B_PRId32 " "
"len %u and can thus impossibly contain %u entry " "on node %" B_PRIu64 ": the item has "
"headers!\n", GetIndex(), fNode->GetNumber(), GetLen(), "len %u and can thus impossibly contain %u entry "
GetEntryCount())); "headers!\n", GetIndex(), fNode->GetNumber(), GetLen(),
GetEntryCount()));
return B_BAD_DATA; return B_BAD_DATA;
} }
} }
@@ -206,11 +206,13 @@ Item::Check() const
uint32 location = fHeader->GetLocation(); uint32 location = fHeader->GetLocation();
if (location < itemSpaceOffset if (location < itemSpaceOffset
|| location + fHeader->GetLen() > blockSize) { || location + fHeader->GetLen() > blockSize) {
FATAL(("WARNING: bad item %ld on node %Ld: it can not be located " FATAL(("WARNING: bad item %" B_PRId32
"where it claims to be: (location: %lu, len: %u, " " on node %" B_PRIu64 ": it can not be located "
"item space offset: %lu, block size: %lu)!\n", GetIndex(), "where it claims to be: (location: %" B_PRIu32 ", len: %u, "
fNode->GetNumber(), location, fHeader->GetLen(), "item space offset: %" B_PRIu32 ", "
itemSpaceOffset, blockSize)); "block size: %" B_PRIu32 ")!\n", GetIndex(),
fNode->GetNumber(), location, fHeader->GetLen(),
itemSpaceOffset, blockSize));
return B_BAD_DATA; return B_BAD_DATA;
} }
return B_OK; return B_OK;
@@ -1527,7 +1527,8 @@ StreamReader::_ReadIndirectItem(off_t offset, void *buffer, size_t bufferSize)
bufferSize -= toRead; bufferSize -= toRead;
buffer = (uint8*)buffer + toRead; buffer = (uint8*)buffer + toRead;
} else { } else {
FATAL(("failed to get block %Lu\n", indirect.BlockNumberAt(i))); FATAL(("failed to get block %" B_PRIu64 "\n",
indirect.BlockNumberAt(i)));
error = B_IO_ERROR; error = B_IO_ERROR;
} }
} }
@@ -260,8 +260,8 @@ public:
void Dump() const void Dump() const
{ {
TPRINT(("key: {%lu, %lu, %Lu, %hu}\n", GetDirID(), GetObjectID(), TPRINT(("key: {%" B_PRIu32 ", %" B_PRIu32 ", %" B_PRIu64 ", %hu}\n",
GetOffset(), GetType())); GetDirID(), GetObjectID(), GetOffset(), GetType()));
} }
private: private:
@@ -237,9 +237,10 @@ public:
stat_data_v1 *data = (stat_data_v1*)GetData(); stat_data_v1 *data = (stat_data_v1*)GetData();
statData->SetTo(data, clone); statData->SetTo(data, clone);
} else { } else {
FATAL(("WARNING: bad stat item %ld on node %Ld: the item len " FATAL(("WARNING: bad stat item %" B_PRId32 " "
"(%u) does not match the len of any stat data format!\n", "on node %" B_PRIu64 ": the item len "
GetIndex(), fNode->GetNumber(), GetLen())); "(%u) does not match the len of any stat data format!\n",
GetIndex(), fNode->GetNumber(), GetLen()));
error = B_BAD_DATA; error = B_BAD_DATA;
} }
return error; return error;
@@ -68,8 +68,8 @@ Tree::Init(Volume *volume, Node *rootNode, uint32 treeHeight)
if (error == B_OK) { if (error == B_OK) {
if (treeHeight > kMaxTreeHeight) { if (treeHeight > kMaxTreeHeight) {
// we don't need to fail, as we can deal with that gracefully // we don't need to fail, as we can deal with that gracefully
INFORM(("WARNING: tree height greater maximal height: %lu\n", INFORM(("WARNING: tree height greater maximal height: %" B_PRIu32
treeHeight)); "\n", treeHeight));
} }
fVolume = volume; fVolume = volume;
fBlockCache = fVolume->GetBlockCache(); fBlockCache = fVolume->GetBlockCache();
@@ -346,8 +346,9 @@ Volume::FindVNode(uint32 dirID, uint32 objectID, VNode *node)
if (error == B_OK) { if (error == B_OK) {
error = fTree->FindStatItem(dirID, objectID, &item); error = fTree->FindStatItem(dirID, objectID, &item);
if (error != B_OK) { if (error != B_OK) {
FATAL(("Couldn't find stat item for node (%lu, %lu)\n", FATAL(("Couldn't find stat item for node "
dirID, objectID)); "(%" B_PRIu32 ", %" B_PRIu32 ")\n",
dirID, objectID));
} }
} }
// get the stat data // get the stat data
@@ -363,8 +364,9 @@ Volume::FindVNode(uint32 dirID, uint32 objectID, VNode *node)
node->SetParentID(entry->GetDirID(), entry->GetObjectID()); node->SetParentID(entry->GetDirID(), entry->GetObjectID());
} }
else { else {
FATAL(("failed to find `..' entry for dir node (%lu, %ld)\n", FATAL(("failed to find `..' entry for dir node "
dirID, objectID)); "(%" B_PRIu32 ", %" B_PRIu32 ")\n",
dirID, objectID));
} }
} }
return error; return error;
@@ -584,8 +586,8 @@ Volume::_InitHashFunction()
// verify it // verify it
if (fHashFunction) { if (fHashFunction) {
if (_VerifyHashFunction(fHashFunction)) { if (_VerifyHashFunction(fHashFunction)) {
INFORM(("Directory hash function successfully detected: %lu\n", INFORM(("Directory hash function successfully detected: "
code)); "%" B_PRIu32 "\n", code));
} else { } else {
fHashFunction = NULL; fHashFunction = NULL;
INFORM(("Detected directory hash function is not the right " INFORM(("Detected directory hash function is not the right "