ramfs: Fix debugging print macro invocations and use B_PRI*.
This commit is contained in:
@@ -172,68 +172,68 @@ AllocationInfo::Dump() const
|
||||
size_t areaCount = 0;
|
||||
size_t areaSize = 0;
|
||||
|
||||
PRINT((" node table:\n"));
|
||||
PRINT((" array size: %9lu\n", fNodeTableArraySize));
|
||||
PRINT((" vector size: %9lu\n", fNodeTableVectorSize));
|
||||
PRINT((" elements: %9lu\n", fNodeTableElementCount));
|
||||
PRINT(" node table:\n");
|
||||
PRINT(" array size: %9lu\n", fNodeTableArraySize);
|
||||
PRINT(" vector size: %9lu\n", fNodeTableVectorSize);
|
||||
PRINT(" elements: %9lu\n", fNodeTableElementCount);
|
||||
areaCount += 2;
|
||||
areaSize += fNodeTableArraySize * sizeof(int32) + fNodeTableVectorSize;
|
||||
|
||||
PRINT((" entry table:\n"));
|
||||
PRINT((" array size: %9lu\n", fDirectoryEntryTableArraySize));
|
||||
PRINT((" vector size: %9lu\n", fDirectoryEntryTableVectorSize));
|
||||
PRINT((" elements: %9lu\n", fDirectoryEntryTableElementCount));
|
||||
PRINT(" entry table:\n");
|
||||
PRINT(" array size: %9lu\n", fDirectoryEntryTableArraySize);
|
||||
PRINT(" vector size: %9lu\n", fDirectoryEntryTableVectorSize);
|
||||
PRINT(" elements: %9lu\n", fDirectoryEntryTableElementCount);
|
||||
areaCount += 2;
|
||||
areaSize += fDirectoryEntryTableArraySize * sizeof(int32)
|
||||
+ fDirectoryEntryTableVectorSize;
|
||||
|
||||
PRINT((" attribute table:\n"));
|
||||
PRINT((" array size: %9lu\n", fNodeAttributeTableArraySize));
|
||||
PRINT((" vector size: %9lu\n", fNodeAttributeTableVectorSize));
|
||||
PRINT((" elements: %9lu\n", fNodeAttributeTableElementCount));
|
||||
PRINT(" attribute table:\n");
|
||||
PRINT(" array size: %9lu\n", fNodeAttributeTableArraySize);
|
||||
PRINT(" vector size: %9lu\n", fNodeAttributeTableVectorSize);
|
||||
PRINT(" elements: %9lu\n", fNodeAttributeTableElementCount);
|
||||
areaCount += 2;
|
||||
areaSize += fNodeAttributeTableArraySize * sizeof(int32)
|
||||
+ fNodeAttributeTableVectorSize;
|
||||
|
||||
PRINT((" attributes: %9lu, size: %9lu\n", fAttributeCount, fAttributeSize));
|
||||
PRINT(" attributes: %9lu, size: %9lu\n", fAttributeCount, fAttributeSize);
|
||||
heapCount += fAttributeCount;
|
||||
heapSize += fAttributeCount * sizeof(Attribute);
|
||||
|
||||
PRINT((" directories: %9lu\n", fDirectoryCount));
|
||||
PRINT(" directories: %9lu\n", fDirectoryCount);
|
||||
heapCount += fDirectoryCount;
|
||||
heapSize += fDirectoryCount * sizeof(Directory);
|
||||
|
||||
PRINT((" entries: %9lu\n", fEntryCount));
|
||||
PRINT(" entries: %9lu\n", fEntryCount);
|
||||
heapCount += fEntryCount;
|
||||
heapSize += fEntryCount * sizeof(Entry);
|
||||
|
||||
PRINT((" files: %9lu, size: %9lu\n", fFileCount, fFileSize));
|
||||
PRINT(" files: %9lu, size: %9lu\n", fFileCount, fFileSize);
|
||||
heapCount += fFileCount;
|
||||
heapSize += fFileCount * sizeof(File);
|
||||
|
||||
PRINT((" symlinks: %9lu, size: %9lu\n", fSymLinkCount, fSymLinkSize));
|
||||
PRINT(" symlinks: %9lu, size: %9lu\n", fSymLinkCount, fSymLinkSize);
|
||||
heapCount += fSymLinkCount;
|
||||
heapSize += fSymLinkCount * sizeof(SymLink);
|
||||
|
||||
PRINT((" areas: %9lu, size: %9lu\n", fAreaCount, fAreaSize));
|
||||
PRINT(" areas: %9lu, size: %9lu\n", fAreaCount, fAreaSize);
|
||||
areaCount += fAreaCount;
|
||||
areaSize += fAreaSize;
|
||||
|
||||
PRINT((" blocks: %9lu, size: %9lu\n", fBlockCount, fBlockSize));
|
||||
PRINT(" blocks: %9lu, size: %9lu\n", fBlockCount, fBlockSize);
|
||||
|
||||
PRINT((" lists: %9lu, size: %9lu\n", fListCount, fListSize));
|
||||
PRINT(" lists: %9lu, size: %9lu\n", fListCount, fListSize);
|
||||
heapCount += fListCount;
|
||||
heapSize += fListSize;
|
||||
|
||||
PRINT((" other: %9lu, size: %9lu\n", fOtherCount, fOtherSize));
|
||||
PRINT(" other: %9lu, size: %9lu\n", fOtherCount, fOtherSize);
|
||||
heapCount += fOtherCount;
|
||||
heapSize += fOtherSize;
|
||||
|
||||
PRINT((" strings: %9lu, size: %9lu\n", fStringCount, fStringSize));
|
||||
PRINT(" strings: %9lu, size: %9lu\n", fStringCount, fStringSize);
|
||||
heapCount += fStringCount;
|
||||
heapSize += fStringSize;
|
||||
|
||||
PRINT(("heap: %9lu allocations, size: %9lu\n", heapCount, heapSize));
|
||||
PRINT(("areas: %9lu allocations, size: %9lu\n", areaCount, areaSize));
|
||||
PRINT("heap: %9lu allocations, size: %9lu\n", heapCount, heapSize);
|
||||
PRINT("areas: %9lu allocations, size: %9lu\n", areaCount, areaSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ AttributeIndexImpl::Changed(Attribute *attribute, const uint8 *oldKey,
|
||||
status_t
|
||||
AttributeIndexImpl::Added(Attribute *attribute)
|
||||
{
|
||||
PRINT(("AttributeIndex::Add(%p)\n", attribute));
|
||||
PRINT("AttributeIndex::Add(%p)\n", attribute);
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
size_t size = attribute->GetSize();
|
||||
@@ -293,7 +293,7 @@ PRINT(("AttributeIndex::Add(%p)\n", attribute));
|
||||
bool
|
||||
AttributeIndexImpl::Removed(Attribute *attribute)
|
||||
{
|
||||
PRINT(("AttributeIndex::Removed(%p)\n", attribute));
|
||||
PRINT("AttributeIndex::Removed(%p)\n", attribute);
|
||||
bool result = (attribute && attribute->GetIndex() == this);
|
||||
if (result) {
|
||||
if (attribute->IsInIndex())
|
||||
@@ -381,13 +381,13 @@ AttributeIndexImpl::Iterator::GetCurrent(uint8 *buffer, size_t *keyLength)
|
||||
(*attribute)->GetKey(buffer, keyLength);
|
||||
} else {
|
||||
FATAL("Node of current attribute and node of current entry "
|
||||
"differ: %Ld vs. %Ld\n",
|
||||
"differ: %" B_PRIdINO " vs. %" B_PRIdINO "\n",
|
||||
(*attribute)->GetNode()->GetID(),
|
||||
entry->GetNode()->GetID());
|
||||
entry = NULL;
|
||||
}
|
||||
} else {
|
||||
FATAL("We have a current entry (`%s', node: %Ld), but no current "
|
||||
FATAL("We have a current entry (`%s', node: %" B_PRIdINO "), but no current "
|
||||
"attribute.\n", entry->GetName(),
|
||||
entry->GetNode()->GetID());
|
||||
entry = NULL;
|
||||
|
||||
@@ -178,7 +178,7 @@ BlockAllocator::SanityCheck(bool deep) const
|
||||
}
|
||||
// area count
|
||||
if (areaCount != fAreaCount) {
|
||||
FATAL("fAreaCount is %ld, but should be %ld\n", fAreaCount,
|
||||
FATAL("fAreaCount is %" B_PRId32 ", but should be %" B_PRId32 "\n", fAreaCount,
|
||||
areaCount);
|
||||
BA_PANIC("BlockAllocator: Bad free bytes.");
|
||||
return false;
|
||||
@@ -279,8 +279,8 @@ BlockAllocator::_AllocateBlock(size_t usableSize, bool dontCreateArea)
|
||||
fFreeBytes += area->GetFreeBytes();
|
||||
bucket = fBuckets + area->GetBucketIndex();
|
||||
bucket->AddArea(area);
|
||||
PRINT(("New area allocated. area count now: %ld, free bytes: %lu\n",
|
||||
fAreaCount, fFreeBytes));
|
||||
PRINT("New area allocated. area count now: %" B_PRId32 ", free bytes: %lu\n",
|
||||
fAreaCount, fFreeBytes);
|
||||
}
|
||||
}
|
||||
// allocate a block
|
||||
@@ -295,8 +295,8 @@ fAreaCount, fFreeBytes));
|
||||
}
|
||||
#if ENABLE_BA_PANIC
|
||||
else if (!fPanic) {
|
||||
FATAL(("Block allocation failed unexpectedly.\n"));
|
||||
PRINT((" usableSize: %lu, areaFreeBytes: %lu\n", usableSize, areaFreeBytes));
|
||||
FATAL("Block allocation failed unexpectedly.\n");
|
||||
PRINT(" usableSize: %lu, areaFreeBytes: %lu\n", usableSize, areaFreeBytes);
|
||||
BA_PANIC("Block allocation failed unexpectedly.");
|
||||
//block = area->AllocateBlock(usableSize);
|
||||
}
|
||||
@@ -395,8 +395,8 @@ BlockAllocator::_Defragment()
|
||||
area->FreeBlock(block, true);
|
||||
#if ENABLE_BA_PANIC
|
||||
if (fPanic) {
|
||||
PRINT(("Panicked while trying to free block %p\n",
|
||||
block));
|
||||
PRINT("Panicked while trying to free block %p\n",
|
||||
block);
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
@@ -410,9 +410,9 @@ BlockAllocator::_Defragment()
|
||||
if (success && area->IsEmpty()) {
|
||||
area->Delete();
|
||||
fAreaCount--;
|
||||
PRINT(("defragmenting: area deleted\n"));
|
||||
PRINT("defragmenting: area deleted\n");
|
||||
} else {
|
||||
PRINT(("defragmenting: failed to empty area\n"));
|
||||
PRINT("defragmenting: failed to empty area\n");
|
||||
// failed: re-add the area
|
||||
fFreeBytes += area->GetFreeBytes();
|
||||
AreaBucket *newBucket = fBuckets + area->GetBucketIndex();
|
||||
|
||||
@@ -43,8 +43,8 @@ BlockAllocator::Area::Create(size_t size)
|
||||
if (id >= 0) {
|
||||
area = new(base) Area(id, size);
|
||||
} else {
|
||||
ERROR(("BlockAllocator::Area::Create(%lu): Failed to create area: %s\n",
|
||||
size, strerror(id)));
|
||||
ERROR("BlockAllocator::Area::Create(%lu): Failed to create area: %s\n",
|
||||
size, strerror(id));
|
||||
}
|
||||
return area;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ BlockAllocator::Area::SanityCheck() const
|
||||
{
|
||||
// area ID
|
||||
if (fID < 0) {
|
||||
FATAL("Area ID < 0: %lx\n", fID);
|
||||
FATAL("Area ID < 0: %" B_PRIx32 "\n", fID);
|
||||
BA_PANIC("Bad area ID.");
|
||||
return false;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ BlockAllocator::Area::SanityCheck() const
|
||||
}
|
||||
// block count
|
||||
if (fFreeBlockCount + fUsedBlockCount == 0) {
|
||||
FATAL(("Area contains no blocks at all.\n"));
|
||||
FATAL("Area contains no blocks at all.\n");
|
||||
BA_PANIC("Bad area block count.");
|
||||
return false;
|
||||
}
|
||||
@@ -295,8 +295,8 @@ BlockAllocator::Area::SanityCheck() const
|
||||
for (int32 i = 0; i < blockCount; i++) {
|
||||
blockListOK = false;
|
||||
if (!block) {
|
||||
FATAL("Encountered NULL in block list at index %ld, although "
|
||||
"list should have %ld blocks\n", i, blockCount);
|
||||
FATAL("Encountered NULL in block list at index %" B_PRId32 ", although "
|
||||
"list should have %" B_PRId32 " blocks\n", i, blockCount);
|
||||
BA_PANIC("Bad area block list.");
|
||||
return false;
|
||||
}
|
||||
@@ -321,14 +321,14 @@ BlockAllocator::Area::SanityCheck() const
|
||||
// alignment
|
||||
if (block_align_floor(address) != address
|
||||
|| block_align_floor(blockSize) != blockSize) {
|
||||
FATAL("Block %ld not properly aligned: %p, size: %lu\n",
|
||||
FATAL("Block %" B_PRId32 " not properly aligned: %p, size: %lu\n",
|
||||
i, block, blockSize);
|
||||
BA_PANIC("Bad area block.");
|
||||
return false;
|
||||
}
|
||||
// previous block
|
||||
if (block->GetPreviousBlock() != prevBlock) {
|
||||
FATAL("Previous block of block %ld was not the previous "
|
||||
FATAL("Previous block of block %" B_PRId32 " was not the previous "
|
||||
"block in list: %p vs %p\n", i,
|
||||
block->GetPreviousBlock(), prevBlock);
|
||||
BA_PANIC("Bad area block list.");
|
||||
@@ -344,14 +344,14 @@ BlockAllocator::Area::SanityCheck() const
|
||||
freeBytes += freeBlock->GetUsableSize();
|
||||
// block == next free block of previous free block
|
||||
if (freeBlock != nextFree) {
|
||||
FATAL("Free block %ld is not the next block in free "
|
||||
FATAL("Free block %" B_PRId32 " is not the next block in free "
|
||||
"list: %p vs %p\n", i, freeBlock, nextFree);
|
||||
BA_PANIC("Bad area free list.");
|
||||
return false;
|
||||
}
|
||||
// previous free block
|
||||
if (freeBlock->GetPreviousFreeBlock() != prevFree) {
|
||||
FATAL("Previous free block of block %ld was not the "
|
||||
FATAL("Previous free block of block %" B_PRId32 " was not the "
|
||||
" previous block in free list: %p vs %p\n", i,
|
||||
freeBlock->GetPreviousFreeBlock(), prevFree);
|
||||
BA_PANIC("Bad area free list.");
|
||||
@@ -384,13 +384,13 @@ BlockAllocator::Area::SanityCheck() const
|
||||
}
|
||||
// block counts (a bit reduntant)
|
||||
if (freeBlockCount != fFreeBlockCount) {
|
||||
FATAL("Free block count is %ld, but should be %ld\n",
|
||||
FATAL("Free block count is %" B_PRIuSIZE ", but should be %" B_PRIu32 "\n",
|
||||
fFreeBlockCount, freeBlockCount);
|
||||
BA_PANIC("Bad area free block count.");
|
||||
return false;
|
||||
}
|
||||
if (usedBlockCount != fUsedBlockCount) {
|
||||
FATAL("Used block count is %ld, but should be %ld\n",
|
||||
FATAL("Used block count is %" B_PRIuSIZE ", but should be %" B_PRIu32 "\n",
|
||||
fUsedBlockCount, usedBlockCount);
|
||||
BA_PANIC("Bad area used block count.");
|
||||
return false;
|
||||
|
||||
@@ -74,15 +74,15 @@ D(
|
||||
if (!blockData) {
|
||||
Node *node = NULL;
|
||||
if (Attribute *attribute = dynamic_cast<Attribute*>(this)) {
|
||||
FATAL(("attribute `%s' of\n", attribute->GetName()));
|
||||
FATAL("attribute `%s' of\n", attribute->GetName());
|
||||
node = attribute->GetNode();
|
||||
} else {
|
||||
node = dynamic_cast<Node*>(this);
|
||||
}
|
||||
if (node)
|
||||
// FATAL(("node `%s'\n", node->GetName()));
|
||||
FATAL(("container size: %Ld, offset: %Ld, buffer size: %lu\n",
|
||||
fSize, offset, size));
|
||||
FATAL("container size: %Ld, offset: %Ld, buffer size: %lu\n",
|
||||
fSize, offset, size);
|
||||
return B_ERROR;
|
||||
}
|
||||
);
|
||||
@@ -308,7 +308,7 @@ D(if (!fVolume->CheckBlock(block, offset + size)) return NULL;);
|
||||
} else {
|
||||
D(
|
||||
if (offset + size > kSmallDataContainerSize) {
|
||||
FATAL(("DataContainer: Data access exceeds small buffer.\n"));
|
||||
FATAL("DataContainer: Data access exceeds small buffer.\n");
|
||||
PANIC("DataContainer: Data access exceeds small buffer.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -349,7 +349,7 @@ DataContainer::_ResizeLastBlock(size_t newSize)
|
||||
? B_OK : B_BAD_VALUE);
|
||||
D(
|
||||
if (!_IsBlockMode()) {
|
||||
FATAL(("Call of _ResizeLastBlock() in small buffer mode.\n"));
|
||||
FATAL("Call of _ResizeLastBlock() in small buffer mode.\n");
|
||||
PANIC("Call of _ResizeLastBlock() in small buffer mode.");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Directory::~Directory()
|
||||
// delete all entries
|
||||
while (Entry *entry = fEntries.First()) {
|
||||
if (DeleteEntry(entry) != B_OK) {
|
||||
FATAL(("Could not delete all entries in directory.\n"));
|
||||
FATAL("Could not delete all entries in directory.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -234,7 +234,7 @@ Directory::DeleteEntry(Entry *entry)
|
||||
if (error == B_OK)
|
||||
delete entry;
|
||||
else {
|
||||
FATAL("Failed to Unlink() entry %p from node %Ld!\n", entry,
|
||||
FATAL("Failed to Unlink() entry %p from node %" B_PRIdINO "!\n", entry,
|
||||
entry->GetNode()->GetID());
|
||||
AddEntry(entry);
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ void
|
||||
Index::Dump()
|
||||
{
|
||||
D(
|
||||
PRINT(("Index: `%s', type: %lx\n", GetName(), GetType()));
|
||||
PRINT("Index: `%s', type: %lx\n", GetName(), GetType());
|
||||
for (IndexEntryIterator it(this); it.GetCurrent(); it.GetNext()) {
|
||||
Entry *entry = it.GetCurrent();
|
||||
PRINT((" entry: `%s', dir: %Ld\n", entry->GetName(),
|
||||
entry->GetParent()->GetID()));
|
||||
PRINT(" entry: `%s', dir: %Ld\n", entry->GetName(),
|
||||
entry->GetParent()->GetID());
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ Node::~Node()
|
||||
while (Attribute *attribute = fAttributes.First()) {
|
||||
status_t error = DeleteAttribute(attribute);
|
||||
if (error != B_OK) {
|
||||
FATAL(("Node::~Node(): Failed to delete attribute!\n"));
|
||||
FATAL("Node::~Node(): Failed to delete attribute!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ Node::RemoveReference()
|
||||
status_t
|
||||
Node::Link(Entry *entry)
|
||||
{
|
||||
PRINT(("Node[%Ld]::Link(): %ld ->...\n", fID, fRefCount));
|
||||
PRINT("Node[%Ld]::Link(): %" B_PRId32 " ->...\n", fID, fRefCount);
|
||||
fReferrers.Insert(entry);
|
||||
|
||||
status_t error = AddReference();
|
||||
@@ -128,7 +128,7 @@ PRINT(("Node[%Ld]::Link(): %ld ->...\n", fID, fRefCount));
|
||||
status_t
|
||||
Node::Unlink(Entry *entry)
|
||||
{
|
||||
PRINT(("Node[%Ld]::Unlink(): %ld ->...\n", fID, fRefCount));
|
||||
PRINT("Node[%Ld]::Unlink(): %" B_PRId32 " ->...\n", fID, fRefCount);
|
||||
RemoveReference();
|
||||
fReferrers.Remove(entry);
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ enum ops {
|
||||
enum match {
|
||||
NO_MATCH = 0,
|
||||
MATCH_OK = 1,
|
||||
|
||||
|
||||
MATCH_BAD_PATTERN = -2,
|
||||
MATCH_INVALID_CHARACTER
|
||||
};
|
||||
@@ -391,7 +391,7 @@ class Operator : public Term {
|
||||
//---------------------------------
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
skipWhitespace(char **expr, int32 skip = 0)
|
||||
{
|
||||
char *string = (*expr) + skip;
|
||||
@@ -400,7 +400,7 @@ skipWhitespace(char **expr, int32 skip = 0)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
skipWhitespaceReverse(char **expr,char *stop)
|
||||
{
|
||||
char *string = *expr;
|
||||
@@ -638,7 +638,7 @@ matchString(char *pattern, char *string)
|
||||
|
||||
if (string[0])
|
||||
return NO_MATCH;
|
||||
|
||||
|
||||
return MATCH_OK;
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ Equation::Equation(char **expr)
|
||||
// attribute string is empty (which is not allowed)
|
||||
if (start > end)
|
||||
return;
|
||||
|
||||
|
||||
// at this point, "start" points to the beginning of the string, "end" points
|
||||
// to the last character of the string, and "string" points to the first
|
||||
// character of the equation symbol
|
||||
@@ -710,7 +710,7 @@ Equation::Equation(char **expr)
|
||||
return;
|
||||
fOp = OP_UNEQUAL;
|
||||
break;
|
||||
|
||||
|
||||
// any invalid characters will be rejected
|
||||
default:
|
||||
*expr = string;
|
||||
@@ -733,7 +733,7 @@ Equation::Equation(char **expr)
|
||||
// string is quoted (start has to be on the beginning of a string)
|
||||
if (ParseQuotedString(&start, &end) < B_OK)
|
||||
return;
|
||||
|
||||
|
||||
string = end + 2;
|
||||
skipWhitespace(&string);
|
||||
} else {
|
||||
@@ -743,7 +743,7 @@ Equation::Equation(char **expr)
|
||||
end = string - 1;
|
||||
skipWhitespaceReverse(&end, start);
|
||||
}
|
||||
|
||||
|
||||
// at this point, "start" will point to the first character of the value,
|
||||
// "end" will point to its last character, and "start" to the first non-
|
||||
// whitespace character after the value string
|
||||
@@ -776,7 +776,7 @@ Equation::~Equation()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Equation::InitCheck()
|
||||
{
|
||||
if (fAttribute == NULL
|
||||
@@ -788,13 +788,13 @@ Equation::InitCheck()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Equation::ParseQuotedString(char **_start, char **_end)
|
||||
{
|
||||
char *start = *_start;
|
||||
char quote = *start++;
|
||||
char *end = start;
|
||||
|
||||
|
||||
for (;*end && *end != quote;end++) {
|
||||
if (*end == '\\')
|
||||
end++;
|
||||
@@ -831,7 +831,7 @@ Equation::CopyString(char *start, char *end)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Equation::ConvertValue(type_code type)
|
||||
{
|
||||
// Has the type already been converted?
|
||||
@@ -874,7 +874,7 @@ Equation::ConvertValue(type_code type)
|
||||
fSize = sizeof(double);
|
||||
break;
|
||||
default:
|
||||
FATAL("query value conversion to 0x%lx requested!\n", type);
|
||||
FATAL("query value conversion to 0x%" B_PRIx32 " requested!\n", type);
|
||||
// should we fail here or just do a safety int32 conversion?
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -926,11 +926,11 @@ Equation::CompareTo(const uint8 *value, uint16 size)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
Equation::Complement()
|
||||
{
|
||||
D(if (fOp <= OP_EQUATION || fOp > OP_LESS_THAN_OR_EQUAL) {
|
||||
FATAL(("op out of range!"));
|
||||
FATAL("op out of range!");
|
||||
return;
|
||||
});
|
||||
|
||||
@@ -1025,7 +1025,7 @@ Equation::Match(Entry *entry, Node* node, const char *attributeName, int32 type,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
Equation::CalculateScore(IndexWrapper &index)
|
||||
{
|
||||
// As always, these values could be tuned and refined.
|
||||
@@ -1063,7 +1063,7 @@ status_t
|
||||
Equation::PrepareQuery(Volume */*volume*/, IndexWrapper &index, IndexIterator **iterator, bool queryNonIndexed)
|
||||
{
|
||||
status_t status = index.SetTo(fAttribute);
|
||||
|
||||
|
||||
// if we should query attributes without an index, we can just proceed here
|
||||
if (status < B_OK && !queryNonIndexed)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
@@ -1144,7 +1144,7 @@ Equation::PrepareQuery(Volume */*volume*/, IndexWrapper &index, IndexIterator **
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Equation::GetNextMatching(Volume *volume, IndexIterator *iterator,
|
||||
struct dirent *dirent, size_t bufferSize)
|
||||
{
|
||||
@@ -1292,20 +1292,20 @@ Operator::Match(Entry *entry, Node* node, const char *attribute,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
Operator::Complement()
|
||||
{
|
||||
if (fOp == OP_AND)
|
||||
fOp = OP_OR;
|
||||
else
|
||||
fOp = OP_AND;
|
||||
|
||||
|
||||
fLeft->Complement();
|
||||
fRight->Complement();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
Operator::CalculateScore(IndexWrapper &index)
|
||||
{
|
||||
fLeft->CalculateScore(index);
|
||||
@@ -1313,26 +1313,26 @@ Operator::CalculateScore(IndexWrapper &index)
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
int32
|
||||
Operator::Score() const
|
||||
{
|
||||
if (fOp == OP_AND) {
|
||||
// return the one with the better score
|
||||
if (fRight->Score() > fLeft->Score())
|
||||
return fRight->Score();
|
||||
|
||||
|
||||
return fLeft->Score();
|
||||
}
|
||||
|
||||
|
||||
// for OP_OR, be honest, and return the one with the worse score
|
||||
if (fRight->Score() < fLeft->Score())
|
||||
return fRight->Score();
|
||||
|
||||
|
||||
return fLeft->Score();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Operator::InitCheck()
|
||||
{
|
||||
if ((fOp != OP_AND && fOp != OP_OR)
|
||||
@@ -1363,7 +1363,7 @@ Operator::Copy() const
|
||||
Term *term = new Term(equation);
|
||||
if (term == NULL)
|
||||
delete equation;
|
||||
|
||||
|
||||
return term;
|
||||
}
|
||||
|
||||
@@ -1438,10 +1438,10 @@ Expression::Expression(char *expr)
|
||||
{
|
||||
if (expr == NULL)
|
||||
return;
|
||||
|
||||
|
||||
fTerm = ParseOr(&expr);
|
||||
if (fTerm != NULL && fTerm->InitCheck() < B_OK) {
|
||||
FATAL(("Corrupt tree in expression!\n"));
|
||||
FATAL("Corrupt tree in expression!\n");
|
||||
delete fTerm;
|
||||
fTerm = NULL;
|
||||
}
|
||||
@@ -1449,7 +1449,7 @@ Expression::Expression(char *expr)
|
||||
fTerm->PrintToStream();
|
||||
D(__out("\n"));
|
||||
if (*expr != '\0')
|
||||
PRINT(("Unexpected end of string: \"%s\"!\n", expr));
|
||||
PRINT("Unexpected end of string: \"%s\"!\n", expr);
|
||||
});
|
||||
fPosition = expr;
|
||||
}
|
||||
@@ -1471,7 +1471,7 @@ Expression::ParseEquation(char **expr)
|
||||
skipWhitespace(expr, 1);
|
||||
if (**expr != '(')
|
||||
return NULL;
|
||||
|
||||
|
||||
nott = true;
|
||||
}
|
||||
|
||||
@@ -1480,16 +1480,16 @@ Expression::ParseEquation(char **expr)
|
||||
return NULL;
|
||||
} else if (**expr == '(') {
|
||||
skipWhitespace(expr, 1);
|
||||
|
||||
|
||||
Term *term = ParseOr(expr);
|
||||
|
||||
|
||||
skipWhitespace(expr);
|
||||
|
||||
|
||||
if (**expr != ')') {
|
||||
delete term;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// If the term is negated, we just complement the tree, to get
|
||||
// rid of the not, a.k.a. DeMorgan's Law.
|
||||
if (nott)
|
||||
@@ -1557,11 +1557,11 @@ Expression::ParseOr(char **expr)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
Expression::IsOperator(char **expr, char op)
|
||||
{
|
||||
char *string = *expr;
|
||||
|
||||
|
||||
if (*string == op && *(string + 1) == op) {
|
||||
*expr += 2;
|
||||
return true;
|
||||
@@ -1570,7 +1570,7 @@ Expression::IsOperator(char **expr, char op)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Expression::InitCheck()
|
||||
{
|
||||
if (fTerm == NULL)
|
||||
@@ -1652,14 +1652,14 @@ Query::Rewind()
|
||||
stack.Push(op->Left());
|
||||
}
|
||||
} else if (term->Op() == OP_EQUATION || fStack.Push((Equation *)term) < B_OK)
|
||||
FATAL(("Unknown term on stack or stack error"));
|
||||
FATAL("Unknown term on stack or stack error");
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Query::GetNextEntry(struct dirent *dirent, size_t size)
|
||||
{
|
||||
// If we don't have an equation to use yet/anymore, get a new one
|
||||
@@ -1688,7 +1688,7 @@ Query::GetNextEntry(struct dirent *dirent, size_t size)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
Query::SetLiveMode(port_id port, int32 token)
|
||||
{
|
||||
fPort = port;
|
||||
@@ -1719,13 +1719,13 @@ send_entry_notification(port_id port, int32 token, Volume* volume, Entry* entry,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
Query::LiveUpdate(Entry *entry, Node* node, const char *attribute, int32 type,
|
||||
const uint8 *oldKey, size_t oldLength, const uint8 *newKey,
|
||||
size_t newLength)
|
||||
{
|
||||
PRINT(("%p->Query::LiveUpdate(%p, %p, \"%s\", 0x%lx, %p, %lu, %p, %lu)\n",
|
||||
this, entry, node, attribute, type, oldKey, oldLength, newKey, newLength));
|
||||
PRINT("%p->Query::LiveUpdate(%p, %p, \"%s\", 0x%lx, %p, %lu, %p, %lu)\n",
|
||||
this, entry, node, attribute, type, oldKey, oldLength, newKey, newLength);
|
||||
if (fPort < 0 || fExpression == NULL || node == NULL || attribute == NULL)
|
||||
return;
|
||||
|
||||
@@ -1748,18 +1748,18 @@ this, entry, node, attribute, type, oldKey, oldLength, newKey, newLength));
|
||||
type, oldKey, oldLength);
|
||||
status_t newStatus = fExpression->Root()->Match(entry, node, attribute,
|
||||
type, newKey, newLength);
|
||||
PRINT((" oldStatus: 0x%lx, newStatus: 0x%lx\n", oldStatus, newStatus));
|
||||
PRINT(" oldStatus: 0x%lx, newStatus: 0x%lx\n", oldStatus, newStatus);
|
||||
|
||||
bool created;
|
||||
if (oldStatus == MATCH_OK && newStatus == MATCH_OK) {
|
||||
// only send out a notification if the name was changed
|
||||
// only send out a notification if the name was changed
|
||||
if (oldKey == NULL || strcmp(attribute,"name"))
|
||||
return;
|
||||
|
||||
if (entry) {
|
||||
// entry should actually always be given, when the changed
|
||||
// attribute is the entry name
|
||||
PRINT(("notification: old: removed\n"));
|
||||
PRINT("notification: old: removed\n");
|
||||
notify_query_entry_removed(fPort, fToken, fVolume->GetID(),
|
||||
entry->GetParent()->GetID(), (const char *)oldKey,
|
||||
entry->GetNode()->GetID());
|
||||
@@ -1776,7 +1776,7 @@ PRINT(("notification: old: removed\n"));
|
||||
// We send a notification for the given entry, if any, or otherwise for
|
||||
// all entries referring to the node;
|
||||
if (entry) {
|
||||
PRINT(("notification: new: %s\n", (created ? "created" : "removed")));
|
||||
PRINT("notification: new: %s\n", (created ? "created" : "removed"));
|
||||
send_entry_notification(fPort, fToken, fVolume, entry, created);
|
||||
} else {
|
||||
entry = node->GetFirstReferrer();
|
||||
|
||||
@@ -382,7 +382,7 @@ Volume::GetVNode(Node *node)
|
||||
status_t error = (fMounted ? GetVNode(node->GetID(), &dummy)
|
||||
: B_BAD_VALUE );
|
||||
if (error == B_OK && dummy != node) {
|
||||
FATAL("Two Nodes have the same ID: %Ld!\n", node->GetID());
|
||||
FATAL("Two Nodes have the same ID: %" B_PRIdINO "!\n", node->GetID());
|
||||
PutVNode(dummy);
|
||||
error = B_ERROR;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ ramfs_ioctl(fs_volume* _volume, fs_vnode* /*node*/, void* /*cookie*/,
|
||||
if (buffer) {
|
||||
if (VolumeReadLocker locker = volume) {
|
||||
const char *name = (const char*)buffer;
|
||||
PRINT((" RAMFS_IOCTL_DUMP_INDEX, `%s'\n", name));
|
||||
PRINT(" RAMFS_IOCTL_DUMP_INDEX, `%s'\n", name);
|
||||
IndexDirectory *indexDir = volume->GetIndexDirectory();
|
||||
if (indexDir) {
|
||||
if (Index *index = indexDir->FindIndex(name))
|
||||
@@ -377,7 +377,7 @@ ramfs_read_symlink(fs_volume* _volume, fs_vnode* _node, char *buffer,
|
||||
memcpy(buffer, symLink->GetLinkedPath(), toRead);
|
||||
*bufferSize = toRead;
|
||||
} else {
|
||||
FATAL("Node %Ld pretends to be a SymLink, but isn't!\n",
|
||||
FATAL("Node %" B_PRIdINO " pretends to be a SymLink, but isn't!\n",
|
||||
node->GetID());
|
||||
error = B_BAD_VALUE;
|
||||
}
|
||||
@@ -958,7 +958,7 @@ ramfs_read(fs_volume* _volume, fs_vnode* _node, void* _cookie, off_t pos,
|
||||
if (File *file = dynamic_cast<File*>(node))
|
||||
error = file->ReadAt(pos, buffer, *bufferSize, bufferSize);
|
||||
else {
|
||||
FATAL("Node %Ld pretends to be a File, but isn't!\n",
|
||||
FATAL("Node %" B_PRIdINO " pretends to be a File, but isn't!\n",
|
||||
node->GetID());
|
||||
error = B_BAD_VALUE;
|
||||
}
|
||||
@@ -1000,7 +1000,7 @@ ramfs_write(fs_volume* _volume, fs_vnode* _node, void* _cookie, off_t pos,
|
||||
error = file->WriteAt(pos, buffer, *bufferSize,
|
||||
bufferSize);
|
||||
} else {
|
||||
FATAL("Node %Ld pretends to be a File, but isn't!\n",
|
||||
FATAL("Node %" B_PRIdINO " pretends to be a File, but isn't!\n",
|
||||
node->GetID());
|
||||
error = B_BAD_VALUE;
|
||||
}
|
||||
@@ -1064,10 +1064,10 @@ fGetNextCounter++;
|
||||
*entryName = entry->GetName();
|
||||
}
|
||||
}
|
||||
PRINT(("EntryIterator %ld, GetNext() counter: %ld, entry: %p (%Ld)\n",
|
||||
PRINT("EntryIterator %" B_PRId32 ", GetNext() counter: %" B_PRId32 ", entry: %p (%Ld)\n",
|
||||
fIteratorID, fGetNextCounter, fIterator.GetCurrent(),
|
||||
(fIterator.GetCurrent()
|
||||
? fIterator.GetCurrent()->GetNode()->GetID() : -1)));
|
||||
? fIterator.GetCurrent()->GetNode()->GetID() : -1));
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1218,7 +1218,7 @@ ramfs_open_dir(fs_volume* /*fs*/, fs_vnode* _node, void** _cookie)
|
||||
if (error == B_OK) {
|
||||
dir = dynamic_cast<Directory*>(node);
|
||||
if (!dir) {
|
||||
FATAL("Node %Ld pretends to be a Directory, but isn't!\n",
|
||||
FATAL("Node %" B_PRIdINO " pretends to be a Directory, but isn't!\n",
|
||||
node->GetID());
|
||||
error = B_NOT_A_DIRECTORY;
|
||||
}
|
||||
@@ -1284,7 +1284,7 @@ ramfs_read_dir(fs_volume* _volume, fs_vnode* DARG(_node), void* _cookie,
|
||||
ino_t nodeID = -1;
|
||||
const char *name = NULL;
|
||||
if (cookie->GetNext(&nodeID, &name) == B_OK) {
|
||||
PRINT((" entry: `%s'\n", name));
|
||||
PRINT(" entry: `%s'\n", name);
|
||||
size_t nameLen = strlen(name);
|
||||
// check, whether the entry fits into the buffer,
|
||||
// and fill it in
|
||||
@@ -2018,8 +2018,8 @@ ramfs_open_query(fs_volume* _volume, const char *queryString, uint32 flags,
|
||||
port_id port, uint32 token, void** _cookie)
|
||||
{
|
||||
FUNCTION_START();
|
||||
PRINT(("query = \"%s\", flags = %lu, port_id = %ld, token = %ld\n",
|
||||
queryString, flags, port, token));
|
||||
PRINT("query = \"%s\", flags = %lu, port_id = %" B_PRId32 ", token = %" B_PRId32 "\n",
|
||||
queryString, flags, port, token);
|
||||
|
||||
Volume* volume = (Volume*)_volume->private_volume;
|
||||
|
||||
@@ -2035,8 +2035,8 @@ ramfs_open_query(fs_volume* _volume, const char *queryString, uint32 flags,
|
||||
ObjectDeleter<Expression> expressionDeleter(expression);
|
||||
|
||||
if (expression->InitCheck() < B_OK) {
|
||||
WARN(("Could not parse query, stopped at: \"%s\"\n",
|
||||
expression->Position()));
|
||||
WARN("Could not parse query, stopped at: \"%s\"\n",
|
||||
expression->Position());
|
||||
RETURN_ERROR(B_BAD_VALUE);
|
||||
}
|
||||
|
||||
@@ -2127,12 +2127,12 @@ ramfs_std_ops(int32 op, ...)
|
||||
case B_MODULE_INIT:
|
||||
{
|
||||
init_debugging();
|
||||
PRINT(("ramfs_std_ops(): B_MODULE_INIT\n"));
|
||||
PRINT("ramfs_std_ops(): B_MODULE_INIT\n");
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
case B_MODULE_UNINIT:
|
||||
PRINT(("ramfs_std_ops(): B_MODULE_UNINIT\n"));
|
||||
PRINT("ramfs_std_ops(): B_MODULE_UNINIT\n");
|
||||
exit_debugging();
|
||||
return B_OK;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user