1 //! Archive definitions. 2 //! 3 //! These definitions are independent of read/write support, although we do implement 4 //! some traits useful for those. 5 6 use crate::pod::Pod; 7 8 /// File identification bytes stored at the beginning of the file. 9 pub const MAGIC: [u8; 8] = *b"!<arch>\n"; 10 11 /// File identification bytes stored at the beginning of a thin archive. 12 /// 13 /// A thin archive only contains a symbol table and file names. 14 pub const THIN_MAGIC: [u8; 8] = *b"!<thin>\n"; 15 16 /// The terminator for each archive member header. 17 pub const TERMINATOR: [u8; 2] = *b"`\n"; 18 19 /// The header at the start of an archive member. 20 #[derive(Debug, Clone, Copy)] 21 #[repr(C)] 22 pub struct Header { 23 /// The file name. 24 pub name: [u8; 16], 25 /// File modification timestamp in decimal. 26 pub date: [u8; 12], 27 /// User ID in decimal. 28 pub uid: [u8; 6], 29 /// Group ID in decimal. 30 pub gid: [u8; 6], 31 /// File mode in octal. 32 pub mode: [u8; 8], 33 /// File size in decimal. 34 pub size: [u8; 10], 35 /// Must be equal to `TERMINATOR`. 36 pub terminator: [u8; 2], 37 } 38 39 unsafe_impl_pod!(Header); 40