diff --git a/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp index 012e0806ce..94ac7912d6 100644 --- a/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/xfs/kernel_interface.cpp @@ -7,6 +7,8 @@ #include "Volume.h" +#define XFS_IO_SIZE 65536 + struct identify_cookie { /* super_block_struct super_block; @@ -108,7 +110,20 @@ xfs_unmount(fs_volume *_volume) static status_t xfs_read_fs_info(fs_volume *_volume, struct fs_info *info) { - return B_NOT_SUPPORTED; + Volume* volume = (Volume*)_volume->private_volume; + + info->flags = B_FS_IS_READONLY + | B_FS_HAS_ATTR | B_FS_IS_PERSISTENT; + + info->io_size = XFS_IO_SIZE; + info->block_size = volume->SuperBlock().BlockSize(); + info->total_blocks = volume->SuperBlock().TotalBlocks(); + info->free_blocks = volume->SuperBlock().FreeBlocks(); + + strlcpy(info->volume_name, volume->Name(), sizeof(info->volume_name)); + strlcpy(info->fsh_name, "xfs", sizeof(info->fsh_name)); + + return B_OK; } diff --git a/src/add-ons/kernel/file_systems/xfs/xfs.cpp b/src/add-ons/kernel/file_systems/xfs/xfs.cpp index e397b0b93e..886d476394 100644 --- a/src/add-ons/kernel/file_systems/xfs/xfs.cpp +++ b/src/add-ons/kernel/file_systems/xfs/xfs.cpp @@ -11,7 +11,7 @@ XfsSuperBlock::IsValid() { if (sb_magicnum != XFS_SB_MAGIC) return false; - if (BBLOCKSIZE <= sb_blocksize){ + if (BBLOCKSIZE > sb_blocksize){ ERROR("Basic block is less than 512 bytes!"); return false; } @@ -34,6 +34,34 @@ XfsSuperBlock::Size() } +xfs_rfsblock_t +XfsSuperBlock::TotalBlocks() +{ + return sb_dblocks; +} + + +xfs_rfsblock_t +XfsSuperBlock::TotalBlocksWithLog() +{ + return TotalBlocks() + sb_logblocks; +} + + +uint64 +XfsSuperBlock::FreeBlocks() +{ + return sb_fdblocks; +} + + +uint64 +XfsSuperBlock::UsedBlocks() +{ + return TotalBlocks() - FreeBlocks(); +} + + char* XfsSuperBlock::Name() { diff --git a/src/add-ons/kernel/file_systems/xfs/xfs.h b/src/add-ons/kernel/file_systems/xfs/xfs.h index 633611d4cc..40e3d9b503 100644 --- a/src/add-ons/kernel/file_systems/xfs/xfs.h +++ b/src/add-ons/kernel/file_systems/xfs/xfs.h @@ -29,6 +29,10 @@ public: bool IsValid(); char* Name(); uint32 BlockSize(); + xfs_rfsblock_t TotalBlocks(); + xfs_rfsblock_t TotalBlocksWithLog(); + uint64 FreeBlocks(); + uint64 UsedBlocks(); uint32 Size(); void SwapEndian(); @@ -149,6 +153,7 @@ for reverse-mapped B+Trees. I have spare0/1 defined here instead. #define XFS_AG_MAGICNUM 0x58414746 class AGFreeSpace{ public: + //TODO: void SwapEndian(); private: uint32 magicnum; @@ -172,7 +177,7 @@ class AGFreeSpace{ */ uint32 btreeblks; -} +}; #endif