2020-06-24 13:31:33 +02:00
use pxar ::format ::hash_filename ;
const CONSTANTS : & [ ( & str , & str , & str ) ] = & [
2020-07-28 12:33:18 +02:00
(
" Beginning of an entry (current version). " ,
" PXAR_ENTRY " ,
" __PROXMOX_FORMAT_ENTRY_V2__ " ,
) ,
(
" Previous version of the entry struct " ,
" PXAR_ENTRY_V1 " ,
" __PROXMOX_FORMAT_ENTRY__ " ,
) ,
2020-06-24 13:31:33 +02:00
( " " , " PXAR_FILENAME " , " __PROXMOX_FORMAT_FILENAME__ " ) ,
( " " , " PXAR_SYMLINK " , " __PROXMOX_FORMAT_SYMLINK__ " ) ,
( " " , " PXAR_DEVICE " , " __PROXMOX_FORMAT_DEVICE__ " ) ,
( " " , " PXAR_XATTR " , " __PROXMOX_FORMAT_XATTR__ " ) ,
( " " , " PXAR_ACL_USER " , " __PROXMOX_FORMAT_ACL_USER__ " ) ,
( " " , " PXAR_ACL_GROUP " , " __PROXMOX_FORMAT_ACL_GROUP__ " ) ,
( " " , " PXAR_ACL_GROUP_OBJ " , " __PROXMOX_FORMAT_ACL_GROUP_OBJ__ " ) ,
( " " , " PXAR_ACL_DEFAULT " , " __PROXMOX_FORMAT_ACL_DEFAULT__ " ) ,
2020-06-25 12:14:03 +02:00
(
" " ,
" PXAR_ACL_DEFAULT_USER " ,
" __PROXMOX_FORMAT_ACL_DEFAULT_USER__ " ,
) ,
(
" " ,
" PXAR_ACL_DEFAULT_GROUP " ,
" __PROXMOX_FORMAT_ACL_DEFAULT_GROUP__ " ,
) ,
2020-06-24 13:31:33 +02:00
( " " , " PXAR_FCAPS " , " __PROXMOX_FORMAT_FCAPS__ " ) ,
( " " , " PXAR_QUOTA_PROJID " , " __PROXMOX_FORMAT_QUOTA_PROJID__ " ) ,
2020-06-25 12:14:03 +02:00
(
" Marks item as hardlink " ,
" PXAR_HARDLINK " ,
" __PROXMOX_FORMAT_HARDLINK__ " ,
) ,
2020-06-24 13:31:33 +02:00
(
2024-02-28 15:01:51 +01:00
" Marks the beginning of the payload (actual content) of regular files " ,
2020-06-24 13:31:33 +02:00
" PXAR_PAYLOAD " ,
" __PROXMOX_FORMAT_PXAR_PAYLOAD__ " ,
) ,
2024-02-01 12:51:56 +01:00
(
" Marks the beginning of a payload reference for regular files " ,
" PXAR_PAYLOAD_REF " ,
" __PROXMOX_FORMAT_PXAR_PAYLOAD_REF__ " ,
) ,
2020-06-25 12:14:03 +02:00
(
" Marks item as entry of goodbye table " ,
" PXAR_GOODBYE " ,
" __PROXMOX_FORMAT_GOODBYE__ " ,
) ,
2020-06-24 13:31:33 +02:00
(
" The end marker used in the GOODBYE object " ,
" PXAR_GOODBYE_TAIL_MARKER " ,
" __PROXMOX_FORMAT_PXAR_GOODBYE_TAIL_MARKER__ " ,
) ,
] ;
fn main ( ) {
2023-04-28 10:54:43 +02:00
println! ( " // Generated by `cargo run --example mk-format-hashes` " ) ;
2020-06-24 13:31:33 +02:00
for constant in CONSTANTS {
if ! constant . 0. is_empty ( ) {
println! ( " /// {} " , constant . 0 ) ;
}
println! (
" pub const {}: u64 = 0x{:016x}; " ,
constant . 1 ,
hash_filename ( constant . 2. as_bytes ( ) ) ,
)
}
}