]> git.proxmox.com Git - pxar.git/commitdiff
encoder: add_hardlink
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 5 Mar 2020 10:12:17 +0000 (11:12 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 5 Mar 2020 10:12:17 +0000 (11:12 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/encoder.rs

index 0c9c1f7b0ed8ae9153b8d67499a716b7ba347b43..9c731c582f88206f23b560f573e13c58e975de0d 100644 (file)
@@ -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?;