# `Hyper.SuidHelper.Blockcopy`
[🔗](https://github.com/harmont-dev/hyper/blob/main/lib/hyper/suid_helper/blockcopy.ex#L1)

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.

# `err`

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

# `copy`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
