mptar_header
Module: Archive Data Structures
Raw 512-byte POSIX USTAR header layout matching the exact on-disk binary format. More...
#include <minipaxtar.h>
Public Attributes
| Name | |
|---|---|
| char[100] | name File path or filename (null-terminated if under 100 bytes). |
| char[8] | mode File permissions in octal ASCII or base-256 binary. |
| char[8] | uid Owner user ID in octal ASCII or base-256 binary. |
| char[8] | gid Owner group ID in octal ASCII or base-256 binary. |
| char[12] | size File payload size in octal ASCII or base-256 binary. |
| char[12] | mtime Modification time (Unix epoch seconds) in octal ASCII or base-256 binary. |
| char[8] | checksum Header checksum in octal ASCII. |
| char | typeflag File entry type flag. |
| char[100] | linkname Target path for symbolic or hard links. |
| char[6] | magic USTAR magic indicator ("ustar" or "ustar\0"). |
| char[2] | version USTAR version string ("00"). |
| char[32] | uname Owner user name string. |
| char[32] | gname Owner group name string. |
| char[8] | devmajor Major device number for character/block special files in octal ASCII or base-256 binary. |
| char[8] | devminor Minor device number for character/block special files in octal ASCII or base-256 binary. |
| char[155] | prefix Path prefix used to extend file paths up to 256 total characters. |
| char[12] | padding Zero-padding bytes to complete the 512-byte block boundary. |
Detailed Description
struct mptar_header;
Raw 512-byte POSIX USTAR header layout matching the exact on-disk binary format.
Note: All octal ASCII fields (such as size, mtime, uid, gid, etc.) can optionally use base-256 binary encoding by setting the high-order bit (MPTAR_OCTAL_BINARY_FLAG) in the first byte, with the explicit exception of the checksum field, which must always remain in octal ASCII.
Public Attributes Documentation
variable name
char[100] name;
File path or filename (null-terminated if under 100 bytes).
variable mode
char[8] mode;
File permissions in octal ASCII or base-256 binary.
variable uid
char[8] uid;
Owner user ID in octal ASCII or base-256 binary.
variable gid
char[8] gid;
Owner group ID in octal ASCII or base-256 binary.
variable size
char[12] size;
File payload size in octal ASCII or base-256 binary.
variable mtime
char[12] mtime;
Modification time (Unix epoch seconds) in octal ASCII or base-256 binary.
variable checksum
char[8] checksum;
Header checksum in octal ASCII.
Note: Calculated by treating these 8 bytes as ASCII spaces, summing all 512 bytes of the header as unsigned bytes, and storing the result as an octal string followed by a null and a space. Binary encoding is strictly forbidden here.
variable typeflag
char typeflag;
File entry type flag.
Note: Standard values include:
'0'or'\0': Regular file - MPTAR_FILE and MPTAR_FILE_LEGACY'1': Hard link - MPTAR_HARD_LINK'2': Symbolic link - MPTAR_SYMLINK'3': Character special file - MPTAR_CHAR_FILE'4': Block special file - MPTAR_BLOCK_FILE'5': Directory - MPTAR_DIRECTORY'6': FIFO / pipe - MPTAR_PIPE'7': Contiguous file - MPTAR_CONTINOUS_FILE'x': PAX extended header - MPTAR_PAX_EX_HEADER'g': PAX global extended header - MPTAR_PAX_GLOBAL_EX_HEADER
See File Type Flags for defines of those.
variable linkname
char[100] linkname;
Target path for symbolic or hard links.
variable magic
char[6] magic;
USTAR magic indicator ("ustar" or "ustar\0").
variable version
char[2] version;
USTAR version string ("00").
variable uname
char[32] uname;
Owner user name string.
variable gname
char[32] gname;
Owner group name string.
variable devmajor
char[8] devmajor;
Major device number for character/block special files in octal ASCII or base-256 binary.
variable devminor
char[8] devminor;
Minor device number for character/block special files in octal ASCII or base-256 binary.
variable prefix
char[155] prefix;
Path prefix used to extend file paths up to 256 total characters.
variable padding
char[12] padding;
Zero-padding bytes to complete the 512-byte block boundary.
Updated on 2026-10-12 at 15:39:00 +0000