with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* If OLDGNU_COMPATIBILITY is not zero, tar produces archives which, by
- default, are readable by older versions of GNU tar. This can be
- overriden by using --posix; in this case, POSIXLY_CORRECT in environment
- may be set for enforcing stricter conformance. If OLDGNU_COMPATIBILITY
- is zero or undefined, tar will eventually produces archives which, by
- default, POSIX compatible; then either using --posix or defining
- POSIXLY_CORRECT enforces stricter conformance.
-
- This #define will disappear in a few years. FP, June 1995. */
-#define OLDGNU_COMPATIBILITY 1
-
/* tar Header Block, from POSIX 1003.1-1990. */
/* POSIX header. */
#define SPARSES_IN_OLDGNU_HEADER 4
#define SPARSES_IN_SPARSE_HEADER 21
-/* The GNU extra header contains some information GNU tar needs, but not
- foreseen in POSIX header format. It is only used after a POSIX header
- (and never with old GNU headers), and immediately follows this POSIX
- header, when typeflag is a letter rather than a digit, so signaling a GNU
- extension. */
-
-struct extra_header
-{ /* byte offset */
- char atime[12]; /* 0 */
- char ctime[12]; /* 12 */
- char offset[12]; /* 24 */
- char realsize[12]; /* 36 */
- char longnames[4]; /* 48 */
- char unused_pad1[68]; /* 52 */
- struct sparse sp[SPARSES_IN_EXTRA_HEADER];
- /* 120 */
- char isextended; /* 504 */
- /* 505 */
-};
-
/* Extension header for sparse files, used immediately after the GNU extra
header, and used only if all sparse information cannot fit into that
extra header. There might even be many such extension headers, one after
struct oldgnu_header
{ /* byte offset */
char unused_pad1[345]; /* 0 */
- char atime[12]; /* 345 */
- char ctime[12]; /* 357 */
- char offset[12]; /* 369 */
- char longnames[4]; /* 381 */
+ char atime[12]; /* 345 Incr. archive: atime of the file */
+ char ctime[12]; /* 357 Incr. archive: ctime of the file */
+ char offset[12]; /* 369 Multivolume archive: the offset of
+ the start of this volume */
+ char longnames[4]; /* 381 Not used */
char unused_pad2; /* 385 */
struct sparse sp[SPARSES_IN_OLDGNU_HEADER];
/* 386 */
- char isextended; /* 482 */
- char realsize[12]; /* 483 */
+ char isextended; /* 482 Sparse file: Extension sparse header
+ follows */
+ char realsize[12]; /* 483 Sparse file: Real size*/
/* 495 */
};
DEFAULT_FORMAT, /* format to be decided later */
V7_FORMAT, /* old V7 tar format */
OLDGNU_FORMAT, /* GNU format as per before tar 1.12 */
- POSIX_FORMAT, /* restricted, pure POSIX format */
+ USTAR_FORMAT, /* POSIX.1-1988 (ustar) format */
+ POSIX_FORMAT, /* POSIX.1-2001 format */
STAR_FORMAT, /* Star format defined in 1994 */
GNU_FORMAT /* POSIX format with GNU extensions */
};
+/* Information about a sparse file. */
+struct sp_array
+ {
+ off_t offset;
+ size_t numbytes;
+ };
+
struct tar_stat_info
{
char *orig_file_name; /* name of file read from the archive header */
unsigned int devmajor; /* device major number */
char *uname; /* user name of owner */
char *gname; /* group name of owner */
- struct stat stat; /* regular filesystem stat */
+ struct stat stat; /* regular filesystem stat */
+
+ off_t archive_file_size; /* Size of file as stored in the archive.
+ Equals stat.st_size for non-sparse files */
+
+ size_t sparse_map_avail; /* Index to the first unused element in
+ sparse_map array. Zero if the file is
+ not sparse */
+ size_t sparse_map_size; /* Size of the sparse map */
+ struct sp_array *sparse_map;
};
union block
char buffer[BLOCKSIZE];
struct posix_header header;
struct star_header star_header;
- struct extra_header extra_header;
struct oldgnu_header oldgnu_header;
struct sparse_header sparse_header;
};