xfs: coding style fixed, no functional changes

Change-Id: I56a1220abc330ef853cee4bdb9fa9c1b712784a4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3143
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Rene Gollent <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
CruxBox
2021-06-15 16:52:35 +00:00
committed by Jérôme Duval
parent 3f816b034d
commit a2603a88fd
2 changed files with 19 additions and 15 deletions
@@ -98,8 +98,8 @@ size_t
TreeDirectory::GetPtrOffsetIntoRoot(int pos) TreeDirectory::GetPtrOffsetIntoRoot(int pos)
{ {
size_t maxRecords = MaxRecordsPossibleRoot(); size_t maxRecords = MaxRecordsPossibleRoot();
return (sizeof(BlockInDataFork) return sizeof(BlockInDataFork) + maxRecords * KeySize()
+ maxRecords * KeySize() + (pos - 1) * PtrSize()); + (pos - 1) * PtrSize();
} }
@@ -814,8 +814,8 @@ TreeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
FillBuffer(fSingleDirBlock, FillBuffer(fSingleDirBlock,
nextLeaf - targetMap->br_startoff, targetMap); nextLeaf - targetMap->br_startoff, targetMap);
fOffsetOfSingleDirBlock = nextLeaf; fOffsetOfSingleDirBlock = nextLeaf;
continue; continue;
} else { } else {
break; break;
+16 -12
View File
@@ -40,7 +40,7 @@ NodeDirectory::Init()
if (fDataMap == NULL) if (fDataMap == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
FillMapEntry(fInode->DataExtentsCount()-3, fLeafMap); FillMapEntry(fInode->DataExtentsCount() - 3, fLeafMap);
fCurLeafMapNumber = 1; fCurLeafMapNumber = 1;
FillMapEntry(0, fDataMap); FillMapEntry(0, fDataMap);
return B_OK; return B_OK;
@@ -54,7 +54,8 @@ NodeDirectory::IsNodeType()
FillMapEntry(fInode->DataExtentsCount() - 3, fLeafMap); FillMapEntry(fInode->DataExtentsCount() - 3, fLeafMap);
fCurLeafMapNumber = 1; fCurLeafMapNumber = 1;
} }
return fLeafMap->br_startoff == LEAF_STARTOFFSET(fInode->GetVolume()->BlockLog()); return fLeafMap->br_startoff
== LEAF_STARTOFFSET(fInode->GetVolume()->BlockLog());
} }
@@ -91,7 +92,7 @@ NodeDirectory::FillBuffer(int type, char* blockBuffer, int howManyBlocksFurthur)
else else
return B_BAD_VALUE; return B_BAD_VALUE;
if (map->br_state !=0) if (map->br_state != 0)
return B_BAD_VALUE; return B_BAD_VALUE;
size_t len = fInode->DirBlockSize(); size_t len = fInode->DirBlockSize();
@@ -101,8 +102,8 @@ NodeDirectory::FillBuffer(int type, char* blockBuffer, int howManyBlocksFurthur)
return B_NO_MEMORY; return B_NO_MEMORY;
} }
xfs_daddr_t readPos = xfs_daddr_t readPos = fInode->FileSystemBlockToAddr(map->br_startblock
fInode->FileSystemBlockToAddr(map->br_startblock + howManyBlocksFurthur); + howManyBlocksFurthur);
if (read_pos(fInode->GetVolume()->Device(), readPos, blockBuffer, len) if (read_pos(fInode->GetVolume()->Device(), readPos, blockBuffer, len)
!= len) { != len) {
@@ -160,12 +161,12 @@ NodeDirectory::FindHashInNode(uint32 hashVal)
int int
NodeDirectory::EntrySize(int len) const NodeDirectory::EntrySize(int len) const
{ {
int entrySize= sizeof(xfs_ino_t) + sizeof(uint8) + len + sizeof(uint16); int entrySize = sizeof(xfs_ino_t) + sizeof(uint8) + len + sizeof(uint16);
// uint16 is for the tag // uint16 is for the tag
if (fInode->HasFileTypeField()) if (fInode->HasFileTypeField())
entrySize += sizeof(uint8); entrySize += sizeof(uint8);
return (entrySize + 7) & -8; return ROUNDUP(entrySize, 8);
// rounding off to closest multiple of 8 // rounding off to closest multiple of 8
} }
@@ -202,9 +203,11 @@ NodeDirectory::GetNext(char* name, size_t* length, xfs_ino_t* ino)
// This could be an unused entry so we should check // This could be an unused entry so we should check
uint32 blockNoFromAddress = BLOCKNO_FROM_ADDRESS(fOffset, volume); uint32 blockNoFromAddress = BLOCKNO_FROM_ADDRESS(fOffset, volume);
if (fOffset != 0 && blockNoFromAddress == fCurBlockNumber) if (fOffset != 0 && blockNoFromAddress == fCurBlockNumber) {
entry = (void*)(fDataBuffer + BLOCKOFFSET_FROM_ADDRESS(fOffset, fInode)); entry = (void*)(fDataBuffer
+ BLOCKOFFSET_FROM_ADDRESS(fOffset, fInode));
// This gets us a little faster to the next entry // This gets us a little faster to the next entry
}
uint32 curDirectorySize = fInode->Size(); uint32 curDirectorySize = fInode->Size();
@@ -306,7 +309,8 @@ NodeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
FillMapEntry(fInode->DataExtentsCount() - 2, fLeafMap); FillMapEntry(fInode->DataExtentsCount() - 2, fLeafMap);
fCurLeafMapNumber = 2; fCurLeafMapNumber = 2;
status = FillBuffer(LEAF, fLeafBuffer, rightMapOffset - fLeafMap->br_startoff); status = FillBuffer(LEAF, fLeafBuffer,
rightMapOffset - fLeafMap->br_startoff);
if (status != B_OK) if (status != B_OK)
return status; return status;
fCurLeafBufferNumber = 2; fCurLeafBufferNumber = 2;
@@ -330,14 +334,14 @@ NodeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
* instance of hashValueOfRequest and not any instance. * instance of hashValueOfRequest and not any instance.
*/ */
while (left < right) { while (left < right) {
mid = (left+right)/2; mid = (left + right) / 2;
uint32 hashval = B_BENDIAN_TO_HOST_INT32(leafEntry[mid].hashval); uint32 hashval = B_BENDIAN_TO_HOST_INT32(leafEntry[mid].hashval);
if (hashval >= hashValueOfRequest) { if (hashval >= hashValueOfRequest) {
right = mid; right = mid;
continue; continue;
} }
if (hashval < hashValueOfRequest) { if (hashval < hashValueOfRequest) {
left = mid+1; left = mid + 1;
} }
} }
TRACE("left:(%d), right:(%d)\n", left, right); TRACE("left:(%d), right:(%d)\n", left, right);