00001 /* Extended tar format from POSIX.1. 00002 Copyright (C) 1992, 1996 Free Software Foundation, Inc. 00003 This file is part of the GNU C Library. 00004 Written by David J. MacKenzie. 00005 00006 The GNU C Library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 The GNU C Library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with the GNU C Library; if not, write to the Free 00018 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00019 02111-1307 USA. */ 00020 00021 #ifndef _TAR_H 00022 #define _TAR_H 1 00023 00024 /* A tar archive consists of 512-byte blocks. 00025 Each file in the archive has a header block followed by 0+ data blocks. 00026 Two blocks of NUL bytes indicate the end of the archive. */ 00027 00028 /* The fields of header blocks: 00029 All strings are stored as ISO 646 (approximately ASCII) strings. 00030 00031 Fields are numeric unless otherwise noted below; numbers are ISO 646 00032 representations of octal numbers, with leading zeros as needed. 00033 00034 linkname is only valid when typeflag==LNKTYPE. It doesn't use prefix; 00035 files that are links to pathnames >100 chars long can not be stored 00036 in a tar archive. 00037 00038 If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0. 00039 00040 devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}. 00041 00042 chksum contains the sum of all 512 bytes in the header block, 00043 treating each byte as an 8-bit unsigned value and treating the 00044 8 bytes of chksum as blank characters. 00045 00046 uname and gname are used in preference to uid and gid, if those 00047 names exist locally. 00048 00049 Field Name Byte Offset Length in Bytes Field Type 00050 name 0 100 NUL-terminated if NUL fits 00051 mode 100 8 00052 uid 108 8 00053 gid 116 8 00054 size 124 12 00055 mtime 136 12 00056 chksum 148 8 00057 typeflag 156 1 see below 00058 linkname 157 100 NUL-terminated if NUL fits 00059 magic 257 6 must be TMAGIC (NUL term.) 00060 version 263 2 must be TVERSION 00061 uname 265 32 NUL-terminated 00062 gname 297 32 NUL-terminated 00063 devmajor 329 8 00064 devminor 337 8 00065 prefix 345 155 NUL-terminated if NUL fits 00066 00067 If the first character of prefix is '\0', the file name is name; 00068 otherwise, it is prefix/name. Files whose pathnames don't fit in that 00069 length can not be stored in a tar archive. */ 00070 00071 /* The bits in mode: */ 00072 #define TSUID 04000 00073 #define TSGID 02000 00074 #define TSVTX 01000 00075 #define TUREAD 00400 00076 #define TUWRITE 00200 00077 #define TUEXEC 00100 00078 #define TGREAD 00040 00079 #define TGWRITE 00020 00080 #define TGEXEC 00010 00081 #define TOREAD 00004 00082 #define TOWRITE 00002 00083 #define TOEXEC 00001 00084 00085 /* The values for typeflag: 00086 Values 'A'-'Z' are reserved for custom implementations. 00087 All other values are reserved for future POSIX.1 revisions. */ 00088 00089 #define REGTYPE '0' /* Regular file (preferred code). */ 00090 #define AREGTYPE '\0' /* Regular file (alternate code). */ 00091 #define LNKTYPE '1' /* Hard link. */ 00092 #define SYMTYPE '2' /* Symbolic link (hard if not supported). */ 00093 #define CHRTYPE '3' /* Character special. */ 00094 #define BLKTYPE '4' /* Block special. */ 00095 #define DIRTYPE '5' /* Directory. */ 00096 #define FIFOTYPE '6' /* Named pipe. */ 00097 #define CONTTYPE '7' /* Contiguous file */ 00098 /* (regular file if not supported). */ 00099 00100 /* Contents of magic field and its length. */ 00101 #define TMAGIC "ustar" 00102 #define TMAGLEN 6 00103 00104 /* Contents of the version field and its length. */ 00105 #define TVERSION "00" 00106 #define TVERSLEN 2 00107 00108 #endif /* tar.h */