From 0abc41213227b720072ae9405b48ac38c8058aa1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 5 Mar 2020 11:12:17 +0100 Subject: [PATCH] encoder: add_hardlink Signed-off-by: Wolfgang Bumiller --- src/encoder.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/encoder.rs b/src/encoder.rs index 0c9c1f7..9c731c5 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -308,6 +308,27 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> { metadata: &Metadata, file_name: &Path, target: &Path, + ) -> io::Result<()> { + self.add_link(metadata, file_name, target, format::PXAR_SYMLINK) + .await + } + + pub async fn add_hardlink( + &mut self, + metadata: &Metadata, + file_name: &Path, + target: &Path, + ) -> io::Result<()> { + self.add_link(metadata, file_name, target, format::PXAR_HARDLINK) + .await + } + + async fn add_link( + &mut self, + metadata: &Metadata, + file_name: &Path, + target: &Path, + htype: u64, ) -> io::Result<()> { self.check(); @@ -318,7 +339,7 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> { self.start_file_do(metadata, file_name).await?; (&mut self.output as &mut dyn SeqWrite) - .seq_write_pxar_entry_zero(format::PXAR_SYMLINK, target) + .seq_write_pxar_entry_zero(htype, target) .await?; let end_offset = (&mut self.output as &mut dyn SeqWrite).position().await?;