Documentation ¶
Index ¶
- Constants
- Variables
- func BmbrMaxRecs(blocklen int) int
- func Check(r io.Reader) bool
- func Mask64Lo(n int64) uint64
- type AB3B
- type AB3C
- type AG
- type AGF
- type AGFL
- type AGI
- type BmbrBlock
- type BmbtIrec
- type BmbtKey
- type BmbtPtr
- type BmbtRec
- type Btree
- type BtreeBlock
- type BtreeShortBlock
- type Cache
- type Device
- type Dir2Block
- type Dir2BlockTail
- type Dir2DataEntry
- type Dir2DataFree
- type Dir2DataUnused
- type Dir2LeafEntry
- type Dir2SfEntry
- type Dir2SfHdr
- type Dir3BlkHdr
- type Dir3DataHdr
- type DirectoryExtents
- type DirectoryLocal
- type Entry
- type FIB3
- type File
- type FileInfo
- type FileSystem
- func (xfs *FileSystem) Close() error
- func (xfs *FileSystem) DataForkSize(forkoff uint8) int
- func (xfs *FileSystem) Glob(pattern string) ([]string, error)
- func (xfs *FileSystem) Open(name string) (fs.File, error)
- func (xfs *FileSystem) ParseInode(ino uint64) (*Inode, error)
- func (xfs *FileSystem) ReadDir(name string) ([]fs.DirEntry, error)
- func (xfs *FileSystem) ReadDirInfo(name string) (fs.FileInfo, error)
- func (xfs *FileSystem) ReadFile(name string) ([]byte, error)
- func (xfs *FileSystem) Stat(name string) (fs.FileInfo, error)
- type IAB3
- type InobtRec
- type Inode
- type InodeCore
- type RegularExtent
- type SuperBlock
- func (sb SuperBlock) BlockToAgBlockNumber(n uint64) uint64
- func (sb SuperBlock) BlockToAgNumber(n uint64) uint64
- func (sb SuperBlock) BlockToPhysicalOffset(n uint64) int64
- func (sb SuperBlock) InodeAbsOffset(inodeNumber uint64) uint64
- func (sb SuperBlock) InodeOffset(inodeNumber uint64) (int, uint64, uint64)
- type SymlinkString
Constants ¶
View Source
const ( BMBT_EXNTFLAG_BITLEN = 1 INODEV3_SIZE = 176 INODE_SIZE = 96 LEAF_ENTRY_SIZE = 8 XFS_DIR2_DATA_FD_COUNT = 3 XFS_DIR2_DATA_FREE_TAG = 0xffff XFS_DIR2_DATA_ALIGN_LOG = 3 XFS_SB_MAGIC = 0x58465342 XFS_AGF_MAGIC = 0x58414746 XFS_AGI_MAGIC = 0x58414749 XFS_AGFL_MAGIC = 0x5841464c XFS_DINODE_MAGIC = 0x494e XFS_DQUOT_MAGIC = 0x4451 XFS_SYMLINK_MAGIC = 0x58534c4d XFS_ABTB_MAGIC = 0x41425442 XFS_ABTB_CRC_MAGIC = 0x41423342 XFS_ABTC_MAGIC = 0x41425443 XFS_ABTC_CRC_MAGIC = 0x41423343 XFS_IBT_MAGIC = 0x49414254 XFS_IBT_CRC_MAGIC = 0x49414233 XFS_FIBT_MAGIC = 0x46494254 XFS_FIBT_CRC_MAGIC = 0x46494233 XFS_BMAP_MAGICa = 0x424d4150 XFS_BMAP_CRC_MAGIC = 0x424d4133 XFS_DA_NODE_MAGIC = 0xfebe XFS_DA3_NODE_MAGIC = 0x3ebe XFS_DIR2_BLOCK_MAGIC = 0x58443242 XFS_DIR3_BLOCK_MAGIC = 0x58444233 // XDB3 Block Directory Magic number XFS_DIR2_DATA_MAGIC = 0x58443244 XFS_DIR3_DATA_MAGIC = 0x58444433 // XDD3 Leaf Directory Magic number XFS_DIR2_LEAF1_MAGIC = 0xd2f1 XFS_DIR3_LEAF1_MAGIC = 0x3df1 XFS_DIR2_LEAFN_MAGIC = 0xd2ff XFS_DIR3_LEAFN_MAGIC = 0x3dff XFS_DIR2_FREE_MAGIC = 0x58443246 XFS_DIR3_FREE_MAGIC = 0x58444633 XFS_ATTR_LEAF_MAGIC = 0xfbee XFS_ATTR3_LEAF_MAGIC = 0x3bee XFS_ATTR3_RMT_MAGIC = 0x5841524d XFS_RMAP_CRC_MAGIC = 0x524d4233 XFS_RTRMAP_CRC_MAGIC = 0x4d415052 XFS_REFC_CRC_MAGIC = 0x52334643 XFS_MD_MAGIC = 0x5846534d )
View Source
const ( XFS_SB_VERSION2_RESERVED1BIT = 0x00000001 XFS_SB_VERSION2_LAZYSBCOUNTBIT = 0x00000002 /* Superblk counters */ XFS_SB_VERSION2_RESERVED4BIT = 0x00000004 XFS_SB_VERSION2_ATTR2BIT = 0x00000008 /* Inline attr rework */ XFS_SB_VERSION2_PARENTBIT = 0x00000010 /* parent pointers */ XFS_SB_VERSION2_PROJID32BIT = 0x00000080 /* 32 bit project id */ XFS_SB_VERSION2_CRCBIT = 0x00000100 /* metadata CRCs */ XFS_SB_VERSION2_FTYPE = 0x00000200 /* inode type in dir */ )
View Source
const ( XFS_DIR2_DATA_SPACE int64 = iota XFS_DIR2_LEAF_SPACE XFS_DIR2_FREE_SPACE )
View Source
const ( // typedef enum xfs_dinode_fmt XFS_DINODE_FMT_DEV = iota XFS_DINODE_FMT_LOCAL XFS_DINODE_FMT_EXTENTS XFS_DINODE_FMT_BTREE XFS_DINODE_FMT_UUID XFS_DINODE_FMT_RMAP )
Variables ¶
View Source
var ( InodeSupportVersion = 3 XFS_DIR2_SPACE_SIZE = int64(1) << (32 + XFS_DIR2_DATA_ALIGN_LOG) XFS_DIR2_DATA_OFFSET = XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE XFS_DIR2_LEAF_OFFSET = XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE XFS_DIR2_FREE_OFFSET = XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE )
View Source
var ( ErrReadSizeFormat = "failed to read size error: actual(%d), expected(%d)" ErrSeekOffsetFormat = "failed to seek offset error: actual(%d), expected(%d)" )
View Source
var (
ErrOpenSymlink = xerrors.New("symlink open not support")
)
Functions ¶
func BmbrMaxRecs ¶
Types ¶
type AB3B ¶
type AB3B struct {
BtreeShortBlock
}
type AB3C ¶
type AB3C struct {
BtreeShortBlock
}
type AG ¶
type AGF ¶
type AGF struct { Magicnum uint32 Versionnum uint32 Seqno uint32 Length uint32 Roots [3]uint32 Levels [3]uint32 Flfirst uint32 Fllast uint32 Flcount uint32 Freeblks uint32 Longest uint32 Btreeblks uint32 UUID [16]byte RmapBlocks uint32 RefcountBlocks uint32 RefcountRoot uint32 RefcountLevel uint32 Spare64 [112]byte Lsn uint64 CRC uint32 Spare2 uint32 }
type BtreeBlock ¶
type BtreeBlock struct { Magic uint32 Level uint16 // tree level, 0 is leaf block. Numrecs uint16 BbLeftsib int64 BbRightsib int64 // Long version header // https://github.com/torvalds/linux/blob/d2b6f8a179194de0ffc4886ffc2c4358d86047b8/fs/xfs/libxfs/xfs_format.h#L1855 BbBlockNo uint64 BbLsn uint64 UUID [16]byte BbOwner uint64 CRC uint32 Padding int32 }
BtreeBlock is almost BmbtBlock https://github.com/torvalds/linux/blob/d2b6f8a179194de0ffc4886ffc2c4358d86047b8/fs/xfs/libxfs/xfs_format.h#L1868
type BtreeShortBlock ¶
type Cache ¶
type Cache[K comparable, V any] interface { // Add cache data Add(key K, value V) bool // Get returns key's value from the cache Get(key K) (value V, ok bool) }
type Dir2Block ¶
type Dir2Block struct { Header Dir3DataHdr Entries []Dir2DataEntry UnusedEntries []Dir2DataUnused Leafs []Dir2LeafEntry Tail Dir2BlockTail }
type Dir2BlockTail ¶
type Dir2DataEntry ¶
type Dir2DataEntry struct { Inumber uint64 Namelen uint8 EntryName string Filetype uint8 Tag uint16 }
func (Dir2DataEntry) FileType ¶
func (e Dir2DataEntry) FileType() uint8
func (Dir2DataEntry) InodeNumber ¶
func (e Dir2DataEntry) InodeNumber() uint64
func (Dir2DataEntry) Name ¶
func (e Dir2DataEntry) Name() string
type Dir2DataFree ¶
type Dir2DataUnused ¶
type Dir2LeafEntry ¶
type Dir2SfEntry ¶
type Dir2SfEntry struct { Namelen uint8 Offset [2]uint8 EntryName string Filetype uint8 Inumber uint64 Inumber32 uint32 }
func (Dir2SfEntry) FileType ¶
func (e Dir2SfEntry) FileType() uint8
func (Dir2SfEntry) InodeNumber ¶
func (e Dir2SfEntry) InodeNumber() uint64
func (Dir2SfEntry) Name ¶
func (e Dir2SfEntry) Name() string
type Dir3BlkHdr ¶
type Dir3DataHdr ¶
type Dir3DataHdr struct { Dir3BlkHdr Frees [XFS_DIR2_DATA_FD_COUNT]Dir2DataFree Padding uint32 }
type DirectoryExtents ¶
type DirectoryExtents struct {
// contains filtered or unexported fields
}
type DirectoryLocal ¶
type DirectoryLocal struct {
// contains filtered or unexported fields
}
type FIB3 ¶
type FIB3 struct {
BtreeShortBlock
}
type File ¶
type File struct { FileInfo // contains filtered or unexported fields }
File is implemented io/fs File interface
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo is implemented io/fs FileInfo interface
type FileSystem ¶
FileSystem is implemented io/fs FS interface
func NewFS ¶
func NewFS(r io.SectionReader, cache Cache[string, any]) (*FileSystem, error)
func (*FileSystem) Close ¶
func (xfs *FileSystem) Close() error
func (*FileSystem) DataForkSize ¶
func (xfs *FileSystem) DataForkSize(forkoff uint8) int
func (*FileSystem) Glob ¶
func (xfs *FileSystem) Glob(pattern string) ([]string, error)
TODO: support GlobFS Interface
func (*FileSystem) ParseInode ¶
func (xfs *FileSystem) ParseInode(ino uint64) (*Inode, error)
func (*FileSystem) ReadDirInfo ¶
func (xfs *FileSystem) ReadDirInfo(name string) (fs.FileInfo, error)
type IAB3 ¶
type IAB3 struct { Header BtreeShortBlock Inodes []InobtRec }
type Inode ¶
type Inode struct {
// contains filtered or unexported fields
}
func (*Inode) AttributeOffset ¶
type InodeCore ¶
type InodeCore struct { Magic uint16 Mode uint16 Version uint8 Format uint8 OnLink uint16 UID uint32 GID uint32 NLink uint32 ProjId uint16 Padding [8]byte Flushiter uint16 Atime uint64 Mtime uint64 Ctime uint64 Size uint64 Nblocks uint64 Extsize uint32 Nextents uint32 Anextents uint16 Forkoff uint8 Aformat uint8 Dmevmask uint32 Dmstate uint16 Flags uint16 Gen uint32 NextUnlinked uint32 CRC uint32 Changecount uint64 Lsn uint64 Flags2 uint64 Cowextsize uint32 Padding2 [12]byte Crtime uint64 Ino uint64 MetaUUID [16]byte }
type RegularExtent ¶
type RegularExtent struct {
// contains filtered or unexported fields
}
type SuperBlock ¶
type SuperBlock struct { Magicnum uint32 BlockSize uint32 Dblocks uint64 Rblocks uint64 Rextens uint64 UUID [16]byte Logstart uint64 Rootino uint64 Rbmino uint64 Rsmino uint64 Rextsize uint32 Agblocks uint32 Agcount uint32 Rbblocks uint32 Logblocks uint32 Versionnum uint16 Sectsize uint16 Inodesize uint16 Inopblock uint16 Fname [12]byte Blocklog uint8 Sectlog uint8 Inodelog uint8 Inopblog uint8 Agblklog uint8 Rextslog uint8 Inprogress uint8 ImaxPct uint8 Icount uint64 Ifree uint64 Fdblocks uint64 Frextents uint64 Uqunotino uint64 Gquotino uint64 Qflags uint16 Flags uint8 Inoalignmt uint32 Unit uint32 Width uint32 Dirblklog uint8 Logsectlog uint8 Logsectsize uint16 Logsunit uint32 Features2 uint32 BadFeatures2 uint32 FeaturesCompat uint32 FeaturesRoCompat uint32 FeaturesIncompat uint32 FeaturesLogIncompat uint32 CRC uint32 SpinoAlign uint32 Pquotino uint64 Lsn int64 MetaUUID [16]byte }
func (SuperBlock) BlockToAgBlockNumber ¶
func (sb SuperBlock) BlockToAgBlockNumber(n uint64) uint64
func (SuperBlock) BlockToAgNumber ¶
func (sb SuperBlock) BlockToAgNumber(n uint64) uint64
func (SuperBlock) BlockToPhysicalOffset ¶
func (sb SuperBlock) BlockToPhysicalOffset(n uint64) int64
func (SuperBlock) InodeAbsOffset ¶
func (sb SuperBlock) InodeAbsOffset(inodeNumber uint64) uint64
return Offset
func (SuperBlock) InodeOffset ¶
func (sb SuperBlock) InodeOffset(inodeNumber uint64) (int, uint64, uint64)
return (AG number), (Inode Block), (Inode Offset)
type SymlinkString ¶
type SymlinkString struct {
Name string
}
Click to show internal directories.
Click to hide internal directories.