forked from Rativel/BurritOS
commented the bitmap + init_bitmap + init_file_hdr
This commit is contained in:
@@ -20,6 +20,19 @@ pub struct FileHdr {
|
||||
|
||||
impl FileHdr {
|
||||
|
||||
|
||||
pub fn init_file_hdr() -> 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 {
|
||||
@@ -87,6 +100,11 @@ impl FileHdr {
|
||||
//TODO: fetchFrom WriteBack
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pub fn byte_to_sector(&self,offset: i32) -> i32 {
|
||||
return self.data_sectors[ (offset / SECTOR_SIZE) as usize];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user