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
  • '1': Hard link
  • '2': Symbolic link
  • '3': Character special file
  • '4': Block special file
  • '5': Directory
  • '6': FIFO / pipe
  • '7': Contiguous file
  • 'x': PAX extended header
  • 'g': PAX global extended header

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-07-23 at 20:07:34 +0000