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