Skip to content

Commit

Permalink
Use cluster 0 when the parent dir is the root, for both FAT16 and FAT32.
Browse files Browse the repository at this point in the history
fsck was getting annoyed at this.
  • Loading branch information
thejpster committed Oct 29, 2024
1 parent bc82df4 commit d4d082e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/fat/volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,16 +1189,11 @@ impl FatVolume {
ctime: now,
attributes: att,
// point at our parent
cluster: match fat_type {
FatType::Fat16 => {
// On FAT16, indicate parent is root using Cluster(0)
if parent == ClusterId::ROOT_DIR {
ClusterId::EMPTY
} else {
parent
}
}
FatType::Fat32 => parent,
cluster: if parent == ClusterId::ROOT_DIR {
// indicate parent is root using Cluster(0)
ClusterId::EMPTY
} else {
parent
},
size: 0,
entry_block: new_dir_start_block,
Expand Down

0 comments on commit d4d082e

Please sign in to comment.