refactor(v3): the block subsystem is one chain again
blk_chain_default, blk_chain_new and blk_chain_select (0e761cb1) were for
a node's own drive, which was withdrawn on 2026-10-07 (docs/v4.0.0/MESH.md
8.5). They are taken out. What remains of that change is that
blk_subsys_init takes no VM.
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 before. logs/20261007-082647, -082752, -082938.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d5b7235464
commit
7c06bdfdb6
@@ -167,11 +167,7 @@ struct blk_dev_slot {
|
||||
};
|
||||
|
||||
/* ===== global state ===== */
|
||||
/* A chain: fast RAM and the devices chained after it. There is the one
|
||||
* v3 has always had (blk_chain_default) and there can be others
|
||||
* (blk_chain_new); every blk_* call acts on the one selected
|
||||
* (blk_chain_select). docs/v4.0.0/MESH.md 8.4. */
|
||||
struct blk_chain {
|
||||
static struct {
|
||||
uint8_t *ram_base;
|
||||
size_t ram_size;
|
||||
uint8_t dirty_ram[BLK_RAM_BLOCKS];
|
||||
@@ -203,20 +199,7 @@ struct blk_chain {
|
||||
uint32_t reloc_count;
|
||||
|
||||
int initialized;
|
||||
};
|
||||
static struct blk_chain g_default;
|
||||
static struct blk_chain *g_current = &g_default;
|
||||
#define g (*g_current)
|
||||
|
||||
blk_chain_t *blk_chain_default(void) { return &g_default; }
|
||||
|
||||
blk_chain_t *blk_chain_new(void) { return (blk_chain_t *) calloc(1, sizeof(struct blk_chain)); }
|
||||
|
||||
blk_chain_t *blk_chain_select(blk_chain_t *c) {
|
||||
blk_chain_t *was = g_current;
|
||||
if (c) g_current = c;
|
||||
return was;
|
||||
}
|
||||
} g = {0};
|
||||
|
||||
/* Redirect lbn through the relocation table if it's been moved elsewhere.
|
||||
* The single choke point every public LBN-consuming entry point below
|
||||
|
||||
Reference in New Issue
Block a user