xfs: Style cleanup, no functional change

Change-Id: I698dbaa6f51c185eaaac2e0b058b1c6ce994218e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10536
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Mohamed Mahrous
2026-05-07 10:03:31 +00:00
committed by Adrien Destugues
parent ead5f1bdfc
commit 9de308df97
11 changed files with 79 additions and 89 deletions
@@ -839,7 +839,7 @@ TreeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
uint32 uint32
LongBlock::ExpectedMagic(int8 WhichDirectory, Inode* inode) LongBlock::ExpectedMagic(int8 whichDirectory, Inode* inode)
{ {
if (inode->Version() == 3) if (inode->Version() == 3)
return XFS_BMAP_CRC_MAGIC; return XFS_BMAP_CRC_MAGIC;
@@ -215,7 +215,7 @@ Inode::VerifyInode() const
} }
} }
if(fNode->di_size & (1ULL << 63)) { if ((fNode->di_size & (1ULL << 63)) != 0) {
ERROR("Invalid EOF of inode"); ERROR("Invalid EOF of inode");
return false; return false;
} }
@@ -396,10 +396,8 @@ Inode::MaxRecordsPossibleInTreeRoot()
size_t lengthOfDataFork; size_t lengthOfDataFork;
if (ForkOffset() != 0) if (ForkOffset() != 0)
lengthOfDataFork = ForkOffset() << 3; lengthOfDataFork = ForkOffset() << 3;
else if(ForkOffset() == 0) { else if (ForkOffset() == 0)
lengthOfDataFork = GetVolume()->InodeSize() lengthOfDataFork = GetVolume()->InodeSize() - CoreInodeSize();
- CoreInodeSize();
}
lengthOfDataFork -= sizeof(BlockInDataFork); lengthOfDataFork -= sizeof(BlockInDataFork);
return lengthOfDataFork / (XFS_KEY_SIZE + XFS_PTR_SIZE); return lengthOfDataFork / (XFS_KEY_SIZE + XFS_PTR_SIZE);
@@ -645,11 +643,10 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* length)
is not possible we will read file of remaining bytes. is not possible we will read file of remaining bytes.
This meathod will change when we will add file cache for xfs. This meathod will change when we will add file cache for xfs.
*/ */
if(lengthLeftInFile >= 4096) { if (lengthLeftInFile >= 4096)
*length = 4096; *length = 4096;
} else { else
*length = lengthLeftInFile; *length = lengthLeftInFile;
}
// We could be almost at the end of the file // We could be almost at the end of the file
if (lengthLeftInFile <= lengthLeftInBlock) if (lengthLeftInFile <= lengthLeftInBlock)
+1 -2
View File
@@ -389,8 +389,7 @@ NodeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
TRACE("rightMapOffset:(%" B_PRIu32 ")\n", rightMapOffset); TRACE("rightMapOffset:(%" B_PRIu32 ")\n", rightMapOffset);
for(int i = fFirstLeafMapIndex; i < fInode->DataExtentsCount(); i++) for (int i = fFirstLeafMapIndex; i < fInode->DataExtentsCount(); i++) {
{
FillMapEntry(i, fLeafMap); FillMapEntry(i, fLeafMap);
fCurLeafMapNumber = 2; fCurLeafMapNumber = 2;
status = FillBuffer(LEAF, fLeafBuffer, status = FillBuffer(LEAF, fLeafBuffer,
@@ -58,4 +58,5 @@ bool VerifyHeader(T* header, char* buffer, Inode* inode,
return true; return true;
} }
#endif #endif
@@ -60,7 +60,6 @@ Volume::Identify(int fd, XfsSuperBlock *superBlock)
ERROR("Filesystem is corrupted"); ERROR("Filesystem is corrupted");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
} }
superBlock->SwapEndian(); superBlock->SwapEndian();
@@ -358,8 +358,7 @@ xfs_access(fs_volume *_volume, fs_vnode *_node, int accessMode)
static status_t static status_t
xfs_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer, xfs_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer, size_t* _bufferSize)
size_t *_bufferSize)
{ {
TRACE("XFS_READ_SYMLINK\n"); TRACE("XFS_READ_SYMLINK\n");
@@ -387,8 +386,7 @@ xfs_unlink(fs_volume *_volume, fs_vnode *_directory, const char *name)
static status_t static status_t
xfs_create_dir(fs_volume *_volume, fs_vnode *_directory, const char *name, xfs_create_dir(fs_volume* _volume, fs_vnode* _directory, const char* name, int mode)
int mode)
{ {
return B_NOT_SUPPORTED; return B_NOT_SUPPORTED;
} }
@@ -424,8 +422,8 @@ xfs_open_dir(fs_volume * /*_volume*/, fs_vnode *_node, void **_cookie)
static status_t static status_t
xfs_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie, xfs_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie, struct dirent* buffer,
struct dirent *buffer, size_t bufferSize, uint32 *_num) size_t bufferSize, uint32* _num)
{ {
TRACE("XFS_READ_DIR\n"); TRACE("XFS_READ_DIR\n");
DirectoryIterator* iterator = (DirectoryIterator*)_cookie; DirectoryIterator* iterator = (DirectoryIterator*)_cookie;
+5 -9
View File
@@ -92,14 +92,12 @@ XfsSuperBlock::IsValid() const
} }
// Checking correct version of filesystem // Checking correct version of filesystem
if(!(IsValidVersion())) { if (!(IsValidVersion()))
return false; return false;
}
if ((Version() & XFS_SB_VERSION_NUMBITS) == 4) { if ((Version() & XFS_SB_VERSION_NUMBITS) == 4) {
if(sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD | if (sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) {
XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) {
ERROR("V4 Superblock has XFS_{P|G}QUOTA_{ENFD|CHKD} bits"); ERROR("V4 Superblock has XFS_{P|G}QUOTA_{ENFD|CHKD} bits");
return false; return false;
} }
@@ -107,9 +105,8 @@ XfsSuperBlock::IsValid() const
return true; return true;
} }
if(!(IsValidFeatureMask())) { if (!(IsValidFeatureMask()))
return false; return false;
}
// For V5 // For V5
if (XFS_MIN_CRC_BLOCKSIZE > sb_blocksize) { if (XFS_MIN_CRC_BLOCKSIZE > sb_blocksize) {
@@ -321,11 +318,10 @@ XfsSuperBlock::MagicNum() const
bool bool
XfsSuperBlock::UuidEquals(const uuid_t& u1) XfsSuperBlock::UuidEquals(const uuid_t& u1)
{ {
if((sb_features_incompat & XFS_SB_FEAT_INCOMPAT_META_UUID) != 0) { if ((sb_features_incompat & XFS_SB_FEAT_INCOMPAT_META_UUID) != 0)
return memcmp(&u1, &sb_meta_uuid, sizeof(uuid_t)) == 0; return memcmp(&u1, &sb_meta_uuid, sizeof(uuid_t)) == 0;
} else { else
return memcmp(&u1, &sb_uuid, sizeof(uuid_t)) == 0; return memcmp(&u1, &sb_uuid, sizeof(uuid_t)) == 0;
}
return false; return false;
} }