MCPcopy Create free account
hub / github.com/bootc-dev/bootc / tar_header_from_meta

Function tar_header_from_meta

crates/lib/src/container_export.rs:101–115  ·  view source on GitHub ↗

Create a tar header from filesystem metadata.

(
    entry_type: tar::EntryType,
    size: u64,
    meta: &cap_std_ext::cap_std::fs::Metadata,
)

Source from the content-addressed store, hash-verified

99
100/// Create a tar header from filesystem metadata.
101fn tar_header_from_meta(
102 entry_type: tar::EntryType,
103 size: u64,
104 meta: &cap_std_ext::cap_std::fs::Metadata,
105) -> tar::Header {
106 use cap_std_ext::cap_primitives::fs::{MetadataExt, PermissionsExt};
107
108 let mut header = tar::Header::new_gnu();
109 header.set_entry_type(entry_type);
110 header.set_size(size);
111 header.set_mode(meta.permissions().mode() & !libc::S_IFMT);
112 header.set_uid(meta.uid() as u64);
113 header.set_gid(meta.gid() as u64);
114 header
115}
116
117/// Create a tar header for a root-owned directory with mode 0755.
118fn tar_header_dir_root() -> tar::Header {

Callers 4

handle_kernel_relocationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected