From f92e8266ae36abd505e26f9f1b4f3599d5bef53b Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Tue, 3 Sep 2019 14:14:31 +0200 Subject: [PATCH] src/pxar/format_definitions.rs: move header type in PxarHeader and hash in PxarGoodbyeItem to top of struct By this it is possible to read and check just the first u64 of the corresponding structs in order to identify the items. This is needed for the fuse implementation in order to get entries based on the archive offset, used as inode. Directories are referenced by the offset to the goodbye tail while other items are referenced by the offset of the filename followed by the entry. Signed-off-by: Christian Ebner --- src/pxar/format_definition.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pxar/format_definition.rs b/src/pxar/format_definition.rs index 66d1088f..49ea7fd2 100644 --- a/src/pxar/format_definition.rs +++ b/src/pxar/format_definition.rs @@ -38,10 +38,10 @@ pub const PXAR_GOODBYE_TAIL_MARKER: u64 = 0x57446fa533702943; #[derive(Debug, Endian)] #[repr(C)] pub struct PxarHeader { - /// The size of the item, including the size of `PxarHeader`. - pub size: u64, /// The item type (see `PXAR_` constants). pub htype: u64, + /// The size of the item, including the size of `PxarHeader`. + pub size: u64, } #[derive(Endian)] @@ -64,6 +64,9 @@ pub struct PxarDevice { #[derive(Endian)] #[repr(C)] pub struct PxarGoodbyeItem { + /// SipHash24 of the directory item name. The last GOODBYE item + /// uses the special hash value `PXAR_GOODBYE_TAIL_MARKER`. + pub hash: u64, /// The offset from the start of the GOODBYE object to the start /// of the matching directory item (point to a FILENAME). The last /// GOODBYE item points to the start of the matching ENTRY @@ -72,9 +75,6 @@ pub struct PxarGoodbyeItem { /// The overall size of the directory item. The last GOODBYE item /// repeats the size of the GOODBYE item. pub size: u64, - /// SipHash24 of the directory item name. The last GOODBYE item - /// uses the special hash value `PXAR_GOODBYE_TAIL_MARKER`. - pub hash: u64, } /// Helper function to extract file names from binary archive.