Blame src/tar.h

Packit 1ef1a9
/* Extended tar format from POSIX.1.
Packit 1ef1a9
   Copyright (C) 1992, 2007, 2010, 2014-2015 Free Software Foundation,
Packit 1ef1a9
   Inc.
Packit 1ef1a9
   Written by David J. MacKenzie.
Packit 1ef1a9
Packit 1ef1a9
This file is part of the GNU C Library.
Packit 1ef1a9
Packit 1ef1a9
The GNU C Library is free software; you can redistribute it and/or
Packit 1ef1a9
modify it under the terms of the GNU Library General Public License as
Packit 1ef1a9
published by the Free Software Foundation; either version 3 of the
Packit 1ef1a9
License, or (at your option) any later version.
Packit 1ef1a9
Packit 1ef1a9
The GNU C Library is distributed in the hope that it will be useful,
Packit 1ef1a9
but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1ef1a9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 1ef1a9
Library General Public License for more details.
Packit 1ef1a9
Packit 1ef1a9
You should have received a copy of the GNU Library General
Packit 1ef1a9
Public License along with this library; see the file COPYING.LIB.
Packit 1ef1a9
If not, write to the Free Software Foundation, Inc., 51 Franklin
Packit 1ef1a9
Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
Packit 1ef1a9
Packit 1ef1a9
#ifndef	_TAR_H
Packit 1ef1a9
Packit 1ef1a9
#define	_TAR_H	1
Packit 1ef1a9
Packit 1ef1a9
Packit 1ef1a9
/* A tar archive consists of 512-byte blocks.
Packit 1ef1a9
   Each file in the archive has a header block followed by 0+ data blocks.
Packit 1ef1a9
   Two blocks of NUL bytes indicate the end of the archive.  */
Packit 1ef1a9
Packit 1ef1a9
/* The fields of header blocks:
Packit 1ef1a9
   All strings are stored as ISO 646 (approximately ASCII) strings.
Packit 1ef1a9
Packit 1ef1a9
   Fields are numeric unless otherwise noted below; numbers are ISO 646
Packit 1ef1a9
   representations of octal numbers, with leading zeros as needed.
Packit 1ef1a9
Packit 1ef1a9
   linkname is only valid when typeflag==LNKTYPE.  It doesn't use prefix;
Packit 1ef1a9
   files that are links to pathnames >100 chars long can not be stored
Packit 1ef1a9
   in a tar archive.
Packit 1ef1a9
Packit 1ef1a9
   If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0.
Packit 1ef1a9
Packit 1ef1a9
   devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}.
Packit 1ef1a9
Packit 1ef1a9
   chksum contains the sum of all 512 bytes in the header block,
Packit 1ef1a9
   treating each byte as an 8-bit unsigned value and treating the
Packit 1ef1a9
   8 bytes of chksum as blank characters.
Packit 1ef1a9
Packit 1ef1a9
   uname and gname are used in preference to uid and gid, if those
Packit 1ef1a9
   names exist locally.
Packit 1ef1a9
Packit 1ef1a9
   Field Name	Byte Offset	Length in Bytes	Field Type
Packit 1ef1a9
   name		0		100		NUL-terminated if NUL fits
Packit 1ef1a9
   mode		100		8
Packit 1ef1a9
   uid		108		8
Packit 1ef1a9
   gid		116		8
Packit 1ef1a9
   size		124		12
Packit 1ef1a9
   mtime	136		12
Packit 1ef1a9
   chksum	148		8
Packit 1ef1a9
   typeflag	156		1		see below
Packit 1ef1a9
   linkname	157		100		NUL-terminated if NUL fits
Packit 1ef1a9
   magic	257		6		must be TMAGIC (NUL term.)
Packit 1ef1a9
   version	263		2		must be TVERSION
Packit 1ef1a9
   uname	265		32		NUL-terminated
Packit 1ef1a9
   gname	297		32		NUL-terminated
Packit 1ef1a9
   devmajor	329		8
Packit 1ef1a9
   devminor	337		8
Packit 1ef1a9
   prefix	345		155		NUL-terminated if NUL fits
Packit 1ef1a9
Packit 1ef1a9
   If the first character of prefix is '\0', the file name is name;
Packit 1ef1a9
   otherwise, it is prefix/name.  Files whose pathnames don't fit in that
Packit 1ef1a9
   length can not be stored in a tar archive.  */
Packit 1ef1a9
Packit 1ef1a9
/* The bits in mode: */
Packit 1ef1a9
#define TSUID	04000
Packit 1ef1a9
#define TSGID	02000
Packit 1ef1a9
#define TSVTX	01000
Packit 1ef1a9
#define TUREAD	00400
Packit 1ef1a9
#define TUWRITE	00200
Packit 1ef1a9
#define TUEXEC	00100
Packit 1ef1a9
#define TGREAD	00040
Packit 1ef1a9
#define TGWRITE	00020
Packit 1ef1a9
#define TGEXEC	00010
Packit 1ef1a9
#define TOREAD	00004
Packit 1ef1a9
#define TOWRITE	00002
Packit 1ef1a9
#define TOEXEC	00001
Packit 1ef1a9
Packit 1ef1a9
/* The values for typeflag:
Packit 1ef1a9
   Values 'A'-'Z' are reserved for custom implementations.
Packit 1ef1a9
   All other values are reserved for future POSIX.1 revisions.  */
Packit 1ef1a9
Packit 1ef1a9
#define REGTYPE		'0'	/* Regular file (preferred code).  */
Packit 1ef1a9
#define AREGTYPE	'\0'	/* Regular file (alternate code).  */
Packit 1ef1a9
#define LNKTYPE		'1'	/* Hard link.  */
Packit 1ef1a9
#define SYMTYPE		'2'	/* Symbolic link (hard if not supported).  */
Packit 1ef1a9
#define CHRTYPE		'3'	/* Character special.  */
Packit 1ef1a9
#define BLKTYPE		'4'	/* Block special.  */
Packit 1ef1a9
#define DIRTYPE		'5'	/* Directory.  */
Packit 1ef1a9
#define FIFOTYPE	'6'	/* Named pipe.  */
Packit 1ef1a9
#define CONTTYPE	'7'	/* Contiguous file */
Packit 1ef1a9
				/* (regular file if not supported).  */
Packit 1ef1a9
Packit 1ef1a9
/* Contents of magic field and its length.  */
Packit 1ef1a9
#define TMAGIC	"ustar"
Packit 1ef1a9
#define TMAGLEN	6
Packit 1ef1a9
Packit 1ef1a9
/* Contents of the version field and its length.  */
Packit 1ef1a9
#define TVERSION "00"
Packit 1ef1a9
#define TVERSLEN 2
Packit 1ef1a9
Packit 1ef1a9
Packit 1ef1a9
#endif	/* tar.h */