Cleanup.
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
use crate::FB_SECTOR_SIZE;
|
|
||||||
|
|
||||||
use clap::{ArgAction, Parser};
|
use clap::{ArgAction, Parser};
|
||||||
|
|
||||||
pub static CONFIG: LazyLock<Args> = LazyLock::new(|| Args::parse());
|
pub static CONFIG: LazyLock<Args> = LazyLock::new(|| Args::parse());
|
||||||
@@ -22,7 +20,7 @@ pub struct Args {
|
|||||||
pub map: Option<PathBuf>,
|
pub map: Option<PathBuf>,
|
||||||
|
|
||||||
/// Max number of consecutive sectors to test as a group
|
/// 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,
|
pub cluster_length: usize,
|
||||||
|
|
||||||
/// Number of brute force read passes
|
/// Number of brute force read passes
|
||||||
@@ -30,13 +28,13 @@ pub struct Args {
|
|||||||
pub brute_passes: usize,
|
pub brute_passes: usize,
|
||||||
|
|
||||||
/// Sector size
|
/// 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,
|
pub sector_size: usize,
|
||||||
|
|
||||||
// Behaviour is backwards.
|
// Behaviour is backwards.
|
||||||
// ArgAction::SetFalse by default evaluates to true,
|
// ArgAction::SetFalse by default evaluates to true,
|
||||||
// ArgAction::SetTrue by default evaluates to false.
|
// 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)]
|
#[arg(short, long, action=ArgAction::SetTrue)]
|
||||||
pub reopen_on_error: bool,
|
pub reopen_on_error: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ use recovery::Recover;
|
|||||||
use anyhow;
|
use anyhow;
|
||||||
|
|
||||||
const FB_SECTOR_SIZE: usize = 2048;
|
const FB_SECTOR_SIZE: usize = 2048;
|
||||||
|
const FB_CLUSTER_LEN: usize = 128;
|
||||||
const FB_NULL_VALUE: u8 = 0;
|
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<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
let mut recover_tool = Recover::new()?;
|
let mut recover_tool = Recover::new()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user