fix recursive device_path algorithm

This commit is contained in:
slonkazoid 2024-08-01 21:21:49 +03:00
parent 9f26c8f50d
commit 11c0ef4db8
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM
2 changed files with 22 additions and 20 deletions

View file

@ -9,9 +9,7 @@ fn recurse_device_path(
mut uuid: Option<u128>, mut uuid: Option<u128>,
mut path: Option<String>, mut path: Option<String>,
) -> (Option<u128>, Option<String>) { ) -> (Option<u128>, Option<String>) {
match a.next { match dbg!(&a.info) {
Some(next) => {
match &next.info {
DevicePathInfo::HardDrive { DevicePathInfo::HardDrive {
partition_signature, partition_signature,
signature_type, signature_type,
@ -31,6 +29,9 @@ fn recurse_device_path(
} }
_ => {} _ => {}
} }
match a.next {
Some(next) => {
return recurse_device_path(*next, uuid, path); return recurse_device_path(*next, uuid, path);
} }
None => return (uuid, path), None => return (uuid, path),

View file

@ -122,6 +122,7 @@ fn main() -> eyre::Result<()> {
&& let Some(device_path) = device_path && let Some(device_path) = device_path
{ {
let (uuid, path) = traverse_device_path(device_path); let (uuid, path) = traverse_device_path(device_path);
eprintln!("devicepath uuid: {uuid:?}, path: {path:?}");
let windows_path_str = if let Some(windows_path_str) = path { let windows_path_str = if let Some(windows_path_str) = path {
windows_path_str windows_path_str