1 /* Extended tar format from POSIX.1.
2 Copyright (C) 1992, 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Written by David J. MacKenzie.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
24 /* A tar archive consists of 512-byte blocks.
25 Each file in the archive has a header block followed by 0+ data blocks.
26 Two blocks of NUL bytes indicate the end of the archive. */
28 /* The fields of header blocks:
29 All strings are stored as ISO 646 (approximately ASCII) strings.
31 Fields are numeric unless otherwise noted below; numbers are ISO 646
32 representations of octal numbers, with leading zeros as needed.
34 linkname is only valid when typeflag==LNKTYPE. It doesn't use prefix;
35 files that are links to pathnames >100 chars long can not be stored
38 If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0.
40 devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}.
42 chksum contains the sum of all 512 bytes in the header block,
43 treating each byte as an 8-bit unsigned value and treating the
44 8 bytes of chksum as blank characters.
46 uname and gname are used in preference to uid and gid, if those
49 Field Name Byte Offset Length in Bytes Field Type
50 name 0 100 NUL-terminated if NUL fits
57 typeflag 156 1 see below
58 linkname 157 100 NUL-terminated if NUL fits
59 magic 257 6 must be TMAGIC (NUL term.)
60 version 263 2 must be TVERSION
61 uname 265 32 NUL-terminated
62 gname 297 32 NUL-terminated
65 prefix 345 155 NUL-terminated if NUL fits
67 If the first character of prefix is '\0', the file name is name;
68 otherwise, it is prefix/name. Files whose pathnames don't fit in that
69 length can not be stored in a tar archive. */
71 /* The bits in mode: */
85 /* The values for typeflag:
86 Values 'A'-'Z' are reserved for custom implementations.
87 All other values are reserved for future POSIX.1 revisions. */
89 #define REGTYPE '0' /* Regular file (preferred code). */
90 #define AREGTYPE '\0' /* Regular file (alternate code). */
91 #define LNKTYPE '1' /* Hard link. */
92 #define SYMTYPE '2' /* Symbolic link (hard if not supported). */
93 #define CHRTYPE '3' /* Character special. */
94 #define BLKTYPE '4' /* Block special. */
95 #define DIRTYPE '5' /* Directory. */
96 #define FIFOTYPE '6' /* Named pipe. */
97 #define CONTTYPE '7' /* Contiguous file */
98 /* (regular file if not supported). */
100 /* Contents of magic field and its length. */
101 #define TMAGIC "ustar"
104 /* Contents of the version field and its length. */
105 #define TVERSION "00"