Add basic data structures to represent Tar archives
This commit is contained in:
parent
953c3abbc9
commit
faf574364a
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -202,6 +202,7 @@ dependencies = [
|
||||
"ron",
|
||||
"serde",
|
||||
"sha2",
|
||||
"tar",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
@ -393,6 +394,10 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tar"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.2.0"
|
||||
|
@ -5,11 +5,15 @@ edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[workspace]
|
||||
members = [ "tar" ]
|
||||
|
||||
[dependencies]
|
||||
clap = "4.1"
|
||||
rayon = "1.7"
|
||||
ron = "0.8"
|
||||
sha2 = "0.10"
|
||||
tar = { path = "tar" }
|
||||
walkdir = "2.3"
|
||||
|
||||
[dependencies.serde]
|
||||
|
5
tar/Cargo.toml
Normal file
5
tar/Cargo.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[package]
|
||||
name = "tar"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
21
tar/src/header.rs
Normal file
21
tar/src/header.rs
Normal file
@ -0,0 +1,21 @@
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct Header {
|
||||
pub fname: [u8; 100],
|
||||
pub mode: [u8; 8],
|
||||
pub uid: [u8; 8],
|
||||
pub gid: [u8; 8],
|
||||
pub size: [u8; 12],
|
||||
pub mtime: [u8; 12],
|
||||
pub header_checksum: [u8; 8],
|
||||
pub link_indicator: [u8; 1],
|
||||
pub link_name: [u8; 100],
|
||||
pub ustar_magic: [u8; 6],
|
||||
pub ustar_version: [u8; 2],
|
||||
pub username: [u8; 32],
|
||||
pub groupname: [u8; 32],
|
||||
pub device_major: [u8; 8],
|
||||
pub device_minor: [u8; 8],
|
||||
pub file_prefix: [u8; 155],
|
||||
pub reserved: [u8; 12],
|
||||
}
|
||||
|
7
tar/src/lib.rs
Normal file
7
tar/src/lib.rs
Normal file
@ -0,0 +1,7 @@
|
||||
mod header;
|
||||
mod node;
|
||||
pub use {header::Header, node::Node};
|
||||
|
||||
pub struct Archive {
|
||||
pub nodes: Vec<Node>,
|
||||
}
|
6
tar/src/node.rs
Normal file
6
tar/src/node.rs
Normal file
@ -0,0 +1,6 @@
|
||||
use crate::Header;
|
||||
|
||||
pub struct Node {
|
||||
pub header: Header,
|
||||
pub data: Vec<[u8; 512]>,
|
||||
}
|
Loading…
Reference in New Issue
Block a user