cramfs

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cramfs implements the cramfs (Compressed ROM File System) engine behind the image.Filesystem contract. cramfs is a small, write-once, read-only format: file data is split into 4 KiB blocks, each independently zlib compressed, and inodes are stored inline in their parent directory's entries. fsforge writes a little-endian image the Linux kernel mounts; the reader parses one back into the tree, so cramfs doubles as a conversion source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cramfs

type Cramfs struct {
	// contains filtered or unexported fields
}

Cramfs is the cramfs engine, implementing image.Filesystem. Format produces a little-endian, zlib-compressed read-only image the Linux kernel mounts. Open parses such an image back into the tree, so cramfs doubles as a conversion source; the opened image is read-only (cramfs is write-once, so mutation means rebuilding), so its Finalize reports that it cannot be re-finalized.

func New

func New(deps image.Deps) *Cramfs

New returns a cramfs engine wired with deps. A nil Clock is replaced with the host system clock (cramfs stores no timestamps, so it is unused beyond the dependency-injection contract).

func (*Cramfs) Format

func (e *Cramfs) Format(dev device.Device, p image.Params) (image.Image, error)

Format starts a fresh cramfs image on dev.

func (*Cramfs) Open

func (e *Cramfs) Open(dev device.Device) (image.Image, error)

Open reads an existing cramfs image into the agnostic tree, so cramfs can be a conversion source. Directory entries are read directly; regular-file and symlink data is zlib-decompressed per 4 KiB block. The returned image is read-only; rebuild via Convert to change it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL