/ [cpio] / cpio / src / tar.h
To checkout: cvs -d:pserver:anonymous@cvs.gnu.org.ua:/cvsmirror/cpio co cpio/src/tar.h
Puszcza

Annotation of /cpio/src/tar.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Thu May 19 09:35:29 2005 UTC (16 years, 8 months ago) by gray
Branch: MAIN
CVS Tags: release_2_7
Changes since 1.1: +4 -4 lines
File MIME type: text/plain
Updated FSF postal mail address.

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

Send suggestions and bug reports to Sergey Poznyakoff
ViewVC Help
Powered by ViewVC 1.1.20