5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2024-12-22 21:33:50 +03:00

encoder: add_hardlink

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-03-05 11:12:17 +01:00
parent 2fb73e7b11
commit 0abc412132

View 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?;