refactor(v3): the block subsystem's state is a chain there can be two of; blk_subsys_init takes no VM

The global state becomes struct blk_chain, reached through a current
pointer: blk_chain_default, blk_chain_new, blk_chain_select.  Nothing
that uses the one chain changes.  blk_subsys_init loses its VM argument,
which was stored and never used.  docs/v4.0.0/MESH.md 8.4.

Accepted on the v3 configuration: amd64, aarch64 and riscv64 reach the
zuse prompt, no UNKNOWN WORD, PARITY:M7.1a hash 0x08873e0f44b7cb2a on
all three, as on 2026-10-03.  logs/20261006-202918, -203036, -203230.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-06 20:33:32 -04:00
co-authored by Claude Opus 5.5
parent a7991f2757
commit 0e761cb117
8 changed files with 27485 additions and 11 deletions
+12 -1
View File
@@ -327,7 +327,18 @@ typedef struct {
enum { BLK_FMT_FORMATTED = 0, BLK_FMT_PROVISIONAL = 1 };
/* ===== Public API ===== */
int blk_subsys_init(VM *vm, uint8_t *ram_base, size_t ram_size);
int blk_subsys_init(uint8_t *ram_base, size_t ram_size);
/* A chain is fast RAM and the devices chained after it. blk_chain_default
* is the one there has always been. blk_chain_new makes another, not yet
* initialized, or returns 0 if there is no memory. blk_chain_select makes
* every blk_* call from now on act on `c`, blk_subsys_init included, and
* returns the chain that was selected before; a null `c` selects nothing
* new. docs/v4.0.0/MESH.md 8.4. */
typedef struct blk_chain blk_chain_t;
blk_chain_t *blk_chain_default(void);
blk_chain_t *blk_chain_new(void);
blk_chain_t *blk_chain_select(blk_chain_t *c);
int blk_subsys_attach_device(struct blkio_dev *dev);