From 845d9a3cc9445f9a12552e959ae671ad1d4d3f38 Mon Sep 17 00:00:00 2001 From: Cutieguwu Date: Fri, 2 Jan 2026 00:12:40 -0500 Subject: [PATCH] Cleanup. --- src/cli.rs | 8 +++----- src/main.rs | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 4b86604..3302322 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,8 +1,6 @@ use std::path::PathBuf; use std::sync::LazyLock; -use crate::FB_SECTOR_SIZE; - use clap::{ArgAction, Parser}; pub static CONFIG: LazyLock = LazyLock::new(|| Args::parse()); @@ -22,7 +20,7 @@ pub struct Args { pub map: Option, /// Max number of consecutive sectors to test as a group - #[arg(short, long, default_value_t = 128)] + #[arg(short, long, default_value_t = crate::FB_CLUSTER_LEN)] pub cluster_length: usize, /// Number of brute force read passes @@ -30,13 +28,13 @@ pub struct Args { pub brute_passes: usize, /// Sector size - #[arg(short, long, default_value_t = FB_SECTOR_SIZE)] + #[arg(short, long, default_value_t = crate::FB_SECTOR_SIZE)] pub sector_size: usize, // Behaviour is backwards. // ArgAction::SetFalse by default evaluates to true, // ArgAction::SetTrue by default evaluates to false. - /// Whether to reopen the file on a read error or not. + /// Upon encountering a read error, reopen the source file before continuing. #[arg(short, long, action=ArgAction::SetTrue)] pub reopen_on_error: bool, } diff --git a/src/main.rs b/src/main.rs index 0718e77..49516f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,9 +9,10 @@ use recovery::Recover; use anyhow; const FB_SECTOR_SIZE: usize = 2048; +const FB_CLUSTER_LEN: usize = 128; const FB_NULL_VALUE: u8 = 0; -const MAX_BUFFER_SIZE: usize = FB_SECTOR_SIZE * 16; +const MAX_BUFFER_SIZE: usize = FB_SECTOR_SIZE * FB_CLUSTER_LEN; fn main() -> anyhow::Result<()> { let mut recover_tool = Recover::new()?;