1
0
forked from Rativel/BurritOS

open_file impl

This commit is contained in:
Moysan Gabriel
2023-04-03 22:48:22 +02:00
parent 856cbdfe01
commit 2549103636
2 changed files with 173 additions and 0 deletions

View File

@@ -20,6 +20,18 @@ pub struct FileHdr {
impl FileHdr {
//Juste histoire d'avoir un constructeur, temporaire
pub fn new() -> FileHdr {
FileHdr{
is_dir : 0,
num_bytes : 0,
num_sectors : 0,
data_sectors : Vec::new(),
num_header_sectors : 0,
header_sectors : [0 ; MAX_HEADER_SECTORS as usize]
}
}
pub fn allocate(&mut self, mut free_map: BitMap, file_size: i32) -> bool {
self.num_bytes = file_size;
if file_size > MAX_FILE_LENGTH {