dissect.btrfs.stream
¶
Module Contents¶
Classes¶
Implements a stream over Btrfs chunks, including basic RAID support. |
|
Implement a stream over Btrfs file extents. |
Functions¶
Decode a compressed extent. |
Attributes¶
- dissect.btrfs.stream.HAS_ZSTD = True¶
- class dissect.btrfs.stream.Stripe¶
Bases:
NamedTuple
- fh: BinaryIO¶
- offset: int¶
- devid: int¶
- dev_uuid: uuid.UUID¶
- class dissect.btrfs.stream.Chunk¶
Bases:
NamedTuple
- offset: int¶
- length: int¶
- stripe_length: int¶
- type: dissect.btrfs.c_btrfs.c_btrfs.BTRFS_BLOCK_GROUP¶
- num_stripes: int¶
- sub_stripes: int¶
- data_stripes: int¶
- class dissect.btrfs.stream.ChunkStream(btrfs: dissect.btrfs.btrfs.Btrfs)¶
Bases:
dissect.util.stream.AlignedStream
Implements a stream over Btrfs chunks, including basic RAID support.
- Parameters:
btrfs – The filesystem this stream belongs to.
- btrfs¶
- add(offset: int, chunk: dissect.btrfs.c_btrfs.c_btrfs.btrfs_chunk) None ¶
Add a chunk to the stream.
This will iterate all stripes and link them to the appropriate devices. Allows for missing devices, if the RAID profile allows this.
- Parameters:
offset – The logical offset to add this chunk for.
chunk – The chunk item to add.
- class dissect.btrfs.stream.Extent¶
Bases:
NamedTuple
- compression: int¶
- encryption: int¶
- disk_offset: int¶
- disk_length: int¶
- offset: int¶
- length: int¶
- class dissect.btrfs.stream.ExtentStream(fh: BinaryIO, extents: list[Extent], size: int, sector_size: int)¶
Bases:
dissect.util.stream.AlignedStream
Implement a stream over Btrfs file extents.
Supports compression.
- Parameters:
fh – The file-like object to read the data from, usually the
ChunkStream
of the filesystem.extents – The list of extents to open the stream on.
sector_size – The sector size of the filesystem, necessary for LZO decompression.
- extents¶
- offset = 0¶
- sector_size¶
- dissect.btrfs.stream.decode_extent(buf: bytes, compression: int, encryption: int, sector_size: int) bytes ¶
Decode a compressed extent.
- Parameters:
buf – The extent data to decode.
compression – The compression type to decompress from.
encryption – The encryption type - currently unused.
sector_size – The sector size of the filesystem, necessary for LZO decompression.