xref: /titanic_44/usr/src/lib/libast/common/include/tar.h (revision 0a0e9771ca0211c15f3ac4466b661c145feeb9e4)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2008 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 /*
24  * Standard Archive Format
25  * USTAR - Uniform Standard Tape ARchive
26  */
27 
28 #ifndef _TAR_H
29 #define _TAR_H
30 
31 #define TBLOCK		512
32 #define NAMSIZ		100
33 #define PFXSIZ		155
34 
35 #define TMODLEN		8
36 #define TUIDLEN		8
37 #define TGIDLEN		8
38 #define TSIZLEN		12
39 #define TMTMLEN		12
40 #define TCKSLEN		8
41 
42 #define TMAGIC		"ustar"		/* ustar and a null		*/
43 #define TMAGLEN		6
44 #define TVERSION	"00"		/* 00 and no null		*/
45 #define TVERSLEN	2
46 #define TUNMLEN		32
47 #define TGNMLEN		32
48 #define TDEVLEN		8
49 
50 /*
51  * values used in typeflag field
52  */
53 
54 #define REGTYPE		'0'		/* regular file			*/
55 #define AREGTYPE	0		/* alternate REGTYPE		*/
56 #define LNKTYPE		'1'		/* hard link			*/
57 #define SYMTYPE		'2'		/* soft link			*/
58 #define CHRTYPE		'3'		/* character special		*/
59 #define BLKTYPE		'4'		/* block special		*/
60 #define DIRTYPE		'5'		/* directory			*/
61 #define FIFOTYPE	'6'		/* FIFO special			*/
62 #define CONTTYPE	'7'		/* reserved			*/
63 #define SOKTYPE		'8'		/* socket			*/
64 #define EXTTYPE		'x'		/* extended header		*/
65 #define GLBTYPE		'g'		/* global extended header	*/
66 #define LLNKTYPE	'K'		/* long link path		*/
67 #define LREGTYPE	'L'		/* long file path		*/
68 #define VERTYPE		'V'		/* version			*/
69 
70 /*
71  * bits used in mode field
72  */
73 
74 #define TSUID		04000		/* set uid on exec		*/
75 #define TSGID		02000		/* set gid on exec		*/
76 #define TSVTX		01000		/* sticky bit -- reserved	*/
77 
78 /*
79  * file permissions
80  */
81 
82 #define TUREAD		00400		/* read by owner		*/
83 #define TUWRITE		00200		/* write by owner		*/
84 #define TUEXEC		00100		/* execute by owner		*/
85 #define TGREAD		00040		/* read by group		*/
86 #define TGWRITE		00020		/* execute by group		*/
87 #define TGEXEC		00010		/* write by group		*/
88 #define TOREAD		00004		/* read by other		*/
89 #define TOWRITE		00002		/* write by other		*/
90 #define TOEXEC		00001		/* execute by other		*/
91 
92 struct header
93 {
94 	char		name[NAMSIZ];
95 	char		mode[TMODLEN];
96 	char		uid[TUIDLEN];
97 	char		gid[TGIDLEN];
98 	char		size[TSIZLEN];
99 	char		mtime[TMTMLEN];
100 	char		chksum[TCKSLEN];
101 	char		typeflag;
102 	char		linkname[NAMSIZ];
103 	char		magic[TMAGLEN];
104 	char		version[TVERSLEN];
105 	char		uname[TUNMLEN];
106 	char		gname[TGNMLEN];
107 	char		devmajor[TDEVLEN];
108 	char		devminor[TDEVLEN];
109 	char		prefix[PFXSIZ];
110 };
111 
112 union hblock
113 {
114 	char		dummy[TBLOCK];
115 	struct header	dbuf;
116 };
117 
118 #endif
119