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

Method item_update

src/fs/directory.rs:109–125  ·  view source on GitHub ↗

Update item

(&mut self, name: &str, size: u32)

Source from the content-addressed store, hash-verified

107
108 // Update item
109 pub fn item_update(&mut self, name: &str, size: u32)
110 {
111 let time = crate::clock::realtime() as u64;
112 let mut items = self.items();
113 for item in &mut items
114 {
115 if item.name() == name
116 {
117 let i = items.blk_data_offset() - item.len();
118 let data = items.blk.datamut();
119 data[(i + 5)..(i + 9)].clone_from_slice(&size.to_be_bytes());
120 data[(i + 9)..(i + 17)].clone_from_slice(&time.to_be_bytes());
121 items.blk.write();
122 break;
123 }
124 }
125 }
126
127
128 // Create a new device

Callers 1

writeMethod · 0.80

Calls 7

realtimeFunction · 0.85
itemsMethod · 0.80
blk_data_offsetMethod · 0.80
datamutMethod · 0.80
nameMethod · 0.45
lenMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected