]>
Commit | Line | Data |
---|---|---|
28f540f4 | 1 | /* Extended tar format from POSIX.1. |
b0d20a87 | 2 | Copyright (C) 1992, 1996 Free Software Foundation, Inc. |
54d79e99 | 3 | This file is part of the GNU C Library. |
28f540f4 RM |
4 | Written by David J. MacKenzie. |
5 | ||
54d79e99 | 6 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 10 | |
54d79e99 UD |
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 | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
28f540f4 | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
28f540f4 RM |
19 | |
20 | #ifndef _TAR_H | |
28f540f4 RM |
21 | #define _TAR_H 1 |
22 | ||
23 | /* A tar archive consists of 512-byte blocks. | |
24 | Each file in the archive has a header block followed by 0+ data blocks. | |
25 | Two blocks of NUL bytes indicate the end of the archive. */ | |
26 | ||
27 | /* The fields of header blocks: | |
28 | All strings are stored as ISO 646 (approximately ASCII) strings. | |
29 | ||
30 | Fields are numeric unless otherwise noted below; numbers are ISO 646 | |
31 | representations of octal numbers, with leading zeros as needed. | |
32 | ||
33 | linkname is only valid when typeflag==LNKTYPE. It doesn't use prefix; | |
34 | files that are links to pathnames >100 chars long can not be stored | |
35 | in a tar archive. | |
36 | ||
37 | If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0. | |
38 | ||
39 | devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}. | |
40 | ||
41 | chksum contains the sum of all 512 bytes in the header block, | |
42 | treating each byte as an 8-bit unsigned value and treating the | |
43 | 8 bytes of chksum as blank characters. | |
44 | ||
45 | uname and gname are used in preference to uid and gid, if those | |
46 | names exist locally. | |
47 | ||
48 | Field Name Byte Offset Length in Bytes Field Type | |
49 | name 0 100 NUL-terminated if NUL fits | |
50 | mode 100 8 | |
51 | uid 108 8 | |
52 | gid 116 8 | |
53 | size 124 12 | |
54 | mtime 136 12 | |
55 | chksum 148 8 | |
56 | typeflag 156 1 see below | |
57 | linkname 157 100 NUL-terminated if NUL fits | |
58 | magic 257 6 must be TMAGIC (NUL term.) | |
59 | version 263 2 must be TVERSION | |
60 | uname 265 32 NUL-terminated | |
61 | gname 297 32 NUL-terminated | |
62 | devmajor 329 8 | |
63 | devminor 337 8 | |
64 | prefix 345 155 NUL-terminated if NUL fits | |
65 | ||
66 | If the first character of prefix is '\0', the file name is name; | |
67 | otherwise, it is prefix/name. Files whose pathnames don't fit in that | |
68 | length can not be stored in a tar archive. */ | |
69 | ||
70 | /* The bits in mode: */ | |
71 | #define TSUID 04000 | |
72 | #define TSGID 02000 | |
73 | #define TSVTX 01000 | |
74 | #define TUREAD 00400 | |
75 | #define TUWRITE 00200 | |
76 | #define TUEXEC 00100 | |
77 | #define TGREAD 00040 | |
78 | #define TGWRITE 00020 | |
79 | #define TGEXEC 00010 | |
80 | #define TOREAD 00004 | |
81 | #define TOWRITE 00002 | |
82 | #define TOEXEC 00001 | |
83 | ||
84 | /* The values for typeflag: | |
85 | Values 'A'-'Z' are reserved for custom implementations. | |
86 | All other values are reserved for future POSIX.1 revisions. */ | |
87 | ||
88 | #define REGTYPE '0' /* Regular file (preferred code). */ | |
89 | #define AREGTYPE '\0' /* Regular file (alternate code). */ | |
90 | #define LNKTYPE '1' /* Hard link. */ | |
91 | #define SYMTYPE '2' /* Symbolic link (hard if not supported). */ | |
92 | #define CHRTYPE '3' /* Character special. */ | |
93 | #define BLKTYPE '4' /* Block special. */ | |
94 | #define DIRTYPE '5' /* Directory. */ | |
95 | #define FIFOTYPE '6' /* Named pipe. */ | |
96 | #define CONTTYPE '7' /* Contiguous file */ | |
97 | /* (regular file if not supported). */ | |
98 | ||
99 | /* Contents of magic field and its length. */ | |
100 | #define TMAGIC "ustar" | |
101 | #define TMAGLEN 6 | |
102 | ||
103 | /* Contents of the version field and its length. */ | |
104 | #define TVERSION "00" | |
105 | #define TVERSLEN 2 | |
106 | ||
107 | #endif /* tar.h */ |