Skip to content

Commit 5bc4e1d

Browse files
Corv0Oqkaiser
authored andcommitted
feat(handler): add support for BTRFS stream
Instead of relying on an external CRC32C package, I implemented the algorithm directly in Python. This manual implementation was necessary because existing libraries lacked the flexibility to support the specific requirement used by BTRFS stream. The checksum uses the Castagnoli reflected polynomial with a seed of 0x0 and no final XOR operation. crc32c and crcmod wasn't able to fullfill those requirements and calculate the right checksum.
1 parent 8e0e8bd commit 5bc4e1d

42 files changed

Lines changed: 731 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/handlers.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
| [`ARC`](#arc) | ARCHIVE | :octicons-check-16: |
99
| [`ARJ`](#arj) | ARCHIVE | :octicons-check-16: |
1010
| [`AUTEL ECC`](#autel-ecc) | ARCHIVE | :octicons-check-16: |
11+
| [`BTRFS STREAM`](#btrfs-stream) | FILESYSTEM | :octicons-alert-fill-12: |
1112
| [`BZIP2`](#bzip2) | COMPRESSION | :octicons-check-16: |
1213
| [`CAB`](#cab) | ARCHIVE | :octicons-check-16: |
1314
| [`COMPRESS`](#compress) | COMPRESSION | :octicons-check-16: |
@@ -203,6 +204,26 @@
203204
=== "References"
204205

205206
- [Autel ECC Decryption Script (Sector7)](https://gist.github.com/sector7-nl/3fc815cd2497817ad461bfbd393294cb){ target="_blank" }
207+
## BTRFS Stream
208+
209+
!!! warning "Partially supported"
210+
211+
=== "Description"
212+
213+
A BTRFS send stream is a binary format used to transfer btrfs subvolume snapshots between filesystems. It encodes filesystem operations (file creation, directory structure, data writes, metadata) as a sequence of commands that can be replayed by btrfs receive to reconstruct the original snapshot. It supports both full sends (complete snapshot) and incremental sends (diff between two snapshots).
214+
215+
---
216+
217+
- **Handler type:** FileSystem
218+
219+
220+
=== "References"
221+
222+
- [BTRFS Stream Official Documentation](https://btrfs.readthedocs.io/en/latest/dev/dev-send-stream.html){ target="_blank" }
223+
224+
=== "Limitations"
225+
226+
- Does not support incremental streams.
206227
## bzip2
207228

208229
!!! success "Fully supported"

python/unblob/handlers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
)
4343
from .executable import elf, xalz
4444
from .filesystem import (
45+
btrfs_stream,
4546
cramfs,
4647
extfs,
4748
fat,
@@ -141,6 +142,7 @@
141142
qnx_deflate.QNXDeflateHandler,
142143
ufs.UFS1Handler,
143144
ufs.UFS2Handler,
145+
btrfs_stream.BTRFSStreamHandler,
144146
)
145147

146148
BUILTIN_DIR_HANDLERS: DirectoryHandlers = (

0 commit comments

Comments
 (0)