pxar: encoder: add encode_pxar_exclude_cli() function.

This provides the functionality needed to encode MatchPatterns passed on the cli
in the root directory.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-10-22 15:07:50 +02:00 committed by Dietmar Maurer
parent 920243b12d
commit ba8165c607

View File

@ -1171,6 +1171,30 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
Ok(()) Ok(())
} }
/// Encodes the excude match patterns passed via cli as file in the archive.
fn encode_pxar_exclude_cli(
&mut self,
uid: u32,
gid: u32,
mtime: u64,
content: &[u8],
) -> Result<(), Error> {
let entry = PxarEntry {
mode: (libc::S_IFREG | 0o600) as u64,
flags: 0,
uid,
gid,
mtime,
};
self.write_entry(entry)?;
let size = content.len();
self.write_header(PXAR_PAYLOAD, size as u64)?;
self.writer.write_all(content)?;
self.writer_pos += size;
Ok(())
}
// the report_XXX method may raise and error - depending on encoder configuration // the report_XXX method may raise and error - depending on encoder configuration
fn report_vanished_file(&self, path: &Path) -> Result<(), Error> { fn report_vanished_file(&self, path: &Path) -> Result<(), Error> {