[thin_shrink] Squash some warnings
This commit is contained in:
parent
27c6e36f5c
commit
7df56a5a04
@ -1,7 +1,7 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::{Seek, SeekFrom, Write, Read};
|
use std::io::{Seek, SeekFrom, Write, Read};
|
||||||
use std::os::unix::fs::OpenOptionsExt;
|
//use std::os::unix::fs::OpenOptionsExt;
|
||||||
|
|
||||||
pub type Sector = u64;
|
pub type Sector = u64;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use fixedbitset::{FixedBitSet, IndexRange};
|
use fixedbitset::{FixedBitSet};
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::os::unix::fs::OpenOptionsExt;
|
use std::os::unix::fs::OpenOptionsExt;
|
||||||
@ -84,15 +84,6 @@ impl<W: Write> Pass2<W> {
|
|||||||
remaps,
|
remaps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remap(&self, r: BlockRange) -> Vec<BlockRange> {
|
|
||||||
let mut rmap = Vec::new();
|
|
||||||
|
|
||||||
// id
|
|
||||||
rmap.push(r.clone());
|
|
||||||
|
|
||||||
rmap
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: Write> xml::MetadataVisitor for Pass2<W> {
|
impl<W: Write> xml::MetadataVisitor for Pass2<W> {
|
||||||
@ -288,7 +279,7 @@ fn find_first(r: &BlockRange, remaps: &Vec<(BlockRange, BlockRange)>) -> Option<
|
|||||||
// Need to check the previous entry
|
// Need to check the previous entry
|
||||||
let (from, _) = &remaps[n - 1];
|
let (from, _) = &remaps[n - 1];
|
||||||
overlaps(&r, &from, n - 1).or_else(|| {
|
overlaps(&r, &from, n - 1).or_else(|| {
|
||||||
let (from, to) = &remaps[n];
|
let (from, _) = &remaps[n];
|
||||||
overlaps(&r, &from, n)
|
overlaps(&r, &from, n)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -444,7 +435,7 @@ fn process_xml<MV: xml::MetadataVisitor>(input_path: &str, pass: &mut MV) -> Res
|
|||||||
|
|
||||||
pub fn shrink(input_path: &str, output_path: &str, data_path: &str, nr_blocks: u64) -> Result<()> {
|
pub fn shrink(input_path: &str, output_path: &str, data_path: &str, nr_blocks: u64) -> Result<()> {
|
||||||
let mut pass1 = Pass1::new(nr_blocks);
|
let mut pass1 = Pass1::new(nr_blocks);
|
||||||
process_xml(input_path, &mut pass1);
|
process_xml(input_path, &mut pass1)?;
|
||||||
eprintln!("{} blocks need moving", pass1.nr_high_blocks);
|
eprintln!("{} blocks need moving", pass1.nr_high_blocks);
|
||||||
|
|
||||||
let mut free_blocks = 0u64;
|
let mut free_blocks = 0u64;
|
||||||
|
@ -51,25 +51,6 @@ pub trait MetadataVisitor {
|
|||||||
fn eof(&mut self) -> Result<()>;
|
fn eof(&mut self) -> Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct NoopVisitor {
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NoopVisitor {
|
|
||||||
pub fn new() -> NoopVisitor { NoopVisitor {} }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MetadataVisitor for NoopVisitor {
|
|
||||||
fn superblock_b(&mut self, _sb: &Superblock) -> Result<()> {Ok(())}
|
|
||||||
fn superblock_e(&mut self) -> Result<()> {Ok(())}
|
|
||||||
|
|
||||||
fn device_b(&mut self, _d: &Device) -> Result<()> {Ok(())}
|
|
||||||
fn device_e(&mut self) -> Result<()> {Ok(())}
|
|
||||||
|
|
||||||
fn map(&mut self, m: &Map) -> Result<()> {Ok(())}
|
|
||||||
|
|
||||||
fn eof(&mut self) -> Result<()> {Ok(())}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct XmlWriter<W: Write> {
|
pub struct XmlWriter<W: Write> {
|
||||||
w: Writer<W>,
|
w: Writer<W>,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user