{"id":50844172,"url":"https://github.com/suhteevah/btrfs-nostd","last_synced_at":"2026-06-14T08:05:46.075Z","repository":{"id":349504678,"uuid":"1199734453","full_name":"suhteevah/btrfs-nostd","owner":"suhteevah","description":"no_std btrfs filesystem with read/write support in Rust","archived":false,"fork":false,"pushed_at":"2026-06-08T08:02:02.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-08T10:04:48.225Z","etag":null,"topics":["bare-metal","btrfs","embedded","filesystem","no-std","operating-system","osdev","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suhteevah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-02T16:47:53.000Z","updated_at":"2026-05-30T06:06:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"99382483-3d17-4036-836f-4023104a289a","html_url":"https://github.com/suhteevah/btrfs-nostd","commit_stats":null,"previous_names":["suhteevah/btrfs-nostd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suhteevah/btrfs-nostd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Fbtrfs-nostd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Fbtrfs-nostd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Fbtrfs-nostd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Fbtrfs-nostd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhteevah","download_url":"https://codeload.github.com/suhteevah/btrfs-nostd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Fbtrfs-nostd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34313641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bare-metal","btrfs","embedded","filesystem","no-std","operating-system","osdev","rust"],"created_at":"2026-06-14T08:05:42.398Z","updated_at":"2026-06-14T08:05:46.070Z","avatar_url":"https://github.com/suhteevah.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# btrfs-nostd\n\n[![no_std](https://img.shields.io/badge/no__std-yes-green)](https://rust-embedded.github.io/book/)\n[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue)](LICENSE-MIT)\n\nA `no_std` btrfs filesystem implementation in pure Rust with read and write support.\n\nDesigned for bare-metal, embedded, and OS kernel environments where the Rust standard\nlibrary is not available. The only dependency is `log` for optional diagnostic output.\n\n## Features\n\n- **Superblock** parsing and validation (primary at 0x10000, mirrors supported)\n- **B-tree traversal** with binary search (search, walk, collect)\n- **B-tree modification** (insert into leaf, leaf splitting with COW semantics)\n- **CRC32C checksums** (Castagnoli) for superblock, metadata nodes, and directory name hashing\n- **Chunk mapping** -- logical to physical address translation via sys_chunk_array bootstrap and full chunk tree\n- **Inode items** -- read/write metadata (size, mode, timestamps, permissions, uid/gid)\n- **Directory entries** -- DIR_ITEM (hash-keyed O(1) lookup) and DIR_INDEX (ordered iteration)\n- **File extents** -- inline data (small files in B-tree leaves), regular extents, prealloc, hole detection\n- **High-level API** -- `read_file`, `write_file`, `mkdir`, `list_dir`, path resolution\n\n## Usage\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\nbtrfs-nostd = \"0.1\"\n```\n\nImplement the `BlockDevice` trait for your storage backend:\n\n```rust\nuse btrfs_nostd::{BtrFs, BlockDevice, BtrfsError};\n\nstruct RamDisk {\n    data: Vec\u003cu8\u003e,\n}\n\nimpl BlockDevice for RamDisk {\n    fn read_bytes(\u0026self, offset: u64, buf: \u0026mut [u8]) -\u003e Result\u003c(), BtrfsError\u003e {\n        let start = offset as usize;\n        let end = start + buf.len();\n        if end \u003e self.data.len() {\n            return Err(BtrfsError::IoError);\n        }\n        buf.copy_from_slice(\u0026self.data[start..end]);\n        Ok(())\n    }\n\n    fn write_bytes(\u0026self, offset: u64, buf: \u0026[u8]) -\u003e Result\u003c(), BtrfsError\u003e {\n        // For a real implementation, write to your storage\n        Err(BtrfsError::IoError)\n    }\n}\n\n// Mount and use:\nlet device = RamDisk { data: disk_image };\nlet fs = BtrFs::mount(device).expect(\"mount failed\");\n\nlet contents = fs.read_file(b\"/hello.txt\").expect(\"read failed\");\nlet entries = fs.list_dir(b\"/\").expect(\"listdir failed\");\n```\n\n## Supported on-disk structures\n\n| Structure | Read | Write |\n|-----------|------|-------|\n| Superblock | Yes | Yes |\n| B-tree nodes (leaf + internal) | Yes | Yes |\n| Chunk items / stripe mapping | Yes | Yes |\n| Inode items | Yes | Yes |\n| Directory items (DIR_ITEM, DIR_INDEX) | Yes | Yes |\n| File extents (inline) | Yes | Yes |\n| File extents (regular) | Yes | Partial |\n| File extents (prealloc) | Yes | No |\n| Compressed extents | No | No |\n\n## Limitations\n\n- Single-device only (uses first stripe for RAID configurations)\n- No compression support (zlib, LZO, ZSTD extents return an error)\n- Large file writes currently use inline extents (no data extent allocation)\n- No extent tree updates (free space tracking)\n- No transaction/journal support\n- File overwrite creates a new inode rather than updating in-place\n- Leaf splitting during writes is detected but not yet wired into the write path\n\n## Architecture\n\nThe crate is organized into focused modules:\n\n- `superblock` -- On-disk superblock layout, parsing, serialization\n- `key` -- B-tree key types and ordering\n- `item` -- Tree node headers, leaf items, internal node key pointers\n- `tree` -- B-tree search, walk, insert, split operations\n- `chunk` -- Chunk/stripe mapping, logical-to-physical address resolution\n- `crc32c` -- Software CRC32C (Castagnoli polynomial) implementation\n- `inode` -- Inode item metadata\n- `dir` -- Directory entry parsing, creation, name hashing\n- `extent` -- File extent items (inline, regular, prealloc)\n- `readwrite` -- High-level `BtrFs` type tying everything together\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n## Contributing\n\nContributions welcome! Please open an issue or pull request on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhteevah%2Fbtrfs-nostd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhteevah%2Fbtrfs-nostd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhteevah%2Fbtrfs-nostd/lists"}