Add a Vec<u32> for allocated clusters to the DirEntry struct.

This commit is contained in:
Bas Wiel, van de 2024-04-28 18:01:48 +02:00
parent 0e0296ecad
commit 63891c8f28
1 changed files with 10 additions and 0 deletions

View File

@ -10,6 +10,7 @@ pub struct DirEntry {
pub file_size: u32,
pub entry_type: DirEntryType,
pub children: Vec<DirEntry>,
allocated_clusters: Vec<u32>,
data: Vec<u8>,
}
@ -97,6 +98,7 @@ impl DirEntry {
file_size,
entry_type: DirEntryType::SysFile,
children: Vec::new(),
allocated_clusters: Vec::new(),
data: Vec::new(),
}),
_ => Ok(DirEntry {
@ -107,6 +109,7 @@ impl DirEntry {
file_size,
entry_type: DirEntryType::SysFile,
children: Vec::new(),
allocated_clusters: Vec::new(),
data: Vec::new(),
}),
}
@ -132,6 +135,7 @@ impl DirEntry {
file_size,
entry_type: DirEntryType::File,
children: Vec::new(),
allocated_clusters: Vec::new(),
data,
}),
_ => Ok(DirEntry {
@ -142,6 +146,7 @@ impl DirEntry {
file_size,
entry_type: DirEntryType::File,
children: Vec::new(),
allocated_clusters: Vec::new(),
data,
}),
}
@ -156,6 +161,7 @@ impl DirEntry {
file_size: 0,
entry_type: DirEntryType::RootDirectory,
children: Vec::new(),
allocated_clusters: Vec::new(),
data: Vec::new(),
})
}
@ -177,6 +183,7 @@ impl DirEntry {
file_size: 0,
entry_type: DirEntryType::Directory,
children: Vec::new(),
allocated_clusters: Vec::new(),
data: Vec::new(),
},
_ => DirEntry {
@ -187,6 +194,7 @@ impl DirEntry {
file_size: 0,
entry_type: DirEntryType::Directory,
children: Vec::new(),
allocated_clusters: Vec::new(),
data: Vec::new(),
},
};
@ -234,6 +242,7 @@ impl DirEntry {
file_size: 0,
entry_type: DirEntryType::File, // This is just as wrong as the rest of this function.
children: Vec::new(),
allocated_clusters: Vec::new(),
data: Vec::new(),
};
Ok(new_direntry)
@ -384,6 +393,7 @@ mod tests {
file_size: 4608,
entry_type: DirEntryType::File, // Dummy placeholder
children: Vec::new(),
allocated_clusters: Vec::new(),
data: Vec::new(),
};
// Semi-representative entry that reflects IBMBIO.COM on April 4 1983.