GizStack
View .mdOpen in ChatGPTOpen in Claude

gizlang/cpio

gizlang
import * as Cpio from "gizlang/cpio";

Types

Entry

gizlang
type Entry = { name: string; mode: u64; major: u64; minor: u64; data: bytes; }

One newc archive member. Mode includes its POSIX file type; major/minor name a character or block device. A symbolic link's data is its target, a path relative to its folder that stays in the tree; devices and directories have none.

  • name: string
  • mode: u64
  • major: u64
  • minor: u64
  • data: bytes

Functions

newc

gizlang
function newc(entries: Vec<Entry>, alignment: i64 = 4): bytes throws string

A deterministic newc cpio archive, including device metadata and the trailer. Paths are relative and cannot escape a destination tree. Each file's data starts at a multiple of ALIGNMENT bytes (a power of two, at least 4) from the archive's start: with the page size, a kernel can use the data in place.

Effects: fail, alloc.