MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / alloc

Method alloc

src/fs/bmapblk.rs:25–37  ·  view source on GitHub ↗

Allocate

(address: u32)

Source from the content-addressed store, hash-verified

23{
24 // Allocate
25 pub fn alloc(address: u32)
26 {
27 let mut blk = Blk::read(BMapBlk::blkidx(address));
28 let bmap = blk.datamut();
29 let i = BMapBlk::buffidx(address);
30
31 if !bmap[i / 8].get_bit(i % 8)
32 {
33 bmap[i / 8].set_bit(i % 8, true);
34 blk.write();
35 crate::fs::sblk::alloc_count_up();
36 }
37 }
38
39 // Block index
40 fn blkidx(address: u32) -> u32

Callers

nothing calls this directly

Calls 4

alloc_count_upFunction · 0.85
datamutMethod · 0.80
readFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected