src/pxar/decoder.rs: cleanup s/CaDirectoryEntry/DirectoryEntry

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-08-13 14:50:12 +02:00 committed by Dietmar Maurer
parent 50c0cdfd28
commit f50b4fd6a0
1 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@ use std::path::{Path, PathBuf};
use std::ffi::OsString; use std::ffi::OsString;
pub struct CaDirectoryEntry { pub struct DirectoryEntry {
start: u64, start: u64,
end: u64, end: u64,
pub filename: OsString, pub filename: OsString,
@ -42,8 +42,8 @@ impl <'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<'a, R, F> {
}) })
} }
pub fn root(&self) -> CaDirectoryEntry { pub fn root(&self) -> DirectoryEntry {
CaDirectoryEntry { DirectoryEntry {
start: self.root_start, start: self.root_start,
end: self.root_end, end: self.root_end,
filename: OsString::new(), // Empty filename: OsString::new(), // Empty
@ -64,7 +64,7 @@ impl <'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<'a, R, F> {
pub fn restore( pub fn restore(
&mut self, &mut self,
dir: &CaDirectoryEntry, dir: &DirectoryEntry,
path: &Path, path: &Path,
) -> Result<(), Error> { ) -> Result<(), Error> {
let start = dir.start; let start = dir.start;
@ -76,7 +76,7 @@ impl <'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<'a, R, F> {
Ok(()) Ok(())
} }
fn read_directory_entry(&mut self, start: u64, end: u64) -> Result<CaDirectoryEntry, Error> { fn read_directory_entry(&mut self, start: u64, end: u64) -> Result<DirectoryEntry, Error> {
self.seek(SeekFrom::Start(start))?; self.seek(SeekFrom::Start(start))?;
@ -94,7 +94,7 @@ impl <'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<'a, R, F> {
check_ca_header::<PxarEntry>(&head, PXAR_ENTRY)?; check_ca_header::<PxarEntry>(&head, PXAR_ENTRY)?;
let entry: PxarEntry = self.inner.read_item()?; let entry: PxarEntry = self.inner.read_item()?;
Ok(CaDirectoryEntry { Ok(DirectoryEntry {
start: entry_start, start: entry_start,
end: end, end: end,
filename: filename, filename: filename,
@ -102,7 +102,7 @@ impl <'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<'a, R, F> {
}) })
} }
pub fn list_dir(&mut self, dir: &CaDirectoryEntry) -> Result<Vec<CaDirectoryEntry>, Error> { pub fn list_dir(&mut self, dir: &DirectoryEntry) -> Result<Vec<DirectoryEntry>, Error> {
const GOODBYE_ITEM_SIZE: u64 = std::mem::size_of::<PxarGoodbyeItem>() as u64; const GOODBYE_ITEM_SIZE: u64 = std::mem::size_of::<PxarGoodbyeItem>() as u64;
@ -185,7 +185,7 @@ impl <'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<'a, R, F> {
&mut self, &mut self,
output: &mut W, output: &mut W,
prefix: &mut PathBuf, prefix: &mut PathBuf,
dir: &CaDirectoryEntry, dir: &DirectoryEntry,
) -> Result<(), Error> { ) -> Result<(), Error> {
let mut list = self.list_dir(dir)?; let mut list = self.list_dir(dir)?;