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

Method alloc

src/fs/blk.rs:43–65  ·  view source on GitHub ↗

Allocate

()

Source from the content-addressed store, hash-verified

41
42 // Allocate
43 pub fn alloc() -> Option<Self>
44 {
45 match BMapBlk::next_free_address()
46 {
47 None =>
48 {
49 None
50 }
51 Some(address) =>
52 {
53 BMapBlk::alloc(address);
54 let mut blk = Blk::read(address);
55
56 for i in 0..crate::fs::ata::BLKSIZE
57 {
58 blk.buffer[i] = 0;
59 }
60 blk.write();
61
62 Some(blk)
63 }
64 }
65 }
66
67 // Data
68 pub fn data(&self) -> &[u8]

Callers

nothing calls this directly

Calls 3

readFunction · 0.70
writeMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected