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

Method update_item

src/fs/directory.rs:271–289  ·  view source on GitHub ↗

Update item

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

Source from the content-addressed store, hash-verified

269
270 // Update item
271 pub fn update_item(&mut self, name: &str, size: u32)
272 {
273 let time = crate::clock::realtime() as u64;
274 let mut items = self.items();
275 for item in &mut items
276 {
277 if item.name() == name
278 {
279 let i = items.blk_data_offset() - item.len();
280 let data = items.blk.datamut();
281
282 data[(i + 5)..(i + 9)].clone_from_slice(&size.to_be_bytes());
283 data[(i + 9)..(i + 17)].clone_from_slice(&time.to_be_bytes());
284 items.blk.write();
285
286 break;
287 }
288 }
289 }
290}
291
292

Callers

nothing calls this directly

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