rustar (really unproductive system tape archive)
What is rustar?
RUSTAR (Rust + USTAR) is a minimal, safe (hopefully), and #![no_std]-friendly library for parsing USTAR archives.
It is designed primarily for Rust-Based OS development, in the case one might bundle their kernel modules, init programs, or resources in a .tar and extract them at runtime.
Why use rustar for an OS?
Using RUSTAR as your embedded filesystem format has some big advantages:
- Zero external deps: Works in
#![no_std], requires onlyallocif you need ownedVec<u8>. - Cross-tested: Same code works on bare metal (e.g your OS kernel) and on Linux/Win with
cargo test.
Features
- purely rust based
#![no_std]compatible- iterator function (
TarIter) to walk over headers - zero-mem-copy file lookup (
tar_lookup) - (optional) owned extraction (
extract_file) - Tested with standard
tar --format=ustararchives
Example in OS kernel
This is an example implementation for it in an OS kernel, so same rules apply to a basic no_std environment:
for header in new
if let Some = extract_file
Example (testing on Linux)
You can include a tar file directly in your unit tests (this is the included unit test):
Create an (already provided) test tar with:
Run tests:
Roadmap
- Add write support (create tar archives in
no_std) , although i may already switch over my OS to fat12 or something by then - Expose a safe
TarHeader::contents(&self, archive: &[u8])helper - Support reading from block devices instead of memory slices (this would make life much easier but im lazy)
License
MIT License used by this project so full effect of that. give me credit via name/username :3 (if you want)
Brought to you by your favourite puppygirl Liz 🐾