src/pxar/decoder.rs: add getter functions to obtain start/end offsets for directories
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
3626ac611f
commit
c7fee396c6
|
@ -19,6 +19,16 @@ pub struct DirectoryEntry {
|
||||||
pub entry: PxarEntry,
|
pub entry: PxarEntry,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl DirectoryEntry {
|
||||||
|
pub(crate) fn start_offset(&self) -> u64 {
|
||||||
|
self.start
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn end_offset(&self) -> u64 {
|
||||||
|
self.end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This one needs Read+Seek
|
// This one needs Read+Seek
|
||||||
pub struct Decoder<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> {
|
pub struct Decoder<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> {
|
||||||
inner: SequentialDecoder<R, F>,
|
inner: SequentialDecoder<R, F>,
|
||||||
|
@ -58,6 +68,10 @@ impl<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
|
||||||
Ok(pos)
|
Ok(pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn root_end_offset(&self) -> u64 {
|
||||||
|
self.root_end
|
||||||
|
}
|
||||||
|
|
||||||
pub fn restore(&mut self, dir: &DirectoryEntry, path: &Path) -> Result<(), Error> {
|
pub fn restore(&mut self, dir: &DirectoryEntry, path: &Path) -> Result<(), Error> {
|
||||||
let start = dir.start;
|
let start = dir.start;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue