Skip to content

Commit f4f4ef2

Browse files
ramfs::mmap: handle FileContents::Content
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent 20076ad commit f4f4ef2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/aero_kernel/src/fs/ramfs.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,17 @@ impl INodeInterface for LockedRamINode {
338338
Ok(private_cp)
339339
}
340340

341+
FileContents::Content(contents) => {
342+
// TODO: Support shared content ramfs file mappings.
343+
assert!(!flags.contains(MMapFlags::MAP_SHARED));
344+
345+
let private_cp: PhysFrame = FRAME_ALLOCATOR.allocate_frame().unwrap();
346+
private_cp.as_slice_mut()[..size]
347+
.copy_from_slice(&contents.lock()[offset..offset + size]);
348+
349+
Ok(private_cp)
350+
}
351+
341352
// TODO: Support other memory mapping ramfs files:
342353
_ => Err(FileSystemError::NotSupported),
343354
}

0 commit comments

Comments
 (0)