tarfile

POSIX ustar Tar Archive Format

Functions

FunctionDescription
_tar_byte_atInternal byte reader.
_tar_write_octalInternal: write octal string (zero-padded, len chars) at position. Writes rig…
_tar_read_octalInternal: read octal number from buffer.
_tar_checksumInternal: compute header checksum.
_tar_zero_blockInternal: zero-fill a 512-byte block.
tar_createCreate a write handle. out is the output buffer.
tar_add_fileAdd a file entry to the tar archive.
tar_finishWrite two zero blocks to finish the archive. Returns total length.
tar_openOpen a tar archive for reading.
tar_nextAdvance to next entry. Returns 1 if entry found, 0 if end of archive.
tar_entry_nameCopy current entry name to out. Returns length.
tar_entry_sizeGet size of current entry data.
tar_entry_dataCopy current entry data to out. Returns length.

Details

_tar_byte_at

fn _tar_byte_at(buf: &i8, idx: i64) -> i64

Internal byte reader.

_tar_write_octal

fn _tar_write_octal(out: &i8, pos: i64, val: i64, len: i64) -> i64

Internal: write octal string (zero-padded, len chars) at position. Writes right-to-left directly into output to avoid alloc_pages.

_tar_read_octal

fn _tar_read_octal(buf: &i8, pos: i64, len: i64) -> i64

Internal: read octal number from buffer.

_tar_checksum

fn _tar_checksum(buf: &i8, pos: i64) -> i64

Internal: compute header checksum.

_tar_zero_block

fn _tar_zero_block(buf: &i8, pos: i64) -> i64

Internal: zero-fill a 512-byte block.

tar_create

fn tar_create(out: &i8) -> &i64

Create a write handle. out is the output buffer.

tar_add_file

fn tar_add_file(h: &i64, name: &i8, nlen: i64, data: &i8, dlen: i64) -> i64

Add a file entry to the tar archive.

tar_finish

fn tar_finish(h: &i64) -> i64

Write two zero blocks to finish the archive. Returns total length.

tar_open

fn tar_open(buf: &i8, len: i64) -> &i64

Open a tar archive for reading.

tar_next

fn tar_next(h: &i64) -> i64

Advance to next entry. Returns 1 if entry found, 0 if end of archive.

tar_entry_name

fn tar_entry_name(h: &i64, out: &i8) -> i64

Copy current entry name to out. Returns length.

tar_entry_size

fn tar_entry_size(h: &i64) -> i64

Get size of current entry data.

tar_entry_data

fn tar_entry_data(h: &i64, out: &i8) -> i64

Copy current entry data to out. Returns length.