Star forth v4.0.0 #3
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -329,17 +329,6 @@ enum { BLK_FMT_FORMATTED = 0, BLK_FMT_PROVISIONAL = 1 };
|
||||
/* ===== Public API ===== */
|
||||
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);
|
||||
|
||||
/* Milestone 2h hot-detach. Refuses (BLK_EINVAL) unless dev's slot is the
|
||||
|
||||
@@ -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