:py:mod:`dissect.btrfs.stream` ============================== .. py:module:: dissect.btrfs.stream Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.btrfs.stream.Stripe dissect.btrfs.stream.Chunk dissect.btrfs.stream.ChunkStream dissect.btrfs.stream.Extent dissect.btrfs.stream.ExtentStream Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: dissect.btrfs.stream.decode_extent Attributes ~~~~~~~~~~ .. autoapisummary:: dissect.btrfs.stream.HAS_ZSTD .. py:data:: HAS_ZSTD :value: True .. py:class:: Stripe Bases: :py:obj:`NamedTuple` .. py:attribute:: fh :type: BinaryIO .. py:attribute:: offset :type: int .. py:attribute:: devid :type: int .. py:attribute:: dev_uuid :type: uuid.UUID .. py:class:: Chunk Bases: :py:obj:`NamedTuple` .. py:attribute:: offset :type: int .. py:attribute:: length :type: int .. py:attribute:: stripe_length :type: int .. py:attribute:: type :type: dissect.btrfs.c_btrfs.c_btrfs.BTRFS_BLOCK_GROUP .. py:attribute:: num_stripes :type: int .. py:attribute:: sub_stripes :type: int .. py:attribute:: data_stripes :type: int .. py:attribute:: stripes :type: list[Stripe] .. py:class:: ChunkStream(btrfs: dissect.btrfs.btrfs.Btrfs) Bases: :py:obj:`dissect.util.stream.AlignedStream` Implements a stream over Btrfs chunks, including basic RAID support. :param btrfs: The filesystem this stream belongs to. .. py:method:: 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. :param offset: The logical offset to add this chunk for. :param chunk: The chunk item to add. .. py:class:: Extent Bases: :py:obj:`NamedTuple` .. py:attribute:: compression :type: int .. py:attribute:: encryption :type: int .. py:attribute:: disk_offset :type: int .. py:attribute:: disk_length :type: int .. py:attribute:: offset :type: int .. py:attribute:: length :type: int .. py:class:: ExtentStream(fh: BinaryIO, extents: list[Extent], size: int, sector_size: int) Bases: :py:obj:`dissect.util.stream.AlignedStream` Implement a stream over Btrfs file extents. Supports compression. :param fh: The file-like object to read the data from, usually the :class:`ChunkStream` of the filesystem. :param extents: The list of extents to open the stream on. :param sector_size: The sector size of the filesystem, necessary for LZO decompression. .. py:function:: decode_extent(buf: bytes, compression: int, encryption: int, sector_size: int) -> bytes Decode a compressed extent. :param buf: The extent data to decode. :param compression: The compression type to decompress from. :param encryption: The encryption type - currently unused. :param sector_size: The sector size of the filesystem, necessary for LZO decompression.