]>
Commit | Line | Data |
---|---|---|
1b1e52a4 WB |
1 | use pxar::format::hash_filename; |
2 | ||
3 | const CONSTANTS: &[(&str, &str, &str)] = &[ | |
0983094c CE |
4 | ( |
5 | "Pxar format version entry, fallback to version 1 if not present", | |
6 | "PXAR_FORMAT_VERSION", | |
7 | "__PROXMOX_FORMAT_VERSION__", | |
8 | ), | |
57bee6f8 WB |
9 | ( |
10 | "Beginning of an entry (current version).", | |
11 | "PXAR_ENTRY", | |
12 | "__PROXMOX_FORMAT_ENTRY_V2__", | |
13 | ), | |
14 | ( | |
15 | "Previous version of the entry struct", | |
16 | "PXAR_ENTRY_V1", | |
17 | "__PROXMOX_FORMAT_ENTRY__", | |
18 | ), | |
be5d68aa | 19 | ("", "PXAR_PRELUDE", "__PROXMOX_FORMAT_PRELUDE__"), |
1b1e52a4 WB |
20 | ("", "PXAR_FILENAME", "__PROXMOX_FORMAT_FILENAME__"), |
21 | ("", "PXAR_SYMLINK", "__PROXMOX_FORMAT_SYMLINK__"), | |
22 | ("", "PXAR_DEVICE", "__PROXMOX_FORMAT_DEVICE__"), | |
23 | ("", "PXAR_XATTR", "__PROXMOX_FORMAT_XATTR__"), | |
24 | ("", "PXAR_ACL_USER", "__PROXMOX_FORMAT_ACL_USER__"), | |
25 | ("", "PXAR_ACL_GROUP", "__PROXMOX_FORMAT_ACL_GROUP__"), | |
26 | ("", "PXAR_ACL_GROUP_OBJ", "__PROXMOX_FORMAT_ACL_GROUP_OBJ__"), | |
27 | ("", "PXAR_ACL_DEFAULT", "__PROXMOX_FORMAT_ACL_DEFAULT__"), | |
37774a67 WB |
28 | ( |
29 | "", | |
30 | "PXAR_ACL_DEFAULT_USER", | |
31 | "__PROXMOX_FORMAT_ACL_DEFAULT_USER__", | |
32 | ), | |
33 | ( | |
34 | "", | |
35 | "PXAR_ACL_DEFAULT_GROUP", | |
36 | "__PROXMOX_FORMAT_ACL_DEFAULT_GROUP__", | |
37 | ), | |
1b1e52a4 WB |
38 | ("", "PXAR_FCAPS", "__PROXMOX_FORMAT_FCAPS__"), |
39 | ("", "PXAR_QUOTA_PROJID", "__PROXMOX_FORMAT_QUOTA_PROJID__"), | |
37774a67 WB |
40 | ( |
41 | "Marks item as hardlink", | |
42 | "PXAR_HARDLINK", | |
43 | "__PROXMOX_FORMAT_HARDLINK__", | |
44 | ), | |
1b1e52a4 | 45 | ( |
f5be8e5c | 46 | "Marks the beginning of the payload (actual content) of regular files", |
1b1e52a4 WB |
47 | "PXAR_PAYLOAD", |
48 | "__PROXMOX_FORMAT_PXAR_PAYLOAD__", | |
49 | ), | |
d3447d01 CE |
50 | ( |
51 | "Marks the beginning of a payload reference for regular files", | |
52 | "PXAR_PAYLOAD_REF", | |
53 | "__PROXMOX_FORMAT_PXAR_PAYLOAD_REF__", | |
54 | ), | |
37774a67 WB |
55 | ( |
56 | "Marks item as entry of goodbye table", | |
57 | "PXAR_GOODBYE", | |
58 | "__PROXMOX_FORMAT_GOODBYE__", | |
59 | ), | |
1b1e52a4 WB |
60 | ( |
61 | "The end marker used in the GOODBYE object", | |
62 | "PXAR_GOODBYE_TAIL_MARKER", | |
63 | "__PROXMOX_FORMAT_PXAR_GOODBYE_TAIL_MARKER__", | |
64 | ), | |
ef8b7237 CE |
65 | ( |
66 | "The start marker used in the separate payload stream", | |
67 | "PXAR_PAYLOAD_START_MARKER", | |
68 | "__PROXMOX_FORMAT_PXAR_PAYLOAD_START_MARKER__", | |
69 | ), | |
d51db639 CE |
70 | ( |
71 | "The end marker used in the separate payload stream", | |
72 | "PXAR_PAYLOAD_TAIL_MARKER", | |
73 | "__PROXMOX_FORMAT_PXAR_PAYLOAD_TAIL_MARKER__", | |
74 | ), | |
1b1e52a4 WB |
75 | ]; |
76 | ||
77 | fn main() { | |
00d36bf9 | 78 | println!("// Generated by `cargo run --example mk-format-hashes`"); |
1b1e52a4 WB |
79 | for constant in CONSTANTS { |
80 | if !constant.0.is_empty() { | |
81 | println!("/// {}", constant.0); | |
82 | } | |
83 | println!( | |
84 | "pub const {}: u64 = 0x{:016x};", | |
85 | constant.1, | |
86 | hash_filename(constant.2.as_bytes()), | |
87 | ) | |
88 | } | |
89 | } |