[pbs-devel] [PATCH v5 pxar 2/28] fix #3174: decoder: impl skip_bytes for sync dec

Christian Ebner c.ebner at proxmox.com
Wed Nov 15 16:47:47 CET 2023


Allows to skip over a given number of bytes during pxar archive
decoding. This is used to skip over unneeded contents in a pxar
appendix.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
Changes since v4:
- no changes

Changes since v3:
- no changes

Changes since v2:
- no changes

Changes since v1:
- remove type cast to `usize`, not needed anymore

 src/decoder/sync.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/decoder/sync.rs b/src/decoder/sync.rs
index 5597a03..bdfe2f4 100644
--- a/src/decoder/sync.rs
+++ b/src/decoder/sync.rs
@@ -81,6 +81,11 @@ impl<T: SeqRead> Decoder<T> {
     pub fn enable_goodbye_entries(&mut self, on: bool) {
         self.inner.with_goodbye_tables = on;
     }
+
+    /// Skip bytes in decoder stream.
+    pub fn skip_bytes(&mut self, len: u64) -> io::Result<()> {
+        poll_result_once(self.inner.skip_bytes(len))
+    }
 }
 
 impl<T: SeqRead> Iterator for Decoder<T> {
-- 
2.39.2






More information about the pbs-devel mailing list