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