Skip MBR extended partition containers
This commit is contained in:
parent
e40003482d
commit
3afb007442
1 changed files with 10 additions and 6 deletions
|
|
@ -89,12 +89,16 @@ pub fn get_partition_details(
|
|||
contents = run_script(&script);
|
||||
};
|
||||
for (_, [number, size]) in RE_LIS.captures_iter(&contents).map(|c| c.extract()) {
|
||||
let part = Partition {
|
||||
id: number.parse().unwrap(),
|
||||
size: string_to_bytes(size),
|
||||
..Default::default()
|
||||
};
|
||||
parts.push(part);
|
||||
let part_num = number.parse().unwrap();
|
||||
if part_num != 0 {
|
||||
// part_num == 0 is reserved for extended partition "containers" so we can exclude them
|
||||
let part = Partition {
|
||||
id: part_num,
|
||||
size: string_to_bytes(size),
|
||||
..Default::default()
|
||||
};
|
||||
parts.push(part);
|
||||
}
|
||||
}
|
||||
|
||||
// Detail parititon
|
||||
|
|
|
|||
Loading…
Reference in a new issue