From fe076c8259e8e458543f83b63091ffc005a68050 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Fri, 2 Aug 2019 15:19:36 +0200 Subject: [PATCH] pxar: cleanup: s/PxarDirBuf/PxarDirStack/g and move dir_buffer.rs to dir_stack.rs Signed-off-by: Christian Ebner --- src/pxar.rs | 4 ++-- src/pxar/{dir_buffer.rs => dir_stack.rs} | 4 ++-- src/pxar/sequential_decoder.rs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/pxar/{dir_buffer.rs => dir_stack.rs} (98%) diff --git a/src/pxar.rs b/src/pxar.rs index 286b572b..b9c6ac38 100644 --- a/src/pxar.rs +++ b/src/pxar.rs @@ -68,7 +68,7 @@ pub use decoder::*; mod exclude_pattern; pub use exclude_pattern::*; -mod dir_buffer; -pub use dir_buffer::*; +mod dir_stack; +pub use dir_stack::*; mod helper; diff --git a/src/pxar/dir_buffer.rs b/src/pxar/dir_stack.rs similarity index 98% rename from src/pxar/dir_buffer.rs rename to src/pxar/dir_stack.rs index 54a51284..ade418f5 100644 --- a/src/pxar/dir_buffer.rs +++ b/src/pxar/dir_stack.rs @@ -17,7 +17,7 @@ pub struct PxarDir { pub dir: Option, } -pub struct PxarDirBuf { +pub struct PxarDirStack { root: RawFd, data: Vec, } @@ -56,7 +56,7 @@ impl PxarDir { } } -impl PxarDirBuf { +impl PxarDirStack { pub fn new(parent: RawFd) -> Self { Self { root: parent, diff --git a/src/pxar/sequential_decoder.rs b/src/pxar/sequential_decoder.rs index 49c867fd..f97d8254 100644 --- a/src/pxar/sequential_decoder.rs +++ b/src/pxar/sequential_decoder.rs @@ -8,7 +8,7 @@ use endian_trait::Endian; use super::flags; use super::format_definition::*; use super::exclude_pattern::*; -use super::dir_buffer::*; +use super::dir_stack::*; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; @@ -626,7 +626,7 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F fn restore_dir( &mut self, base_path: &Path, - dirs: &mut PxarDirBuf, + dirs: &mut PxarDirStack, entry: PxarEntry, filename: &OsStr, matched: MatchType, @@ -682,7 +682,7 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F let dir = nix::dir::Dir::open(path, nix::fcntl::OFlag::O_DIRECTORY, nix::sys::stat::Mode::empty()) .map_err(|err| format_err!("unable to open target directory {:?} - {}", path, err))?; let fd = dir.as_raw_fd(); - let mut dirs = PxarDirBuf::new(fd); + let mut dirs = PxarDirStack::new(fd); // An empty match pattern list indicates to restore the full archive. let matched = if match_pattern.len() == 0 { MatchType::Include @@ -722,7 +722,7 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F fn restore_dir_entry( &mut self, base_path: &Path, - dirs: &mut PxarDirBuf, + dirs: &mut PxarDirStack, filename: &OsStr, parent_matched: MatchType, match_pattern: &Vec,