read_fs_info() hook for xfs
xfs: read_fs_info() hook. Change-Id: I817b1ca2cd37d1dc894cdeefac967f659cfcb502 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2416 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
68ea01249e
commit
0ba51bc88f
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user