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:
committed by
Adrien Destugues
parent
ead5f1bdfc
commit
9de308df97
@@ -839,9 +839,9 @@ TreeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
|
||||
|
||||
|
||||
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;
|
||||
else
|
||||
return XFS_BMAP_MAGIC;
|
||||
@@ -852,4 +852,4 @@ uint32
|
||||
LongBlock::CRCOffset()
|
||||
{
|
||||
return offsetof(LongBlock, bb_crc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,17 +158,17 @@ Inode::VerifyForkoff() const
|
||||
if (!fNode->di_forkoff)
|
||||
return true;
|
||||
|
||||
switch(Format()) {
|
||||
switch (Format()) {
|
||||
case XFS_DINODE_FMT_DEV:
|
||||
if (fNode->di_forkoff != (ROUNDUP(sizeof(uint32), 8) >> 3))
|
||||
return false;
|
||||
return false;
|
||||
break;
|
||||
case XFS_DINODE_FMT_LOCAL:
|
||||
case XFS_DINODE_FMT_EXTENTS:
|
||||
case XFS_DINODE_FMT_BTREE:
|
||||
if (fNode->di_forkoff >= (LITINO(fVolume) >> 3))
|
||||
return false;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ Inode::VerifyForkoff() const
|
||||
bool
|
||||
Inode::VerifyInode() const
|
||||
{
|
||||
if(fNode->di_magic != INODE_MAGIC) {
|
||||
if (fNode->di_magic != INODE_MAGIC) {
|
||||
ERROR("Bad inode magic number");
|
||||
return false;
|
||||
}
|
||||
@@ -194,28 +194,28 @@ Inode::VerifyInode() const
|
||||
// verify version 3 inodes first
|
||||
if (Version() == 3) {
|
||||
|
||||
if(!HAS_V3INODES(fVolume)) {
|
||||
if (!HAS_V3INODES(fVolume)) {
|
||||
ERROR("xfs v4 doesn't have v3 inodes");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!xfs_verify_cksum(fBuffer, fVolume->InodeSize(), INODE_CRC_OFF)) {
|
||||
if (!xfs_verify_cksum(fBuffer, fVolume->InodeSize(), INODE_CRC_OFF)) {
|
||||
ERROR("Inode is corrupted");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fNode->di_ino != fId) {
|
||||
if (fNode->di_ino != fId) {
|
||||
ERROR("Incorrect inode number");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!fVolume->UuidEquals(fNode->di_uuid)) {
|
||||
if (!fVolume->UuidEquals(fNode->di_uuid)) {
|
||||
ERROR("UUID is incorrect");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(fNode->di_size & (1ULL << 63)) {
|
||||
if ((fNode->di_size & (1ULL << 63)) != 0) {
|
||||
ERROR("Invalid EOF of inode");
|
||||
return false;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ Inode::VerifyInode() const
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!VerifyForkoff()) {
|
||||
if (!VerifyForkoff()) {
|
||||
ERROR("Invalid inode fork offset");
|
||||
return false;
|
||||
}
|
||||
@@ -396,10 +396,8 @@ Inode::MaxRecordsPossibleInTreeRoot()
|
||||
size_t lengthOfDataFork;
|
||||
if (ForkOffset() != 0)
|
||||
lengthOfDataFork = ForkOffset() << 3;
|
||||
else if(ForkOffset() == 0) {
|
||||
lengthOfDataFork = GetVolume()->InodeSize()
|
||||
- CoreInodeSize();
|
||||
}
|
||||
else if (ForkOffset() == 0)
|
||||
lengthOfDataFork = GetVolume()->InodeSize() - CoreInodeSize();
|
||||
|
||||
lengthOfDataFork -= sizeof(BlockInDataFork);
|
||||
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.
|
||||
This meathod will change when we will add file cache for xfs.
|
||||
*/
|
||||
if(lengthLeftInFile >= 4096) {
|
||||
if (lengthLeftInFile >= 4096)
|
||||
*length = 4096;
|
||||
} else {
|
||||
else
|
||||
*length = lengthLeftInFile;
|
||||
}
|
||||
|
||||
// We could be almost at the end of the file
|
||||
if (lengthLeftInFile <= lengthLeftInBlock)
|
||||
@@ -708,7 +705,7 @@ Inode::GetFromDisk()
|
||||
|
||||
TRACE("AgNumber: (%" B_PRIu32 "), AgRelativeIno: (%" B_PRIu32 "),"
|
||||
"AgRelativeBlockNum: (%" B_PRIu32 "),Offset: (%" B_PRId64 "),"
|
||||
"len: (%" B_PRIu32 ")\n", agNo,agRelativeInodeNo, agBlock, offset, len);
|
||||
"len: (%" B_PRIu32 ")\n", agNo, agRelativeInodeNo, agBlock, offset, len);
|
||||
|
||||
if (agNo > fVolume->AgCount()) {
|
||||
ERROR("Inode::GetFromDisk : AG Number more than number of AGs");
|
||||
@@ -727,7 +724,7 @@ Inode::GetFromDisk()
|
||||
return B_IO_ERROR;
|
||||
}
|
||||
|
||||
if(fVolume->IsVersion5())
|
||||
if (fVolume->IsVersion5())
|
||||
memcpy(fNode, fBuffer, sizeof(Inode::Dinode));
|
||||
else
|
||||
memcpy(fNode, fBuffer, INODE_CRC_OFF);
|
||||
|
||||
@@ -147,7 +147,7 @@ LeafAttribute::Stat(attr_cookie* cookie, struct stat& stat)
|
||||
// check if this attribute exists
|
||||
status = Lookup(fName, &namelength);
|
||||
|
||||
if(status != B_OK)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
// We have valid attribute entry to stat
|
||||
@@ -170,7 +170,7 @@ LeafAttribute::Read(attr_cookie* cookie, off_t pos, uint8* buffer, size_t* lengt
|
||||
{
|
||||
TRACE("LeafAttribute::Read\n");
|
||||
|
||||
if(pos < 0)
|
||||
if (pos < 0)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
fName = cookie->name;
|
||||
@@ -237,7 +237,7 @@ LeafAttribute::GetNext(char* name, size_t* nameLength)
|
||||
{
|
||||
TRACE("LeafAttribute::GetNext\n");
|
||||
|
||||
AttrLeafHeader* header = AttrLeafHeader::Create(fInode,fLeafBuffer);
|
||||
AttrLeafHeader* header = AttrLeafHeader::Create(fInode, fLeafBuffer);
|
||||
AttrLeafEntry* firstEntry = (AttrLeafEntry*)(fLeafBuffer + AttrLeafHeader::Size(fInode));
|
||||
|
||||
int totalEntries = header->Count();
|
||||
@@ -283,7 +283,7 @@ LeafAttribute::Lookup(const char* name, size_t* nameLength)
|
||||
uint32 hashValueOfRequest = hashfunction(name, *nameLength);
|
||||
TRACE("Hashval:(%" B_PRIu32 ")\n", hashValueOfRequest);
|
||||
|
||||
AttrLeafHeader* header = AttrLeafHeader::Create(fInode,fLeafBuffer);
|
||||
AttrLeafHeader* header = AttrLeafHeader::Create(fInode, fLeafBuffer);
|
||||
AttrLeafEntry* entry = (AttrLeafEntry*)(fLeafBuffer + AttrLeafHeader::Size(fInode));
|
||||
|
||||
int numberOfLeafEntries = header->Count();
|
||||
|
||||
@@ -214,7 +214,7 @@ LeafDirectory::SearchAndFillDataMap(uint64 blockNo)
|
||||
{
|
||||
int len = fInode->DataExtentsCount();
|
||||
|
||||
for(int i = 0; i < len - 1; i++) {
|
||||
for (int i = 0; i < len - 1; i++) {
|
||||
FillMapEntry(i, fDataMap);
|
||||
if (fDataMap->br_startoff <= blockNo
|
||||
&& (blockNo <= fDataMap->br_startoff + fDataMap->br_blockcount - 1))
|
||||
|
||||
@@ -139,7 +139,7 @@ NodeDirectory::FillBuffer(int type, char* blockBuffer, int howManyBlocksFurthur)
|
||||
if (type == DATA) {
|
||||
fDataBuffer = blockBuffer;
|
||||
ExtentDataHeader* header = ExtentDataHeader::Create(fInode, fDataBuffer);
|
||||
if(header == NULL)
|
||||
if (header == NULL)
|
||||
return B_NO_MEMORY;
|
||||
if (!VerifyHeader<ExtentDataHeader>(header, fDataBuffer, fInode,
|
||||
howManyBlocksFurthur, fDataMap, XFS_NODE)) {
|
||||
@@ -379,7 +379,7 @@ NodeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
|
||||
/* Leaf now has the nodes. */
|
||||
uint32 rightMapOffset;
|
||||
status = FindHashInNode(hashValueOfRequest, &rightMapOffset);
|
||||
if(status != B_OK)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
if (rightMapOffset == 1) {
|
||||
@@ -389,8 +389,7 @@ NodeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
|
||||
|
||||
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);
|
||||
fCurLeafMapNumber = 2;
|
||||
status = FillBuffer(LEAF, fLeafBuffer,
|
||||
@@ -399,7 +398,7 @@ NodeDirectory::Lookup(const char* name, size_t length, xfs_ino_t* ino)
|
||||
return status;
|
||||
fCurLeafBufferNumber = 2;
|
||||
ExtentLeafHeader* leafHeader = ExtentLeafHeader::Create(fInode, fLeafBuffer);
|
||||
if(leafHeader == NULL)
|
||||
if (leafHeader == NULL)
|
||||
return B_NO_MEMORY;
|
||||
ExtentLeafEntry* leafEntry =
|
||||
(ExtentLeafEntry*)(void*)(fLeafBuffer + ExtentLeafHeader::Size(fInode));
|
||||
|
||||
@@ -59,7 +59,7 @@ NodeAttribute::Init()
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
NodeHeader* header = NodeHeader::Create(fInode,fNodeBuffer);
|
||||
NodeHeader* header = NodeHeader::Create(fInode, fNodeBuffer);
|
||||
if (header == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
@@ -171,7 +171,7 @@ NodeAttribute::Stat(attr_cookie* cookie, struct stat& stat)
|
||||
// check if this attribute exists
|
||||
status = Lookup(fName, &namelength);
|
||||
|
||||
if(status != B_OK)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
// We have valid attribute entry to stat
|
||||
@@ -355,7 +355,7 @@ NodeAttribute::Lookup(const char* name, size_t* nameLength)
|
||||
xfs_fsblock_t block = _LogicalToFileSystemBlock(logicalBlock);
|
||||
_FillBuffer(fLeafBuffer, block);
|
||||
|
||||
AttrLeafHeader* header = AttrLeafHeader::Create(fInode,fLeafBuffer);
|
||||
AttrLeafHeader* header = AttrLeafHeader::Create(fInode, fLeafBuffer);
|
||||
AttrLeafEntry* entry = (AttrLeafEntry*)(fLeafBuffer + AttrLeafHeader::Size(fInode));
|
||||
|
||||
int numberOfLeafEntries = header->Count();
|
||||
@@ -397,4 +397,4 @@ NodeAttribute::Lookup(const char* name, size_t* nameLength)
|
||||
}
|
||||
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ ShortAttribute::Read(attr_cookie* cookie, off_t pos, uint8* buffer, size_t* leng
|
||||
|
||||
status_t status = Lookup(fName, &namelength);
|
||||
|
||||
if(status != B_OK)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
if (pos + *length > fEntry->valuelen)
|
||||
|
||||
@@ -35,7 +35,7 @@ bool VerifyHeader(T* header, char* buffer, Inode* inode,
|
||||
}
|
||||
|
||||
// For Block header we pass NULL
|
||||
if(map != NULL) {
|
||||
if (map != NULL) {
|
||||
uint64 actualBlockToRead = inode->FileSystemBlockToAddr(map->br_startblock
|
||||
+ howManyBlocksFurther) / XFS_MIN_BLOCKSIZE;
|
||||
|
||||
@@ -58,4 +58,5 @@ bool VerifyHeader(T* header, char* buffer, Inode* inode,
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ Volume::Identify(int fd, XfsSuperBlock *superBlock)
|
||||
//Create a buffer of 512 bytes for Crc verification
|
||||
char buf[512];
|
||||
|
||||
if(read_pos(fd, 0, buf, 512) != 512)
|
||||
if (read_pos(fd, 0, buf, 512) != 512)
|
||||
return B_IO_ERROR;
|
||||
|
||||
memcpy(superBlock, buf, sizeof(XfsSuperBlock));
|
||||
@@ -56,11 +56,10 @@ Volume::Identify(int fd, XfsSuperBlock *superBlock)
|
||||
|
||||
TRACE("Superblock Crc: (%" B_PRIu32 ")\n", superBlock->Crc());
|
||||
|
||||
if(!xfs_verify_cksum(buf, 512, XfsSuperBlock::Offset_crc())) {
|
||||
ERROR("Filesystem is corrupted");
|
||||
return B_BAD_VALUE;
|
||||
if (!xfs_verify_cksum(buf, 512, XfsSuperBlock::Offset_crc())) {
|
||||
ERROR("Filesystem is corrupted");
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
superBlock->SwapEndian();
|
||||
|
||||
@@ -123,7 +123,7 @@ xfs_read_fs_info(fs_volume *_volume, struct fs_info *info)
|
||||
strlcpy(info->volume_name, volume->Name(), sizeof(info->volume_name));
|
||||
|
||||
// Filesystem name
|
||||
if(volume->IsVersion5())
|
||||
if (volume->IsVersion5())
|
||||
strlcpy(info->fsh_name, "xfs V5", sizeof(info->fsh_name));
|
||||
else
|
||||
strlcpy(info->fsh_name, "xfs V4", sizeof(info->fsh_name));
|
||||
@@ -268,7 +268,7 @@ xfs_read_stat(fs_volume *_volume, fs_vnode *_node, struct stat *stat)
|
||||
inode->GetChangeTime(stat->st_ctim);
|
||||
|
||||
// Only version 3 Inodes has creation time
|
||||
if(inode->Version() == 3)
|
||||
if (inode->Version() == 3)
|
||||
inode->GetCreationTime(stat->st_crtim);
|
||||
else
|
||||
inode->GetChangeTime(stat->st_crtim);
|
||||
@@ -311,7 +311,7 @@ xfs_open(fs_volume * /*_volume*/, fs_vnode *_node, int openMode,
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_read(fs_volume *_volume, fs_vnode *_node, void *_cookie, off_t pos,
|
||||
xfs_read(fs_volume* _volume, fs_vnode* _node, void* _cookie, off_t pos,
|
||||
void *buffer, size_t *_length)
|
||||
{
|
||||
TRACE("Inode::ReadAt: pos:(%ld), *length:(%ld)\n", pos, *_length);
|
||||
@@ -327,14 +327,14 @@ xfs_read(fs_volume *_volume, fs_vnode *_node, void *_cookie, off_t pos,
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_close(fs_volume *_volume, fs_vnode *_node, void *_cookie)
|
||||
xfs_close(fs_volume* _volume, fs_vnode* _node, void* _cookie)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_free_cookie(fs_volume *_volume, fs_vnode *_node, void *_cookie)
|
||||
xfs_free_cookie(fs_volume* _volume, fs_vnode* _node, void* _cookie)
|
||||
{
|
||||
TRACE("XFS_FREE_COOKIE:\n");
|
||||
file_cookie* cookie = (file_cookie*)_cookie;
|
||||
@@ -350,7 +350,7 @@ xfs_free_cookie(fs_volume *_volume, fs_vnode *_node, void *_cookie)
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_access(fs_volume *_volume, fs_vnode *_node, int accessMode)
|
||||
xfs_access(fs_volume* _volume, fs_vnode* _node, int accessMode)
|
||||
{
|
||||
Inode* inode = (Inode*)_node->private_node;
|
||||
return inode->CheckPermissions(accessMode);
|
||||
@@ -358,8 +358,7 @@ xfs_access(fs_volume *_volume, fs_vnode *_node, int accessMode)
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer,
|
||||
size_t *_bufferSize)
|
||||
xfs_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer, size_t* _bufferSize)
|
||||
{
|
||||
TRACE("XFS_READ_SYMLINK\n");
|
||||
|
||||
@@ -377,7 +376,7 @@ xfs_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer,
|
||||
|
||||
|
||||
status_t
|
||||
xfs_unlink(fs_volume *_volume, fs_vnode *_directory, const char *name)
|
||||
xfs_unlink(fs_volume* _volume, fs_vnode* _directory, const char* name)
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -387,22 +386,21 @@ xfs_unlink(fs_volume *_volume, fs_vnode *_directory, const char *name)
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_create_dir(fs_volume *_volume, fs_vnode *_directory, const char *name,
|
||||
int mode)
|
||||
xfs_create_dir(fs_volume* _volume, fs_vnode* _directory, const char* name, int mode)
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_remove_dir(fs_volume *_volume, fs_vnode *_directory, const char *name)
|
||||
xfs_remove_dir(fs_volume* _volume, fs_vnode* _directory, const char* name)
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_open_dir(fs_volume * /*_volume*/, fs_vnode *_node, void **_cookie)
|
||||
xfs_open_dir(fs_volume* /*_volume*/, fs_vnode* _node, void** _cookie)
|
||||
{
|
||||
Inode* inode = (Inode*)_node->private_node;
|
||||
TRACE("XFS_OPEN_DIR: (%ld)\n", inode->ID());
|
||||
@@ -424,8 +422,8 @@ xfs_open_dir(fs_volume * /*_volume*/, fs_vnode *_node, void **_cookie)
|
||||
|
||||
|
||||
static status_t
|
||||
xfs_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie,
|
||||
struct dirent *buffer, size_t bufferSize, uint32 *_num)
|
||||
xfs_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie, struct dirent* buffer,
|
||||
size_t bufferSize, uint32* _num)
|
||||
{
|
||||
TRACE("XFS_READ_DIR\n");
|
||||
DirectoryIterator* iterator = (DirectoryIterator*)_cookie;
|
||||
|
||||
@@ -56,19 +56,19 @@ bool
|
||||
XfsSuperBlock::IsValidFeatureMask() const
|
||||
{
|
||||
// Version 5 superblock feature mask validation
|
||||
if(sb_features_compat & XFS_SB_FEAT_COMPAT_UNKNOWN) {
|
||||
if (sb_features_compat & XFS_SB_FEAT_COMPAT_UNKNOWN) {
|
||||
ERROR("Superblock has unknown compatible features enabled");
|
||||
ERROR("Use more recent kernal");
|
||||
}
|
||||
|
||||
// We cannot have write support if this is set
|
||||
if(sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_UNKNOWN) {
|
||||
// We cannot have write support if this is set
|
||||
if (sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_UNKNOWN) {
|
||||
ERROR("Superblock has unknown read-only compatible features enabled");
|
||||
ERROR("Filesystem is read-only");
|
||||
}
|
||||
|
||||
// check for incompatible features
|
||||
if(sb_features_incompat & XFS_SB_FEAT_INCOMPAT_UNKNOWN) {
|
||||
if (sb_features_incompat & XFS_SB_FEAT_INCOMPAT_UNKNOWN) {
|
||||
ERROR("Superblock has unknown incompatible features enabled");
|
||||
return false;
|
||||
}
|
||||
@@ -92,14 +92,12 @@ XfsSuperBlock::IsValid() const
|
||||
}
|
||||
|
||||
// Checking correct version of filesystem
|
||||
if(!(IsValidVersion())) {
|
||||
if (!(IsValidVersion()))
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Version() & XFS_SB_VERSION_NUMBITS) == 4) {
|
||||
|
||||
if(sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD |
|
||||
XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) {
|
||||
if (sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) {
|
||||
ERROR("V4 Superblock has XFS_{P|G}QUOTA_{ENFD|CHKD} bits");
|
||||
return false;
|
||||
}
|
||||
@@ -107,9 +105,8 @@ XfsSuperBlock::IsValid() const
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!(IsValidFeatureMask())) {
|
||||
if (!(IsValidFeatureMask()))
|
||||
return false;
|
||||
}
|
||||
|
||||
// For V5
|
||||
if (XFS_MIN_CRC_BLOCKSIZE > sb_blocksize) {
|
||||
@@ -130,23 +127,23 @@ XfsSuperBlock::IsValid() const
|
||||
*/
|
||||
|
||||
// Sanity Checking
|
||||
if(sb_agcount <= 0
|
||||
|| sb_sectsize < XFS_MIN_SECTORSIZE
|
||||
|| sb_sectsize > XFS_MAX_SECTORSIZE
|
||||
|| sb_sectlog < XFS_MIN_SECTORSIZE_LOG
|
||||
|| sb_sectlog > XFS_MAX_SECTORSIZE_LOG
|
||||
|| sb_sectsize != (1 << sb_sectlog)
|
||||
|| sb_blocksize < XFS_MIN_BLOCKSIZE
|
||||
|| sb_blocksize > XFS_MAX_BLOCKSIZE
|
||||
|| sb_blocklog < XFS_MIN_BLOCKSIZE_LOG
|
||||
|| sb_blocklog > XFS_MAX_BLOCKSIZE_LOG
|
||||
|| sb_blocksize != (uint32)(1 << sb_blocklog)
|
||||
|| sb_dirblklog + sb_blocklog > XFS_MAX_BLOCKSIZE_LOG
|
||||
|| sb_inodesize < INODE_MIN_SIZE
|
||||
|| sb_inodesize > INODE_MAX_SIZE
|
||||
|| sb_inodelog < INODE_MINSIZE_LOG
|
||||
|| sb_inodelog > INODE_MAXSIZE_LOG
|
||||
|| sb_inodesize != (1 << sb_inodelog)) {
|
||||
if (sb_agcount <= 0
|
||||
|| sb_sectsize < XFS_MIN_SECTORSIZE
|
||||
|| sb_sectsize > XFS_MAX_SECTORSIZE
|
||||
|| sb_sectlog < XFS_MIN_SECTORSIZE_LOG
|
||||
|| sb_sectlog > XFS_MAX_SECTORSIZE_LOG
|
||||
|| sb_sectsize != (1 << sb_sectlog)
|
||||
|| sb_blocksize < XFS_MIN_BLOCKSIZE
|
||||
|| sb_blocksize > XFS_MAX_BLOCKSIZE
|
||||
|| sb_blocklog < XFS_MIN_BLOCKSIZE_LOG
|
||||
|| sb_blocklog > XFS_MAX_BLOCKSIZE_LOG
|
||||
|| sb_blocksize != (uint32)(1 << sb_blocklog)
|
||||
|| sb_dirblklog + sb_blocklog > XFS_MAX_BLOCKSIZE_LOG
|
||||
|| sb_inodesize < INODE_MIN_SIZE
|
||||
|| sb_inodesize > INODE_MAX_SIZE
|
||||
|| sb_inodelog < INODE_MINSIZE_LOG
|
||||
|| sb_inodelog > INODE_MAXSIZE_LOG
|
||||
|| sb_inodesize != (1 << sb_inodelog)) {
|
||||
|
||||
ERROR("Sanity checking failed");
|
||||
return false;
|
||||
@@ -321,11 +318,10 @@ XfsSuperBlock::MagicNum() const
|
||||
bool
|
||||
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;
|
||||
} else {
|
||||
else
|
||||
return memcmp(&u1, &sb_uuid, sizeof(uuid_t)) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user