# Plan 9 blocks

In Plan 9, data transfer over I/O are generally made through a structure named
"Block" which takes care of tracking down a write pointer, read pointer and
buffer limit. It also has links to other blocks for I/O operations that would
chain blocks together. The unit at [mem/p9block.fs] copies that structure.
The structure "Block" is defined in [mem/p9block.h].

In Plan 9, the "allocb()" implementation typically takes care of allocations but
has a mechanism for specialized allocators. The default allocator aligns to 8
bytes.

In Dusk, our block allocator doesn't allocate a payload. Our "allocb()" needs to
be supplied with an already allocated range.

Blocks only make sense for temporary usages, so they're allocated in a global
scratchpad. Therefore, we have no "freeb()". This unit doesn't manage its
payload's memory.

In Dusk, we remove all the alignment hodge-podge code from Plan 9 and we assume
that the range we receive is properly aligned for the usage we want for it.

This API is only used in C.

## C API

Block* allocb(void *a, uint u);
  Allocate a new block pointing to range "a u" and return a pointer to it.
