Hyper.SuidHelper.Blockcopy (Hyper v0.1.0)

Copy Markdown View Source

Chunked ranged copy between block devices, via the setuid helper's blockcopy tool — used to fill a fork delta layer's COW store with exactly the divergent chunks.

Summary

Functions

Copy exactly the provisioned block ranges in ranges_spec (the map Hyper.Node.Img.ThinPool.mappings/1 returns) from src into dst at identical offsets, via the setuid helper's blockcopy tool.

Types

err()

@type err() :: Hyper.SuidHelper.err()

Functions

copy(src, dst, ranges_spec)

@spec copy(Path.t(), Path.t(), %{
  block_sectors: pos_integer(),
  ranges: [[non_neg_integer()]]
}) ::
  {:ok, %{scanned: non_neg_integer(), written: non_neg_integer()}}
  | {:error, err() | File.posix()}

Copy exactly the provisioned block ranges in ranges_spec (the map Hyper.Node.Img.ThinPool.mappings/1 returns) from src into dst at identical offsets, via the setuid helper's blockcopy tool.

The range list rides to the helper as a temp file — it can be thousands of entries, far past argv limits — written and cleaned up here; the helper validates it pre-privilege.