2 * Copyright 2017, Chế Vũ Gia Hy, cvghy116@gmail.com.
3 * Copyright 2011, Jérôme Duval, korli@users.berlios.de.
4 * Copyright 2008-2010, Axel Dörfler, axeld@pinc-software.de.
5 * This file may be used under the terms of the MIT License.
15 VOLUME_READ_ONLY
= 0x0001
23 class ExtentAllocator
;
28 Volume(fs_volume
* volume
);
31 status_t
Mount(const char* device
, uint32 flags
);
34 bool IsValidSuperBlock();
35 bool IsReadOnly() const
36 { return (fFlags
& VOLUME_READ_ONLY
) != 0; }
38 Inode
* RootNode() const { return fRootNode
; }
39 int Device() const { return fDevice
; }
42 { return fFSVolume
? fFSVolume
->id
: -1; }
43 fs_volume
* FSVolume() const { return fFSVolume
; }
44 const char* Name() const;
45 BTree
* FSTree() const { return fFSTree
; }
46 BTree
* ExtentTree() const { return fExtentTree
; }
47 BTree
* RootTree() const { return fRootTree
; }
49 uint32
SectorSize() const { return fSectorSize
; }
50 uint32
MaxInlineSize() const
51 { return fSectorSize
/ 2; }
52 uint32
BlockSize() const { return fBlockSize
; }
53 ino_t
GetNextInodeID() { return ++fLargestInodeID
; }
54 Chunk
* SystemChunk() const { return fChunk
; }
55 Journal
* GetJournal() const { return fJournal
; }
56 ExtentAllocator
* GetAllocator() const { return fExtentAllocator
; }
58 btrfs_super_block
& SuperBlock() { return fSuperBlock
; }
60 status_t
LoadSuperBlock();
63 void* BlockCache() { return fBlockCache
; }
65 static status_t
Identify(int fd
, btrfs_super_block
* superBlock
);
67 status_t
FindBlock(off_t logical
, fsblock_t
& physical
);
68 status_t
FindBlock(off_t logical
, off_t
& physical
);
69 status_t
GetNewBlock(uint64
& logical
, fsblock_t
& physical
,
70 uint64 start
= (uint64
)-1,
71 uint64 flags
= BTRFS_BLOCKGROUP_FLAG_METADATA
);
77 ino_t fLargestInodeID
;
78 btrfs_super_block fSuperBlock
;
88 ExtentAllocator
* fExtentAllocator
;