本文整理汇总了C++中Disk::ToBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ Disk::ToBlock方法的具体用法?C++ Disk::ToBlock怎么用?C++ Disk::ToBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Disk
的用法示例。
在下文中一共展示了Disk::ToBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
bool found = false;
while (inode->GetNextAttribute(name,&type,&data,&length) == B_OK)
{
if (!strcmp(name,attribute))
{
strncpy(key,(char *)data,B_FILE_NAME_LENGTH - 1);
key[B_FILE_NAME_LENGTH - 1] = '\0';
keyLength = length > B_FILE_NAME_LENGTH ? B_FILE_NAME_LENGTH : length;
found = true;
break;
}
}
if (!found)
continue;
}
off_t value;
if (tree.Find((uint8 *)key,keyLength,&value) < B_OK)
{
if (*inode->Name())
fprintf(stderr," inode at (%ld, %d) name \"%s\" is not in index!\n",runs[i].allocation_group,runs[i].start,inode->Name());
else
{
// inode is obviously deleted!
block_run parent = inode->Parent();
Directory *directory = (Directory *)Inode::Factory(&disk,parent);
if (directory != NULL && directory->InitCheck() == B_OK)
{
BPlusTree *parentTree;
if (directory->GetTree(&parentTree) == B_OK)
{
char name[B_FILE_NAME_LENGTH];
uint16 length;
off_t offset,searchOffset = disk.ToBlock(runs[i]);
bool found = false;
while (parentTree->GetNextEntry(name,&length,B_FILE_NAME_LENGTH,&offset) == B_OK)
{
if (offset == searchOffset)
{
fprintf(stderr," inode at (%ld, %d) name \"%s\" was obviously deleted, but the parent \"%s\" still contains it!\n",runs[i].allocation_group,runs[i].start,name,directory->Name());
found = true;
break;
}
}
if (!found)
fprintf(stderr," inode at (%ld, %d) was obviously deleted, and the parent \"%s\" obviously doesn't contain it anymore!\n",runs[i].allocation_group,runs[i].start,directory->Name());
}
else
fprintf(stderr," inode at (%ld, %d) was obviously deleted, but the parent \"%s\" is invalid and still contains it!\n",runs[i].allocation_group,runs[i].start,directory->Name());
}
else
{
// not that this would be really possible... - but who knows
fprintf(stderr," inode at (%ld, %d) is not in index and has invalid parent!\n",runs[i].allocation_group,runs[i].start);
}
delete directory;
}
}
else
{
if (bplustree_node::LinkType(value) == BPLUSTREE_NODE)
{
if (disk.ToBlockRun(value) != runs[i])
fprintf(stderr," offset in index and inode offset doesn't match for inode \"%s\" at (%ld, %d)\n",inode->Name(),runs[i].allocation_group,runs[i].start);
}