#[repr(C, packed(1))]pub struct PosixHeader {Show 17 fields
pub name: TarFormatString<NAME_LEN>,
pub mode: Mode,
pub uid: TarFormatOctal<8>,
pub gid: TarFormatOctal<8>,
pub size: TarFormatOctal<12>,
pub mtime: TarFormatDecimal<12>,
pub cksum: TarFormatOctal<8>,
pub typeflag: TypeFlagRaw,
pub linkname: TarFormatString<NAME_LEN>,
pub magic: TarFormatString<6>,
pub version: TarFormatString<2>,
pub uname: TarFormatString<32>,
pub gname: TarFormatString<32>,
pub dev_major: TarFormatOctal<8>,
pub dev_minor: TarFormatOctal<8>,
pub prefix: TarFormatString<PREFIX_LEN>,
pub _pad: [u8; 12],
}
Expand description
Header of the TAR format as specified by POSIX (POSIX 1003.1-1990).
“New” GNU Tar versions use this archive format by default. (https://www.gnu.org/software/tar/manual/html_node/Formats.html#Formats).
Each file is started by such a header, that describes the size and the file name. After that, the file content stands in chunks of 512 bytes. The number of bytes can be derived from the file size.
This is also mostly compatible with the “Ustar”-header and the “GNU format”. Because this library mainly targets the filename, the data, and basic metadata, we don’t need advanced checks for specific extensions.
Fields§
§name: TarFormatString<NAME_LEN>
§mode: Mode
§uid: TarFormatOctal<8>
§gid: TarFormatOctal<8>
§size: TarFormatOctal<12>
§mtime: TarFormatDecimal<12>
§cksum: TarFormatOctal<8>
§typeflag: TypeFlagRaw
§linkname: TarFormatString<NAME_LEN>
Name. There is always a null byte, therefore the max len is 99.
magic: TarFormatString<6>
§version: TarFormatString<2>
§uname: TarFormatString<32>
Username. There is always a null byte, therefore the max len is N-1.
gname: TarFormatString<32>
Groupname. There is always a null byte, therefore the max len is N-1.
dev_major: TarFormatOctal<8>
§dev_minor: TarFormatOctal<8>
§prefix: TarFormatString<PREFIX_LEN>
§_pad: [u8; 12]
Implementations§
Source§impl PosixHeader
impl PosixHeader
Sourcepub fn payload_block_count(&self) -> Result<usize, ParseIntError>
pub fn payload_block_count(&self) -> Result<usize, ParseIntError>
Returns the number of blocks that are required to read the whole file content. Returns an error, if the file size can’t be parsed from the header.
Sourcepub fn is_zero_block(&self) -> bool
pub fn is_zero_block(&self) -> bool
A Tar archive is terminated, if an end-of-archive entry, which consists of two 512 blocks of zero bytes, is found.
Trait Implementations§
Source§impl Clone for PosixHeader
impl Clone for PosixHeader
Source§fn clone(&self) -> PosixHeader
fn clone(&self) -> PosixHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more